From f35f3d2c7452207194fb93544ba82283e0c72958 Mon Sep 17 00:00:00 2001 From: SCFireblocks Date: Wed, 8 Nov 2023 17:23:31 +0000 Subject: [PATCH] Generated SDK for version master --- README.md | 2 + docs/models/ExternalWalletAsset.md | 2 + docs/models/Ncw.md | 15 + docs/models/RequestOptions.md | 16 + fireblocks_client/api_client.py | 5 +- .../model/external_wallet_asset.py | 24 +- .../model/external_wallet_asset.pyi | 24 +- fireblocks_client/model/ncw.py | 79 +++++ fireblocks_client/model/ncw.pyi | 79 +++++ fireblocks_client/model/request_options.py | 94 ++++++ fireblocks_client/model/request_options.pyi | 94 ++++++ fireblocks_client/models/__init__.py | 2 + fireblocks_client/paths/audits/get.py | 190 +++--------- fireblocks_client/paths/audits/get.pyi | 183 +++--------- fireblocks_client/paths/connections/get.py | 202 ++++--------- fireblocks_client/paths/connections/get.pyi | 191 +++--------- .../paths/connections_wc/post.py | 238 ++++----------- .../paths/connections_wc/post.pyi | 227 +++----------- .../paths/connections_wc_id/delete.py | 163 +++-------- .../paths/connections_wc_id/delete.pyi | 152 +++------- .../paths/connections_wc_id/put.py | 241 ++++----------- .../paths/connections_wc_id/put.pyi | 226 +++----------- fireblocks_client/paths/contracts/get.py | 179 +++--------- fireblocks_client/paths/contracts/get.pyi | 172 +++-------- fireblocks_client/paths/contracts/post.py | 254 ++++------------ fireblocks_client/paths/contracts/post.pyi | 247 ++++------------ .../paths/contracts_contract_id/delete.py | 188 +++--------- .../paths/contracts_contract_id/delete.pyi | 181 +++--------- .../paths/contracts_contract_id/get.py | 196 +++---------- .../paths/contracts_contract_id/get.pyi | 189 +++--------- .../contracts_contract_id_asset_id/delete.py | 189 +++--------- .../contracts_contract_id_asset_id/delete.pyi | 182 +++--------- .../contracts_contract_id_asset_id/get.py | 197 ++++--------- .../contracts_contract_id_asset_id/get.pyi | 190 +++--------- .../contracts_contract_id_asset_id/post.py | 274 ++++------------- .../contracts_contract_id_asset_id/post.pyi | 267 ++++------------- .../paths/estimate_network_fee/get.py | 198 +++---------- .../paths/estimate_network_fee/get.pyi | 191 +++--------- .../paths/exchange_accounts/get.py | 179 +++--------- .../paths/exchange_accounts/get.pyi | 172 +++-------- .../get.py | 196 +++---------- .../get.pyi | 189 +++--------- .../get.py | 197 ++++--------- .../get.pyi | 190 +++--------- .../post.py | 265 ++++------------- .../post.pyi | 258 ++++------------ .../post.py | 265 ++++------------- .../post.pyi | 258 ++++------------ .../paths/external_wallets/get.py | 179 +++--------- .../paths/external_wallets/get.pyi | 172 +++-------- .../paths/external_wallets/post.py | 254 ++++------------ .../paths/external_wallets/post.pyi | 247 ++++------------ .../external_wallets_wallet_id/delete.py | 188 +++--------- .../external_wallets_wallet_id/delete.pyi | 181 +++--------- .../paths/external_wallets_wallet_id/get.py | 196 +++---------- .../paths/external_wallets_wallet_id/get.pyi | 189 +++--------- .../delete.py | 189 +++--------- .../delete.pyi | 182 +++--------- .../get.py | 197 ++++--------- .../get.pyi | 190 +++--------- .../post.py | 274 ++++------------- .../post.pyi | 267 ++++------------- .../post.py | 259 ++++------------ .../post.pyi | 252 ++++------------ fireblocks_client/paths/fiat_accounts/get.py | 179 +++--------- fireblocks_client/paths/fiat_accounts/get.pyi | 172 +++-------- .../paths/fiat_accounts_account_id/get.py | 196 +++---------- .../paths/fiat_accounts_account_id/get.pyi | 189 +++--------- .../post.py | 265 ++++------------- .../post.pyi | 258 ++++------------ .../post.py | 265 ++++------------- .../post.pyi | 258 ++++------------ fireblocks_client/paths/gas_station/get.py | 179 +++--------- fireblocks_client/paths/gas_station/get.pyi | 172 +++-------- .../paths/gas_station_asset_id/get.py | 196 +++---------- .../paths/gas_station_asset_id/get.pyi | 189 +++--------- .../paths/gas_station_configuration/put.py | 240 +++------------ .../paths/gas_station_configuration/put.pyi | 233 +++------------ .../gas_station_configuration_asset_id/put.py | 259 ++++------------ .../put.pyi | 252 ++++------------ .../paths/internal_wallets/get.py | 179 +++--------- .../paths/internal_wallets/get.pyi | 172 +++-------- .../paths/internal_wallets/post.py | 254 ++++------------ .../paths/internal_wallets/post.pyi | 247 ++++------------ .../internal_wallets_wallet_id/delete.py | 188 +++--------- .../internal_wallets_wallet_id/delete.pyi | 181 +++--------- .../paths/internal_wallets_wallet_id/get.py | 196 +++---------- .../paths/internal_wallets_wallet_id/get.pyi | 189 +++--------- .../delete.py | 189 +++--------- .../delete.pyi | 182 +++--------- .../get.py | 197 ++++--------- .../get.pyi | 190 +++--------- .../post.py | 274 ++++------------- .../post.pyi | 267 ++++------------- .../post.py | 259 ++++------------ .../post.pyi | 252 ++++------------ fireblocks_client/paths/management_ota/get.py | 145 ++------- .../paths/management_ota/get.pyi | 146 ++------- .../paths/management_ota/post.py | 190 ++---------- .../paths/management_ota/post.pyi | 191 +++--------- .../paths/network_connections/get.py | 179 +++--------- .../paths/network_connections/get.pyi | 172 +++-------- .../paths/network_connections/post.py | 254 ++++------------ .../paths/network_connections/post.pyi | 247 ++++------------ .../delete.py | 196 +++---------- .../delete.pyi | 189 +++--------- .../network_connections_connection_id/get.py | 196 +++---------- .../network_connections_connection_id/get.pyi | 189 +++--------- .../get.py | 197 ++++--------- .../get.pyi | 190 +++--------- .../patch.py | 273 ++++------------- .../patch.pyi | 266 ++++------------- fireblocks_client/paths/network_ids/get.py | 179 +++--------- fireblocks_client/paths/network_ids/get.pyi | 172 +++-------- fireblocks_client/paths/network_ids/post.py | 254 ++++------------ fireblocks_client/paths/network_ids/post.pyi | 247 ++++------------ .../paths/network_ids_network_id/delete.py | 188 +++--------- .../paths/network_ids_network_id/delete.pyi | 185 +++--------- .../paths/network_ids_network_id/get.py | 196 +++---------- .../paths/network_ids_network_id/get.pyi | 189 +++--------- .../patch.py | 267 ++++------------- .../patch.pyi | 260 ++++------------- .../network_ids_network_id_set_name/patch.py | 267 ++++------------- .../network_ids_network_id_set_name/patch.pyi | 260 ++++------------- .../patch.py | 273 ++++------------- .../patch.pyi | 266 ++++------------- .../paths/nfts_ownership_collections/get.py | 182 +++--------- .../paths/nfts_ownership_collections/get.pyi | 179 +++--------- .../paths/nfts_ownership_tokens/get.py | 197 ++++--------- .../paths/nfts_ownership_tokens/get.pyi | 194 ++++-------- .../paths/nfts_ownership_tokens/put.py | 148 ++-------- .../paths/nfts_ownership_tokens/put.pyi | 145 ++------- .../nfts_ownership_tokens_id_status/put.py | 211 +++---------- .../nfts_ownership_tokens_id_status/put.pyi | 208 +++---------- fireblocks_client/paths/nfts_tokens/get.py | 182 +++--------- fireblocks_client/paths/nfts_tokens/get.pyi | 179 +++--------- fireblocks_client/paths/nfts_tokens_id/get.py | 168 +++-------- .../paths/nfts_tokens_id/get.pyi | 165 +++-------- fireblocks_client/paths/nfts_tokens_id/put.py | 143 ++------- .../paths/nfts_tokens_id/put.pyi | 140 ++------- .../paths/off_exchange_add/post.py | 246 ++++------------ .../paths/off_exchange_add/post.pyi | 243 +++------------ .../get.py | 196 +++---------- .../get.pyi | 189 +++--------- .../paths/off_exchange_remove/post.py | 246 ++++------------ .../paths/off_exchange_remove/post.pyi | 243 +++------------ .../off_exchange_settlements_trader/post.py | 246 ++++------------ .../off_exchange_settlements_trader/post.pyi | 243 +++------------ .../get.py | 190 +++--------- .../get.pyi | 187 +++--------- .../paths/payments_payout/post.py | 246 ++++------------ .../paths/payments_payout/post.pyi | 247 ++++------------ .../paths/payments_payout_payout_id/get.py | 190 +++--------- .../paths/payments_payout_payout_id/get.pyi | 191 +++--------- .../post.py | 190 +++--------- .../post.pyi | 191 +++--------- .../payments_xb_settlements_configs/get.py | 163 +++-------- .../payments_xb_settlements_configs/get.pyi | 164 +++-------- .../payments_xb_settlements_configs/post.py | 246 ++++------------ .../payments_xb_settlements_configs/post.pyi | 247 ++++------------ .../delete.py | 190 +++--------- .../delete.pyi | 191 +++--------- .../get.py | 190 +++--------- .../get.pyi | 191 +++--------- .../put.py | 275 ++++------------- .../put.pyi | 276 +++++------------- .../payments_xb_settlements_flows/post.py | 246 ++++------------ .../payments_xb_settlements_flows/post.pyi | 247 ++++------------ .../get.py | 190 +++--------- .../get.pyi | 191 +++--------- .../post.py | 275 ++++------------- .../post.pyi | 276 +++++------------- .../screeening_travel_rule_vasp_update/put.py | 214 +++----------- .../put.pyi | 215 +++----------- .../post.py | 214 +++----------- .../post.pyi | 215 +++----------- .../post.py | 214 +++----------- .../post.pyi | 215 +++----------- .../paths/screening_travel_rule_vasp/get.py | 171 +++-------- .../paths/screening_travel_rule_vasp/get.pyi | 172 +++-------- .../screening_travel_rule_vasp_did/get.py | 183 +++--------- .../screening_travel_rule_vasp_did/get.pyi | 184 +++--------- .../paths/supported_assets/get.py | 179 +++--------- .../paths/supported_assets/get.pyi | 172 +++-------- .../paths/tap_active_policy/get.py | 179 +++--------- .../paths/tap_active_policy/get.pyi | 172 +++-------- fireblocks_client/paths/tap_draft/get.py | 179 +++--------- fireblocks_client/paths/tap_draft/get.pyi | 172 +++-------- fireblocks_client/paths/tap_draft/post.py | 248 ++++------------ fireblocks_client/paths/tap_draft/post.pyi | 241 +++------------ fireblocks_client/paths/tap_draft/put.py | 248 ++++------------ fireblocks_client/paths/tap_draft/put.pyi | 241 +++------------ fireblocks_client/paths/tap_publish/post.py | 248 ++++------------ fireblocks_client/paths/tap_publish/post.pyi | 241 +++------------ fireblocks_client/paths/transactions/get.py | 249 +++++----------- fireblocks_client/paths/transactions/get.pyi | 234 +++++---------- fireblocks_client/paths/transactions/post.py | 260 ++++------------- fireblocks_client/paths/transactions/post.pyi | 253 ++++------------ .../paths/transactions_estimate_fee/post.py | 254 ++++------------ .../paths/transactions_estimate_fee/post.pyi | 247 ++++------------ .../get.py | 196 +++---------- .../get.pyi | 189 +++--------- .../paths/transactions_tx_id/get.py | 214 ++++---------- .../paths/transactions_tx_id/get.pyi | 203 ++++--------- .../paths/transactions_tx_id_cancel/post.py | 196 +++---------- .../paths/transactions_tx_id_cancel/post.pyi | 189 +++--------- .../paths/transactions_tx_id_drop/post.py | 273 ++++------------- .../paths/transactions_tx_id_drop/post.pyi | 266 ++++------------- .../paths/transactions_tx_id_freeze/post.py | 168 +++-------- .../paths/transactions_tx_id_freeze/post.pyi | 165 +++-------- .../post.py | 273 ++++------------- .../post.pyi | 266 ++++------------- .../paths/transactions_tx_id_unfreeze/post.py | 168 +++-------- .../transactions_tx_id_unfreeze/post.pyi | 165 +++-------- .../get.py | 197 ++++--------- .../get.pyi | 190 +++--------- .../post.py | 273 ++++------------- .../post.pyi | 266 ++++------------- fireblocks_client/paths/users/get.py | 179 +++--------- fireblocks_client/paths/users/get.pyi | 172 +++-------- fireblocks_client/paths/users_groups/get.py | 179 +++--------- fireblocks_client/paths/users_groups/get.pyi | 172 +++-------- fireblocks_client/paths/users_groups/post.py | 248 ++++------------ fireblocks_client/paths/users_groups/post.pyi | 241 +++------------ .../paths/users_groups_group_id/delete.py | 188 +++--------- .../paths/users_groups_group_id/delete.pyi | 181 +++--------- .../paths/users_groups_group_id/get.py | 196 +++---------- .../paths/users_groups_group_id/get.pyi | 189 +++--------- .../paths/users_groups_group_id/put.py | 267 ++++------------- .../paths/users_groups_group_id/put.pyi | 260 ++++------------- fireblocks_client/paths/vault_accounts/get.py | 207 ++++--------- .../paths/vault_accounts/get.pyi | 200 ++++--------- .../paths/vault_accounts/post.py | 248 ++++------------ .../paths/vault_accounts/post.pyi | 241 +++------------ .../paths/vault_accounts_paged/get.py | 191 ++++-------- .../paths/vault_accounts_paged/get.pyi | 188 +++--------- .../vault_accounts_vault_account_id/get.py | 196 +++---------- .../vault_accounts_vault_account_id/get.pyi | 189 +++--------- .../vault_accounts_vault_account_id/put.py | 259 ++++------------ .../vault_accounts_vault_account_id/put.pyi | 252 ++++------------ .../get.py | 189 +++--------- .../get.pyi | 186 +++--------- .../post.py | 274 ++++------------- .../post.pyi | 267 ++++------------- .../post.py | 197 ++++--------- .../post.pyi | 190 +++--------- .../get.py | 197 ++++--------- .../get.pyi | 190 +++--------- .../post.py | 274 ++++------------- .../post.pyi | 267 ++++------------- .../put.py | 267 ++++------------- .../put.pyi | 260 ++++------------- .../post.py | 198 ++++--------- .../post.pyi | 191 +++--------- .../post.py | 261 ++++------------- .../post.pyi | 254 ++++------------ .../post.py | 274 ++++------------- .../post.pyi | 267 ++++------------- .../get.py | 218 ++++---------- .../get.pyi | 211 ++++--------- .../get.py | 208 ++++--------- .../get.pyi | 201 +++---------- .../get.py | 197 ++++--------- .../get.pyi | 190 +++--------- .../post.py | 188 +++--------- .../post.pyi | 181 +++--------- .../post.py | 259 ++++------------ .../post.pyi | 252 ++++------------ .../post.py | 259 ++++------------ .../post.pyi | 252 ++++------------ .../post.py | 188 +++--------- .../post.pyi | 181 +++--------- .../paths/vault_asset_wallets/get.py | 182 +++--------- .../paths/vault_asset_wallets/get.pyi | 179 +++--------- fireblocks_client/paths/vault_assets/get.py | 201 ++++--------- fireblocks_client/paths/vault_assets/get.pyi | 194 +++--------- .../paths/vault_assets_asset_id/get.py | 196 +++---------- .../paths/vault_assets_asset_id/get.pyi | 189 +++--------- .../paths/vault_public_key_info_/get.py | 204 ++++--------- .../paths/vault_public_key_info_/get.pyi | 197 +++---------- .../paths/webhooks_resend/post.py | 179 +++--------- .../paths/webhooks_resend/post.pyi | 172 +++-------- .../paths/webhooks_resend_tx_id/post.py | 259 ++++------------ .../paths/webhooks_resend_tx_id/post.pyi | 252 ++++------------ setup.py | 4 +- test/test_models/test_ncw.py | 26 ++ test/test_models/test_request_options.py | 26 ++ 287 files changed, 13408 insertions(+), 44906 deletions(-) create mode 100644 docs/models/Ncw.md create mode 100644 docs/models/RequestOptions.md create mode 100644 fireblocks_client/model/ncw.py create mode 100644 fireblocks_client/model/ncw.pyi create mode 100644 fireblocks_client/model/request_options.py create mode 100644 fireblocks_client/model/request_options.pyi create mode 100644 test/test_models/test_ncw.py create mode 100644 test/test_models/test_request_options.py diff --git a/README.md b/README.md index d28aae0c..2ff49f89 100644 --- a/README.md +++ b/README.md @@ -277,6 +277,7 @@ Class | Method | HTTP request | Description - [GetUsersResponse](docs/models/GetUsersResponse.md) - [InstructionAmount](docs/models/InstructionAmount.md) - [MediaEntityResponse](docs/models/MediaEntityResponse.md) + - [Ncw](docs/models/Ncw.md) - [NetworkChannel](docs/models/NetworkChannel.md) - [NetworkConnection](docs/models/NetworkConnection.md) - [NetworkConnectionResponse](docs/models/NetworkConnectionResponse.md) @@ -318,6 +319,7 @@ Class | Method | HTTP request | Description - [PublicKeyInformation](docs/models/PublicKeyInformation.md) - [PublishResult](docs/models/PublishResult.md) - [RemoveCollateralRequestBody](docs/models/RemoveCollateralRequestBody.md) + - [RequestOptions](docs/models/RequestOptions.md) - [ResendWebhooksResponse](docs/models/ResendWebhooksResponse.md) - [RespondToConnectionRequest](docs/models/RespondToConnectionRequest.md) - [RewardInfo](docs/models/RewardInfo.md) diff --git a/docs/models/ExternalWalletAsset.md b/docs/models/ExternalWalletAsset.md index 6a81d78a..fd022e5e 100644 --- a/docs/models/ExternalWalletAsset.md +++ b/docs/models/ExternalWalletAsset.md @@ -11,6 +11,8 @@ Key | Input Type | Accessed Type | Description | Notes **id** | str, | str, | | [optional] **status** | [**ConfigChangeRequestStatus**](ConfigChangeRequestStatus.md) | [**ConfigChangeRequestStatus**](ConfigChangeRequestStatus.md) | | [optional] **address** | str, | str, | | [optional] +**balance** | str, | str, | | [optional] +**lockedAmount** | str, | str, | | [optional] **tag** | str, | str, | | [optional] **activationTime** | str, | str, | | [optional] **[additionalInfo](#additionalInfo)** | list, tuple, | tuple, | | [optional] diff --git a/docs/models/Ncw.md b/docs/models/Ncw.md new file mode 100644 index 00000000..c3e69113 --- /dev/null +++ b/docs/models/Ncw.md @@ -0,0 +1,15 @@ +# fireblocks_client.model.ncw.Ncw + +## Model Type Info +Input Type | Accessed Type | Description | Notes +------------ | ------------- | ------------- | ------------- +dict, frozendict.frozendict, | frozendict.frozendict, | | + +### Dictionary Keys +Key | Input Type | Accessed Type | Description | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**walletId** | str, | str, | | [optional] +**any_string_name** | dict, frozendict.frozendict, str, date, datetime, int, float, bool, decimal.Decimal, None, list, tuple, bytes, io.FileIO, io.BufferedReader | frozendict.frozendict, str, BoolClass, decimal.Decimal, NoneClass, tuple, bytes, FileIO | any string name can be used but the value must be the correct type | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/docs/models/RequestOptions.md b/docs/models/RequestOptions.md new file mode 100644 index 00000000..24ca298f --- /dev/null +++ b/docs/models/RequestOptions.md @@ -0,0 +1,16 @@ +# fireblocks_client.model.request_options.RequestOptions + +## Model Type Info +Input Type | Accessed Type | Description | Notes +------------ | ------------- | ------------- | ------------- +dict, frozendict.frozendict, | frozendict.frozendict, | | + +### Dictionary Keys +Key | Input Type | Accessed Type | Description | Notes +------------ | ------------- | ------------- | ------------- | ------------- +**idempotencyKey** | str, | str, | | [optional] +**ncw** | [**Ncw**](Ncw.md) | [**Ncw**](Ncw.md) | | [optional] +**any_string_name** | dict, frozendict.frozendict, str, date, datetime, int, float, bool, decimal.Decimal, None, list, tuple, bytes, io.FileIO, io.BufferedReader | frozendict.frozendict, str, BoolClass, decimal.Decimal, NoneClass, tuple, bytes, FileIO | any string name can be used but the value must be the correct type | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/fireblocks_client/api_client.py b/fireblocks_client/api_client.py index 0a208e3e..49568bc3 100644 --- a/fireblocks_client/api_client.py +++ b/fireblocks_client/api_client.py @@ -1094,7 +1094,6 @@ def sign_jwt(self, path, body_json=""): path = path.replace("]", "%5D") if body_json is None: body_json = "".encode("utf-8") - print(body_json) token = { "uri": path, "nonce": nonce, @@ -1128,7 +1127,7 @@ def pool(self): def get_user_agent(self): """User agent for this API client""" version = setuptools.__version__ - user_agent = f"fireblocks-py/{version}" + user_agent = f"fireblocks-py-sdk/{version}" if not self.configuration.options.anonymous_platform: user_agent += f" ({os.name} {os.uname().release}; {platform.system()} {platform.version()}; {platform.machine()})" if self.configuration.options.user_agent: @@ -1169,8 +1168,6 @@ def __call_api( path += f"?{parsed_url.query}" url = self.configuration.base_path + resource_path used_headers = self.get_headers(path, body, headers) - print(used_headers) - print(path) # perform request and return response response = self.request( diff --git a/fireblocks_client/model/external_wallet_asset.py b/fireblocks_client/model/external_wallet_asset.py index 41e32fba..d4dc8a54 100644 --- a/fireblocks_client/model/external_wallet_asset.py +++ b/fireblocks_client/model/external_wallet_asset.py @@ -43,6 +43,8 @@ class properties: def status() -> typing.Type['ConfigChangeRequestStatus']: return ConfigChangeRequestStatus address = schemas.StrSchema + balance = schemas.StrSchema + lockedAmount = schemas.StrSchema tag = schemas.StrSchema activationTime = schemas.StrSchema @@ -75,6 +77,8 @@ def __getitem__(self, i: int) -> 'WalletAssetAdditionalInfo': "id": id, "status": status, "address": address, + "balance": balance, + "lockedAmount": lockedAmount, "tag": tag, "activationTime": activationTime, "additionalInfo": additionalInfo, @@ -89,6 +93,12 @@ def __getitem__(self, name: typing_extensions.Literal["status"]) -> 'ConfigChang @typing.overload def __getitem__(self, name: typing_extensions.Literal["address"]) -> MetaOapg.properties.address: ... + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["balance"]) -> MetaOapg.properties.balance: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["lockedAmount"]) -> MetaOapg.properties.lockedAmount: ... + @typing.overload def __getitem__(self, name: typing_extensions.Literal["tag"]) -> MetaOapg.properties.tag: ... @@ -101,7 +111,7 @@ def __getitem__(self, name: typing_extensions.Literal["additionalInfo"]) -> Meta @typing.overload def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - def __getitem__(self, name: typing.Union[typing_extensions.Literal["id", "status", "address", "tag", "activationTime", "additionalInfo", ], str]): + def __getitem__(self, name: typing.Union[typing_extensions.Literal["id", "status", "address", "balance", "lockedAmount", "tag", "activationTime", "additionalInfo", ], str]): # dict_instance[name] accessor return super().__getitem__(name) @@ -115,6 +125,12 @@ def get_item_oapg(self, name: typing_extensions.Literal["status"]) -> typing.Uni @typing.overload def get_item_oapg(self, name: typing_extensions.Literal["address"]) -> typing.Union[MetaOapg.properties.address, schemas.Unset]: ... + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["balance"]) -> typing.Union[MetaOapg.properties.balance, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["lockedAmount"]) -> typing.Union[MetaOapg.properties.lockedAmount, schemas.Unset]: ... + @typing.overload def get_item_oapg(self, name: typing_extensions.Literal["tag"]) -> typing.Union[MetaOapg.properties.tag, schemas.Unset]: ... @@ -127,7 +143,7 @@ def get_item_oapg(self, name: typing_extensions.Literal["additionalInfo"]) -> ty @typing.overload def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["id", "status", "address", "tag", "activationTime", "additionalInfo", ], str]): + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["id", "status", "address", "balance", "lockedAmount", "tag", "activationTime", "additionalInfo", ], str]): return super().get_item_oapg(name) @@ -137,6 +153,8 @@ def __new__( id: typing.Union[MetaOapg.properties.id, str, schemas.Unset] = schemas.unset, status: typing.Union['ConfigChangeRequestStatus', schemas.Unset] = schemas.unset, address: typing.Union[MetaOapg.properties.address, str, schemas.Unset] = schemas.unset, + balance: typing.Union[MetaOapg.properties.balance, str, schemas.Unset] = schemas.unset, + lockedAmount: typing.Union[MetaOapg.properties.lockedAmount, str, schemas.Unset] = schemas.unset, tag: typing.Union[MetaOapg.properties.tag, str, schemas.Unset] = schemas.unset, activationTime: typing.Union[MetaOapg.properties.activationTime, str, schemas.Unset] = schemas.unset, additionalInfo: typing.Union[MetaOapg.properties.additionalInfo, list, tuple, schemas.Unset] = schemas.unset, @@ -149,6 +167,8 @@ def __new__( id=id, status=status, address=address, + balance=balance, + lockedAmount=lockedAmount, tag=tag, activationTime=activationTime, additionalInfo=additionalInfo, diff --git a/fireblocks_client/model/external_wallet_asset.pyi b/fireblocks_client/model/external_wallet_asset.pyi index 41e32fba..d4dc8a54 100644 --- a/fireblocks_client/model/external_wallet_asset.pyi +++ b/fireblocks_client/model/external_wallet_asset.pyi @@ -43,6 +43,8 @@ class ExternalWalletAsset( def status() -> typing.Type['ConfigChangeRequestStatus']: return ConfigChangeRequestStatus address = schemas.StrSchema + balance = schemas.StrSchema + lockedAmount = schemas.StrSchema tag = schemas.StrSchema activationTime = schemas.StrSchema @@ -75,6 +77,8 @@ class ExternalWalletAsset( "id": id, "status": status, "address": address, + "balance": balance, + "lockedAmount": lockedAmount, "tag": tag, "activationTime": activationTime, "additionalInfo": additionalInfo, @@ -89,6 +93,12 @@ class ExternalWalletAsset( @typing.overload def __getitem__(self, name: typing_extensions.Literal["address"]) -> MetaOapg.properties.address: ... + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["balance"]) -> MetaOapg.properties.balance: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["lockedAmount"]) -> MetaOapg.properties.lockedAmount: ... + @typing.overload def __getitem__(self, name: typing_extensions.Literal["tag"]) -> MetaOapg.properties.tag: ... @@ -101,7 +111,7 @@ class ExternalWalletAsset( @typing.overload def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... - def __getitem__(self, name: typing.Union[typing_extensions.Literal["id", "status", "address", "tag", "activationTime", "additionalInfo", ], str]): + def __getitem__(self, name: typing.Union[typing_extensions.Literal["id", "status", "address", "balance", "lockedAmount", "tag", "activationTime", "additionalInfo", ], str]): # dict_instance[name] accessor return super().__getitem__(name) @@ -115,6 +125,12 @@ class ExternalWalletAsset( @typing.overload def get_item_oapg(self, name: typing_extensions.Literal["address"]) -> typing.Union[MetaOapg.properties.address, schemas.Unset]: ... + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["balance"]) -> typing.Union[MetaOapg.properties.balance, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["lockedAmount"]) -> typing.Union[MetaOapg.properties.lockedAmount, schemas.Unset]: ... + @typing.overload def get_item_oapg(self, name: typing_extensions.Literal["tag"]) -> typing.Union[MetaOapg.properties.tag, schemas.Unset]: ... @@ -127,7 +143,7 @@ class ExternalWalletAsset( @typing.overload def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... - def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["id", "status", "address", "tag", "activationTime", "additionalInfo", ], str]): + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["id", "status", "address", "balance", "lockedAmount", "tag", "activationTime", "additionalInfo", ], str]): return super().get_item_oapg(name) @@ -137,6 +153,8 @@ class ExternalWalletAsset( id: typing.Union[MetaOapg.properties.id, str, schemas.Unset] = schemas.unset, status: typing.Union['ConfigChangeRequestStatus', schemas.Unset] = schemas.unset, address: typing.Union[MetaOapg.properties.address, str, schemas.Unset] = schemas.unset, + balance: typing.Union[MetaOapg.properties.balance, str, schemas.Unset] = schemas.unset, + lockedAmount: typing.Union[MetaOapg.properties.lockedAmount, str, schemas.Unset] = schemas.unset, tag: typing.Union[MetaOapg.properties.tag, str, schemas.Unset] = schemas.unset, activationTime: typing.Union[MetaOapg.properties.activationTime, str, schemas.Unset] = schemas.unset, additionalInfo: typing.Union[MetaOapg.properties.additionalInfo, list, tuple, schemas.Unset] = schemas.unset, @@ -149,6 +167,8 @@ class ExternalWalletAsset( id=id, status=status, address=address, + balance=balance, + lockedAmount=lockedAmount, tag=tag, activationTime=activationTime, additionalInfo=additionalInfo, diff --git a/fireblocks_client/model/ncw.py b/fireblocks_client/model/ncw.py new file mode 100644 index 00000000..5caa527e --- /dev/null +++ b/fireblocks_client/model/ncw.py @@ -0,0 +1,79 @@ +# coding: utf-8 + +""" + Fireblocks API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: 1.6.2 + Contact: support@fireblocks.com + Generated by: https://openapi-generator.tech +""" + +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from fireblocks_client import schemas # noqa: F401 + + +class Ncw( + schemas.DictSchema +): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + + class MetaOapg: + + class properties: + walletId = schemas.StrSchema + __annotations__ = { + "walletId": walletId, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["walletId"]) -> MetaOapg.properties.walletId: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["walletId", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["walletId"]) -> typing.Union[MetaOapg.properties.walletId, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... + + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["walletId", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *_args: typing.Union[dict, frozendict.frozendict, ], + walletId: typing.Union[MetaOapg.properties.walletId, str, schemas.Unset] = schemas.unset, + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'Ncw': + return super().__new__( + cls, + *_args, + walletId=walletId, + _configuration=_configuration, + **kwargs, + ) diff --git a/fireblocks_client/model/ncw.pyi b/fireblocks_client/model/ncw.pyi new file mode 100644 index 00000000..5caa527e --- /dev/null +++ b/fireblocks_client/model/ncw.pyi @@ -0,0 +1,79 @@ +# coding: utf-8 + +""" + Fireblocks API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: 1.6.2 + Contact: support@fireblocks.com + Generated by: https://openapi-generator.tech +""" + +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from fireblocks_client import schemas # noqa: F401 + + +class Ncw( + schemas.DictSchema +): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + + class MetaOapg: + + class properties: + walletId = schemas.StrSchema + __annotations__ = { + "walletId": walletId, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["walletId"]) -> MetaOapg.properties.walletId: ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["walletId", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["walletId"]) -> typing.Union[MetaOapg.properties.walletId, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... + + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["walletId", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *_args: typing.Union[dict, frozendict.frozendict, ], + walletId: typing.Union[MetaOapg.properties.walletId, str, schemas.Unset] = schemas.unset, + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'Ncw': + return super().__new__( + cls, + *_args, + walletId=walletId, + _configuration=_configuration, + **kwargs, + ) diff --git a/fireblocks_client/model/request_options.py b/fireblocks_client/model/request_options.py new file mode 100644 index 00000000..0a0e7a64 --- /dev/null +++ b/fireblocks_client/model/request_options.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +""" + Fireblocks API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: 1.6.2 + Contact: support@fireblocks.com + Generated by: https://openapi-generator.tech +""" + +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from fireblocks_client import schemas # noqa: F401 + + +class RequestOptions( + schemas.DictSchema +): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + + class MetaOapg: + + class properties: + idempotencyKey = schemas.StrSchema + + @staticmethod + def ncw() -> typing.Type['Ncw']: + return Ncw + __annotations__ = { + "idempotencyKey": idempotencyKey, + "ncw": ncw, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["idempotencyKey"]) -> MetaOapg.properties.idempotencyKey: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["ncw"]) -> 'Ncw': ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["idempotencyKey", "ncw", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["idempotencyKey"]) -> typing.Union[MetaOapg.properties.idempotencyKey, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["ncw"]) -> typing.Union['Ncw', schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... + + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["idempotencyKey", "ncw", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *_args: typing.Union[dict, frozendict.frozendict, ], + idempotencyKey: typing.Union[MetaOapg.properties.idempotencyKey, str, schemas.Unset] = schemas.unset, + ncw: typing.Union['Ncw', schemas.Unset] = schemas.unset, + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'RequestOptions': + return super().__new__( + cls, + *_args, + idempotencyKey=idempotencyKey, + ncw=ncw, + _configuration=_configuration, + **kwargs, + ) + +from fireblocks_client.model.ncw import Ncw diff --git a/fireblocks_client/model/request_options.pyi b/fireblocks_client/model/request_options.pyi new file mode 100644 index 00000000..0a0e7a64 --- /dev/null +++ b/fireblocks_client/model/request_options.pyi @@ -0,0 +1,94 @@ +# coding: utf-8 + +""" + Fireblocks API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: 1.6.2 + Contact: support@fireblocks.com + Generated by: https://openapi-generator.tech +""" + +from datetime import date, datetime # noqa: F401 +import decimal # noqa: F401 +import functools # noqa: F401 +import io # noqa: F401 +import re # noqa: F401 +import typing # noqa: F401 +import typing_extensions # noqa: F401 +import uuid # noqa: F401 + +import frozendict # noqa: F401 + +from fireblocks_client import schemas # noqa: F401 + + +class RequestOptions( + schemas.DictSchema +): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + + class MetaOapg: + + class properties: + idempotencyKey = schemas.StrSchema + + @staticmethod + def ncw() -> typing.Type['Ncw']: + return Ncw + __annotations__ = { + "idempotencyKey": idempotencyKey, + "ncw": ncw, + } + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["idempotencyKey"]) -> MetaOapg.properties.idempotencyKey: ... + + @typing.overload + def __getitem__(self, name: typing_extensions.Literal["ncw"]) -> 'Ncw': ... + + @typing.overload + def __getitem__(self, name: str) -> schemas.UnsetAnyTypeSchema: ... + + def __getitem__(self, name: typing.Union[typing_extensions.Literal["idempotencyKey", "ncw", ], str]): + # dict_instance[name] accessor + return super().__getitem__(name) + + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["idempotencyKey"]) -> typing.Union[MetaOapg.properties.idempotencyKey, schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: typing_extensions.Literal["ncw"]) -> typing.Union['Ncw', schemas.Unset]: ... + + @typing.overload + def get_item_oapg(self, name: str) -> typing.Union[schemas.UnsetAnyTypeSchema, schemas.Unset]: ... + + def get_item_oapg(self, name: typing.Union[typing_extensions.Literal["idempotencyKey", "ncw", ], str]): + return super().get_item_oapg(name) + + + def __new__( + cls, + *_args: typing.Union[dict, frozendict.frozendict, ], + idempotencyKey: typing.Union[MetaOapg.properties.idempotencyKey, str, schemas.Unset] = schemas.unset, + ncw: typing.Union['Ncw', schemas.Unset] = schemas.unset, + _configuration: typing.Optional[schemas.Configuration] = None, + **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes], + ) -> 'RequestOptions': + return super().__new__( + cls, + *_args, + idempotencyKey=idempotencyKey, + ncw=ncw, + _configuration=_configuration, + **kwargs, + ) + +from fireblocks_client.model.ncw import Ncw diff --git a/fireblocks_client/models/__init__.py b/fireblocks_client/models/__init__.py index af3c9c43..0a8ea444 100644 --- a/fireblocks_client/models/__init__.py +++ b/fireblocks_client/models/__init__.py @@ -63,6 +63,7 @@ from fireblocks_client.model.get_users_response import GetUsersResponse from fireblocks_client.model.instruction_amount import InstructionAmount from fireblocks_client.model.media_entity_response import MediaEntityResponse +from fireblocks_client.model.ncw import Ncw from fireblocks_client.model.network_channel import NetworkChannel from fireblocks_client.model.network_connection import NetworkConnection from fireblocks_client.model.network_connection_response import NetworkConnectionResponse @@ -104,6 +105,7 @@ from fireblocks_client.model.public_key_information import PublicKeyInformation from fireblocks_client.model.publish_result import PublishResult from fireblocks_client.model.remove_collateral_request_body import RemoveCollateralRequestBody +from fireblocks_client.model.request_options import RequestOptions from fireblocks_client.model.resend_webhooks_response import ResendWebhooksResponse from fireblocks_client.model.respond_to_connection_request import RespondToConnectionRequest from fireblocks_client.model.reward_info import RewardInfo diff --git a/fireblocks_client/paths/audits/get.py b/fireblocks_client/paths/audits/get.py index 07651be5..2579c82b 100644 --- a/fireblocks_client/paths/audits/get.py +++ b/fireblocks_client/paths/audits/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -76,9 +70,9 @@ class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams) ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor200 = typing_extensions.TypedDict( 'ResponseHeadersFor200', @@ -98,14 +92,14 @@ class ApiResponseFor200(api_client.ApiResponse): _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -120,124 +114,76 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_audits_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_audits_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_audits_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_audits_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_audits_oapg(self, params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): """ Get audit logs - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["time_period"] = params.get("time_period") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + used_path = path.value prefix_separator_iterator = None for parameter in ( - request_query_time_period, - ): + request_query_time_period, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -252,58 +198,8 @@ class instances class GetAudits(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_audits( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_audits( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_audits( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_audits( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_audits_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_audits(self ,params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): + return self._get_audits_oapg(params, request_options) class ApiForget(BaseApi): @@ -355,11 +251,11 @@ def get( skip_deserialization: bool = False, ): return self._get_audits_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/audits/get.pyi b/fireblocks_client/paths/audits/get.pyi index 08952e01..8c54af9b 100644 --- a/fireblocks_client/paths/audits/get.pyi +++ b/fireblocks_client/paths/audits/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error + # Query params @@ -84,9 +79,9 @@ class ApiResponseFor200(api_client.ApiResponse): _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -101,120 +96,72 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_audits_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_audits_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_audits_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_audits_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_audits_oapg(self, params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): """ Get audit logs - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["time_period"] = params.get("time_period") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + used_path = path.value prefix_separator_iterator = None for parameter in ( - request_query_time_period, - ): + request_query_time_period, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -229,58 +176,8 @@ class BaseApi(api_client.Api): class GetAudits(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_audits( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_audits( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_audits( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_audits( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_audits_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_audits(self ,params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): + return self._get_audits_oapg(params, request_options) class ApiForget(BaseApi): @@ -332,11 +229,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_audits_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/connections/get.py b/fireblocks_client/paths/connections/get.py index 9cb8e00e..62452a9a 100644 --- a/fireblocks_client/paths/connections/get.py +++ b/fireblocks_client/paths/connections/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -262,9 +256,9 @@ class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams) ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBodyApplicationJson = GetConnectionsResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -279,26 +273,26 @@ class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams) class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor400 = typing_extensions.TypedDict( 'ResponseHeadersFor400', @@ -318,14 +312,14 @@ class ApiResponseFor400(api_client.ApiResponse): _response_for_400 = api_client.OpenApiResponse( response_cls=ApiResponseFor400, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor500 = typing_extensions.TypedDict( 'ResponseHeadersFor500', @@ -345,9 +339,9 @@ class ApiResponseFor500(api_client.ApiResponse): _response_for_500 = api_client.OpenApiResponse( response_cls=ApiResponseFor500, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, '400': _response_for_400, @@ -355,101 +349,59 @@ class ApiResponseFor500(api_client.ApiResponse): } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - @typing.overload - def _get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_oapg(self, params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): """ List all open Web3 connections. - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["order"] = params.get("order") + query_params["filter"] = params.get("filter") + query_params["sort"] = params.get("sort") + query_params["page_size"] = params.get("page_size") + query_params["next"] = params.get("next") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + used_path = path.value prefix_separator_iterator = None for parameter in ( - request_query_order, - request_query_filter, - request_query_sort, - request_query_page_size, - request_query_next, - ): + request_query_order, + request_query_filter, + request_query_sort, + request_query_page_size, + request_query_next, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -464,56 +416,8 @@ class instances class Get(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get(self ,params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): + return self._get_oapg(params, request_options) class ApiForget(BaseApi): @@ -563,11 +467,11 @@ def get( skip_deserialization: bool = False, ): return self._get_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/connections/get.pyi b/fireblocks_client/paths/connections/get.pyi index f24d136c..d1475b82 100644 --- a/fireblocks_client/paths/connections/get.pyi +++ b/fireblocks_client/paths/connections/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.get_connections_response import GetConnectionsResponse + # Query params @@ -250,21 +245,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema ResponseHeadersFor400 = typing_extensions.TypedDict( 'ResponseHeadersFor400', @@ -284,9 +279,9 @@ class ApiResponseFor400(api_client.ApiResponse): _response_for_400 = api_client.OpenApiResponse( response_cls=ApiResponseFor400, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema ResponseHeadersFor500 = typing_extensions.TypedDict( 'ResponseHeadersFor500', @@ -306,106 +301,64 @@ class ApiResponseFor500(api_client.ApiResponse): _response_for_500 = api_client.OpenApiResponse( response_cls=ApiResponseFor500, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _get_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_oapg(self, params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): """ List all open Web3 connections. - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["order"] = params.get("order") + query_params["filter"] = params.get("filter") + query_params["sort"] = params.get("sort") + query_params["page_size"] = params.get("page_size") + query_params["next"] = params.get("next") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + used_path = path.value prefix_separator_iterator = None for parameter in ( - request_query_order, - request_query_filter, - request_query_sort, - request_query_page_size, - request_query_next, - ): + request_query_order, + request_query_filter, + request_query_sort, + request_query_page_size, + request_query_next, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -420,56 +373,8 @@ class BaseApi(api_client.Api): class Get(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get(self ,params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): + return self._get_oapg(params, request_options) class ApiForget(BaseApi): @@ -519,11 +424,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/connections_wc/post.py b/fireblocks_client/paths/connections_wc/post.py index 1db00ffc..0d255bd1 100644 --- a/fireblocks_client/paths/connections_wc/post.py +++ b/fireblocks_client/paths/connections_wc/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -32,20 +26,18 @@ # body param SchemaForRequestBodyApplicationJson = CreateConnectionRequest - - request_body_create_connection_request = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor201ResponseBodyApplicationJson = CreateConnectionResponse ResponseHeadersFor201 = typing_extensions.TypedDict( @@ -60,26 +52,26 @@ class ApiResponseFor201(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor201ResponseBodyApplicationJson, - ] + SchemaFor201ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor201 _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor201ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor201ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor400 = typing_extensions.TypedDict( 'ResponseHeadersFor400', @@ -99,14 +91,14 @@ class ApiResponseFor400(api_client.ApiResponse): _response_for_400 = api_client.OpenApiResponse( response_cls=ApiResponseFor400, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor500 = typing_extensions.TypedDict( 'ResponseHeadersFor500', @@ -126,9 +118,9 @@ class ApiResponseFor500(api_client.ApiResponse): _response_for_500 = api_client.OpenApiResponse( response_cls=ApiResponseFor500, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '201': _response_for_201, '400': _response_for_400, @@ -136,114 +128,49 @@ class ApiResponseFor500(api_client.ApiResponse): } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def _create_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def _create_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _create_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): """ Create a new Web3 connection. - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(create_connection_request, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_create_connection_request.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_create_connection_request.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -258,75 +185,8 @@ class instances class Create(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def create( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def create( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): + return self._create_oapg(params, request_options) class ApiForpost(BaseApi): @@ -394,12 +254,12 @@ def post( skip_deserialization: bool = False, ): return self._create_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/connections_wc/post.pyi b/fireblocks_client/paths/connections_wc/post.pyi index 31916466..36889eae 100644 --- a/fireblocks_client/paths/connections_wc/post.pyi +++ b/fireblocks_client/paths/connections_wc/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,15 +22,14 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.create_connection_request import CreateConnectionRequest from fireblocks_client.model.create_connection_response import CreateConnectionResponse + # body param SchemaForRequestBodyApplicationJson = CreateConnectionRequest - - request_body_create_connection_request = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema @@ -53,21 +46,21 @@ ResponseHeadersFor201 = typing_extensions.TypedDict( class ApiResponseFor201(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor201ResponseBodyApplicationJson, - ] + SchemaFor201ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor201 _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor201ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor201ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema ResponseHeadersFor400 = typing_extensions.TypedDict( 'ResponseHeadersFor400', @@ -87,9 +80,9 @@ class ApiResponseFor400(api_client.ApiResponse): _response_for_400 = api_client.OpenApiResponse( response_cls=ApiResponseFor400, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema ResponseHeadersFor500 = typing_extensions.TypedDict( 'ResponseHeadersFor500', @@ -109,119 +102,54 @@ class ApiResponseFor500(api_client.ApiResponse): _response_for_500 = api_client.OpenApiResponse( response_cls=ApiResponseFor500, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - @typing.overload - def _create_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def _create_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _create_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): """ Create a new Web3 connection. - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(create_connection_request, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_create_connection_request.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_create_connection_request.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -236,75 +164,8 @@ class BaseApi(api_client.Api): class Create(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - @typing.overload - def create( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ]: ... - - - @typing.overload - def create( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): + return self._create_oapg(params, request_options) class ApiForpost(BaseApi): @@ -372,12 +233,12 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._create_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/connections_wc_id/delete.py b/fireblocks_client/paths/connections_wc_id/delete.py index adbbd23b..a5917687 100644 --- a/fireblocks_client/paths/connections_wc_id/delete.py +++ b/fireblocks_client/paths/connections_wc_id/delete.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from fireblocks_client import api_client, exceptions @@ -54,9 +48,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor200 = typing_extensions.TypedDict( 'ResponseHeadersFor200', @@ -76,14 +70,14 @@ class ApiResponseFor200(api_client.ApiResponse): _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor404 = typing_extensions.TypedDict( 'ResponseHeadersFor404', @@ -103,14 +97,14 @@ class ApiResponseFor404(api_client.ApiResponse): _response_for_404 = api_client.OpenApiResponse( response_cls=ApiResponseFor404, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor500 = typing_extensions.TypedDict( 'ResponseHeadersFor500', @@ -130,9 +124,9 @@ class ApiResponseFor500(api_client.ApiResponse): _response_for_500 = api_client.OpenApiResponse( response_cls=ApiResponseFor500, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, '404': _response_for_404, @@ -141,52 +135,19 @@ class ApiResponseFor500(api_client.ApiResponse): class BaseApi(api_client.Api): - @typing.overload - def _remove_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _remove_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _remove_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _remove_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _remove_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Remove an existing Web3 connection. - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -201,23 +162,22 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - # TODO add cookie handling + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='delete'.upper(), - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -232,51 +192,8 @@ class instances class Remove(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def remove( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def remove( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def remove( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def remove( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._remove_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def remove(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._remove_oapg(params, request_options) class ApiFordelete(BaseApi): @@ -322,10 +239,10 @@ def delete( skip_deserialization: bool = False, ): return self._remove_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/connections_wc_id/delete.pyi b/fireblocks_client/paths/connections_wc_id/delete.pyi index f3de4a93..bb7bece6 100644 --- a/fireblocks_client/paths/connections_wc_id/delete.pyi +++ b/fireblocks_client/paths/connections_wc_id/delete.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from fireblocks_client import api_client, exceptions @@ -24,6 +18,7 @@ import frozendict # noqa: F401 from fireblocks_client import schemas # noqa: F401 + # Path params IdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -69,9 +64,9 @@ class ApiResponseFor200(api_client.ApiResponse): _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema ResponseHeadersFor404 = typing_extensions.TypedDict( 'ResponseHeadersFor404', @@ -91,9 +86,9 @@ class ApiResponseFor404(api_client.ApiResponse): _response_for_404 = api_client.OpenApiResponse( response_cls=ApiResponseFor404, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema ResponseHeadersFor500 = typing_extensions.TypedDict( 'ResponseHeadersFor500', @@ -113,58 +108,25 @@ class ApiResponseFor500(api_client.ApiResponse): _response_for_500 = api_client.OpenApiResponse( response_cls=ApiResponseFor500, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) class BaseApi(api_client.Api): - @typing.overload - def _remove_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _remove_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _remove_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _remove_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _remove_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Remove an existing Web3 connection. - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -179,23 +141,22 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - # TODO add cookie handling + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='delete'.upper(), - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -210,51 +171,8 @@ class BaseApi(api_client.Api): class Remove(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def remove( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def remove( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def remove( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def remove( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._remove_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def remove(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._remove_oapg(params, request_options) class ApiFordelete(BaseApi): @@ -300,10 +218,10 @@ class ApiFordelete(BaseApi): skip_deserialization: bool = False, ): return self._remove_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/connections_wc_id/put.py b/fireblocks_client/paths/connections_wc_id/put.py index e766ef29..343080a6 100644 --- a/fireblocks_client/paths/connections_wc_id/put.py +++ b/fireblocks_client/paths/connections_wc_id/put.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -57,20 +51,18 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) # body param SchemaForRequestBodyApplicationJson = RespondToConnectionRequest - - request_body_respond_to_connection_request = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor200 = typing_extensions.TypedDict( 'ResponseHeadersFor200', @@ -90,14 +82,14 @@ class ApiResponseFor200(api_client.ApiResponse): _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor400 = typing_extensions.TypedDict( 'ResponseHeadersFor400', @@ -117,14 +109,14 @@ class ApiResponseFor400(api_client.ApiResponse): _response_for_400 = api_client.OpenApiResponse( response_cls=ApiResponseFor400, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor404 = typing_extensions.TypedDict( 'ResponseHeadersFor404', @@ -144,14 +136,14 @@ class ApiResponseFor404(api_client.ApiResponse): _response_for_404 = api_client.OpenApiResponse( response_cls=ApiResponseFor404, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor500 = typing_extensions.TypedDict( 'ResponseHeadersFor500', @@ -171,9 +163,9 @@ class ApiResponseFor500(api_client.ApiResponse): _response_for_500 = api_client.OpenApiResponse( response_cls=ApiResponseFor500, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, '400': _response_for_400, @@ -183,74 +175,19 @@ class ApiResponseFor500(api_client.ApiResponse): class BaseApi(api_client.Api): - @typing.overload - def _submit_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _submit_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _submit_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _submit_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _submit_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _submit_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): """ Respond to a pending Web3 connection request. - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -265,39 +202,38 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling + body = params.get(respond_to_connection_request, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_respond_to_connection_request.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_respond_to_connection_request.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='put'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -312,75 +248,8 @@ class instances class Submit(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def submit( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def submit( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def submit( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def submit( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def submit( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._submit_oapg( - body=body, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def submit(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): + return self._submit_oapg(params, request_options) class ApiForput(BaseApi): @@ -448,12 +317,12 @@ def put( skip_deserialization: bool = False, ): return self._submit_oapg( - body=body, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/connections_wc_id/put.pyi b/fireblocks_client/paths/connections_wc_id/put.pyi index cdf1b685..b4358ce8 100644 --- a/fireblocks_client/paths/connections_wc_id/put.pyi +++ b/fireblocks_client/paths/connections_wc_id/put.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.respond_to_connection_request import RespondToConnectionRequest + # Path params IdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -55,13 +50,11 @@ request_path_id = api_client.PathParameter( ) # body param SchemaForRequestBodyApplicationJson = RespondToConnectionRequest - - request_body_respond_to_connection_request = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema @@ -83,9 +76,9 @@ class ApiResponseFor200(api_client.ApiResponse): _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema ResponseHeadersFor400 = typing_extensions.TypedDict( 'ResponseHeadersFor400', @@ -105,9 +98,9 @@ class ApiResponseFor400(api_client.ApiResponse): _response_for_400 = api_client.OpenApiResponse( response_cls=ApiResponseFor400, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema ResponseHeadersFor404 = typing_extensions.TypedDict( 'ResponseHeadersFor404', @@ -127,9 +120,9 @@ class ApiResponseFor404(api_client.ApiResponse): _response_for_404 = api_client.OpenApiResponse( response_cls=ApiResponseFor404, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema ResponseHeadersFor500 = typing_extensions.TypedDict( 'ResponseHeadersFor500', @@ -149,80 +142,25 @@ class ApiResponseFor500(api_client.ApiResponse): _response_for_500 = api_client.OpenApiResponse( response_cls=ApiResponseFor500, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) class BaseApi(api_client.Api): - @typing.overload - def _submit_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _submit_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _submit_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _submit_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _submit_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _submit_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): """ Respond to a pending Web3 connection request. - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -237,39 +175,38 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling + body = params.get(respond_to_connection_request, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_respond_to_connection_request.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_respond_to_connection_request.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='put'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -284,75 +221,8 @@ class BaseApi(api_client.Api): class Submit(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def submit( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def submit( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def submit( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def submit( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def submit( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._submit_oapg( - body=body, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def submit(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): + return self._submit_oapg(params, request_options) class ApiForput(BaseApi): @@ -420,12 +290,12 @@ class ApiForput(BaseApi): skip_deserialization: bool = False, ): return self._submit_oapg( - body=body, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/contracts/get.py b/fireblocks_client/paths/contracts/get.py index 0f66bff9..98f05acb 100644 --- a/fireblocks_client/paths/contracts/get.py +++ b/fireblocks_client/paths/contracts/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -32,9 +26,9 @@ XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) @@ -74,26 +68,26 @@ def __getitem__(self, i: int) -> 'UnmanagedWallet': class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -108,21 +102,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -130,85 +124,39 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_contracts_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_contracts_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_contracts_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_contracts_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_contracts_oapg(self, request_options: RequestOptions = None): """ List contracts - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -223,53 +171,8 @@ class instances class GetContracts(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_contracts( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_contracts( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_contracts( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_contracts( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_contracts_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_contracts(self , request_options: RequestOptions = None): + return self._get_contracts_oapg(request_options) class ApiForget(BaseApi): @@ -317,10 +220,10 @@ def get( skip_deserialization: bool = False, ): return self._get_contracts_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/contracts/get.pyi b/fireblocks_client/paths/contracts/get.pyi index bd8fc9be..3b24f10e 100644 --- a/fireblocks_client/paths/contracts/get.pyi +++ b/fireblocks_client/paths/contracts/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.unmanaged_wallet import UnmanagedWallet from fireblocks_client.model.error import Error + XRequestIDSchema = schemas.StrSchema @@ -67,21 +62,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -96,103 +91,57 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_contracts_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_contracts_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_contracts_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_contracts_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_contracts_oapg(self, request_options: RequestOptions = None): """ List contracts - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -207,53 +156,8 @@ class BaseApi(api_client.Api): class GetContracts(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_contracts( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_contracts( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_contracts( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_contracts( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_contracts_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_contracts(self , request_options: RequestOptions = None): + return self._get_contracts_oapg(request_options) class ApiForget(BaseApi): @@ -301,10 +205,10 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_contracts_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/contracts/post.py b/fireblocks_client/paths/contracts/post.py index 20cc2ef8..360a9fa3 100644 --- a/fireblocks_client/paths/contracts/post.py +++ b/fireblocks_client/paths/contracts/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -82,19 +76,17 @@ def __new__( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = UnmanagedWallet ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -109,26 +101,26 @@ def __new__( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -143,21 +135,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -165,119 +157,49 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_contract_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _create_contract_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _create_contract_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_contract_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _create_contract_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_contract_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): """ Create a contract - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -292,78 +214,8 @@ class instances class CreateContract(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create_contract( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def create_contract( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def create_contract( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_contract( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_contract( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_contract_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create_contract(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): + return self._create_contract_oapg(params, request_options) class ApiForpost(BaseApi): @@ -434,12 +286,12 @@ def post( skip_deserialization: bool = False, ): return self._create_contract_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/contracts/post.pyi b/fireblocks_client/paths/contracts/post.pyi index cace6781..98d4a1a2 100644 --- a/fireblocks_client/paths/contracts/post.pyi +++ b/fireblocks_client/paths/contracts/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.unmanaged_wallet import UnmanagedWallet from fireblocks_client.model.error import Error + # body param @@ -80,13 +75,11 @@ class SchemaForRequestBodyApplicationJson( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema SchemaFor200ResponseBody = UnmanagedWallet @@ -102,21 +95,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -131,137 +124,67 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_contract_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _create_contract_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _create_contract_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_contract_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _create_contract_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_contract_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): """ Create a contract - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -276,78 +199,8 @@ class BaseApi(api_client.Api): class CreateContract(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create_contract( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def create_contract( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def create_contract( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_contract( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_contract( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_contract_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create_contract(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): + return self._create_contract_oapg(params, request_options) class ApiForpost(BaseApi): @@ -418,12 +271,12 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._create_contract_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/contracts_contract_id/delete.py b/fireblocks_client/paths/contracts_contract_id/delete.py index b9c7d3c5..886def62 100644 --- a/fireblocks_client/paths/contracts_contract_id/delete.py +++ b/fireblocks_client/paths/contracts_contract_id/delete.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -57,9 +51,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor201 = typing_extensions.TypedDict( 'ResponseHeadersFor201', @@ -79,14 +73,14 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -101,83 +95,44 @@ class ApiResponseFor201(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '201': _response_for_201, 'default': _response_for_default, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _delete_contract_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _delete_contract_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _delete_contract_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _delete_contract_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _delete_contract_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Delete a contract - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_contract_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -192,33 +147,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='delete'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -233,58 +183,8 @@ class instances class DeleteContract(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def delete_contract( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def delete_contract( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete_contract( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete_contract( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_contract_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def delete_contract(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._delete_contract_oapg(params, request_options) class ApiFordelete(BaseApi): @@ -336,11 +236,11 @@ def delete( skip_deserialization: bool = False, ): return self._delete_contract_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/contracts_contract_id/delete.pyi b/fireblocks_client/paths/contracts_contract_id/delete.pyi index a64e9388..d258da2f 100644 --- a/fireblocks_client/paths/contracts_contract_id/delete.pyi +++ b/fireblocks_client/paths/contracts_contract_id/delete.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error + # Path params ContractIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -72,9 +67,9 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -89,79 +84,40 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _delete_contract_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _delete_contract_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _delete_contract_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _delete_contract_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _delete_contract_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Delete a contract - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_contract_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -176,33 +132,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='delete'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -217,58 +168,8 @@ class BaseApi(api_client.Api): class DeleteContract(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def delete_contract( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def delete_contract( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete_contract( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete_contract( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_contract_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def delete_contract(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._delete_contract_oapg(params, request_options) class ApiFordelete(BaseApi): @@ -320,11 +221,11 @@ class ApiFordelete(BaseApi): skip_deserialization: bool = False, ): return self._delete_contract_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/contracts_contract_id/get.py b/fireblocks_client/paths/contracts_contract_id/get.py index ca91fe32..1c723ce1 100644 --- a/fireblocks_client/paths/contracts_contract_id/get.py +++ b/fireblocks_client/paths/contracts_contract_id/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -58,9 +52,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = UnmanagedWallet ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -75,26 +69,26 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -109,21 +103,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -131,62 +125,23 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_contract_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_contract_by_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_contract_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_contract_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_contract_by_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Find a specific contract - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_contract_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -201,33 +156,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -242,58 +192,8 @@ class instances class GetContractById(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_contract_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_contract_by_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_contract_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_contract_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_contract_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_contract_by_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_contract_by_id_oapg(params, request_options) class ApiForget(BaseApi): @@ -345,11 +245,11 @@ def get( skip_deserialization: bool = False, ): return self._get_contract_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/contracts_contract_id/get.pyi b/fireblocks_client/paths/contracts_contract_id/get.pyi index 3a01fde0..852d1a0b 100644 --- a/fireblocks_client/paths/contracts_contract_id/get.pyi +++ b/fireblocks_client/paths/contracts_contract_id/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.unmanaged_wallet import UnmanagedWallet from fireblocks_client.model.error import Error + # Path params ContractIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -68,21 +63,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -97,80 +92,41 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_contract_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_contract_by_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_contract_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_contract_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_contract_by_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Find a specific contract - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_contract_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -185,33 +141,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -226,58 +177,8 @@ class BaseApi(api_client.Api): class GetContractById(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_contract_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_contract_by_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_contract_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_contract_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_contract_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_contract_by_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_contract_by_id_oapg(params, request_options) class ApiForget(BaseApi): @@ -329,11 +230,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_contract_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/contracts_contract_id_asset_id/delete.py b/fireblocks_client/paths/contracts_contract_id_asset_id/delete.py index 1f3ad53d..4e452fd0 100644 --- a/fireblocks_client/paths/contracts_contract_id_asset_id/delete.py +++ b/fireblocks_client/paths/contracts_contract_id_asset_id/delete.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -65,9 +59,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor201 = typing_extensions.TypedDict( 'ResponseHeadersFor201', @@ -87,14 +81,14 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -109,83 +103,45 @@ class ApiResponseFor201(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '201': _response_for_201, 'default': _response_for_default, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _remove_asset_from_contract_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _remove_asset_from_contract_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _remove_asset_from_contract_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _remove_asset_from_contract_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _remove_asset_from_contract_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Delete a contract asset - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_contract_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -201,33 +157,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='delete'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -242,58 +193,8 @@ class instances class RemoveAssetFromContract(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def remove_asset_from_contract( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def remove_asset_from_contract( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def remove_asset_from_contract( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def remove_asset_from_contract( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._remove_asset_from_contract_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def remove_asset_from_contract(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._remove_asset_from_contract_oapg(params, request_options) class ApiFordelete(BaseApi): @@ -345,11 +246,11 @@ def delete( skip_deserialization: bool = False, ): return self._remove_asset_from_contract_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/contracts_contract_id_asset_id/delete.pyi b/fireblocks_client/paths/contracts_contract_id_asset_id/delete.pyi index 45d63b83..42037348 100644 --- a/fireblocks_client/paths/contracts_contract_id_asset_id/delete.pyi +++ b/fireblocks_client/paths/contracts_contract_id_asset_id/delete.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error + # Path params ContractIdSchema = schemas.StrSchema AssetIdSchema = schemas.StrSchema @@ -80,9 +75,9 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -97,79 +92,41 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _remove_asset_from_contract_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - @typing.overload - def _remove_asset_from_contract_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _remove_asset_from_contract_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _remove_asset_from_contract_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _remove_asset_from_contract_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Delete a contract asset - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_contract_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -185,33 +142,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='delete'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -226,58 +178,8 @@ class BaseApi(api_client.Api): class RemoveAssetFromContract(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def remove_asset_from_contract( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def remove_asset_from_contract( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def remove_asset_from_contract( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def remove_asset_from_contract( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._remove_asset_from_contract_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def remove_asset_from_contract(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._remove_asset_from_contract_oapg(params, request_options) class ApiFordelete(BaseApi): @@ -329,11 +231,11 @@ class ApiFordelete(BaseApi): skip_deserialization: bool = False, ): return self._remove_asset_from_contract_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/contracts_contract_id_asset_id/get.py b/fireblocks_client/paths/contracts_contract_id_asset_id/get.py index 473025c7..6be73436 100644 --- a/fireblocks_client/paths/contracts_contract_id_asset_id/get.py +++ b/fireblocks_client/paths/contracts_contract_id_asset_id/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -66,9 +60,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = ExternalWalletAsset ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -83,26 +77,26 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -117,21 +111,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -139,62 +133,24 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_asset_in_contract_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_asset_in_contract_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_asset_in_contract_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_asset_in_contract_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_asset_in_contract_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Find a contract asset - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_contract_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -210,33 +166,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -251,58 +202,8 @@ class instances class GetAssetInContract(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_asset_in_contract( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_asset_in_contract( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_asset_in_contract( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_asset_in_contract( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_asset_in_contract_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_asset_in_contract(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_asset_in_contract_oapg(params, request_options) class ApiForget(BaseApi): @@ -354,11 +255,11 @@ def get( skip_deserialization: bool = False, ): return self._get_asset_in_contract_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/contracts_contract_id_asset_id/get.pyi b/fireblocks_client/paths/contracts_contract_id_asset_id/get.pyi index b7105f8a..4370d9d1 100644 --- a/fireblocks_client/paths/contracts_contract_id_asset_id/get.pyi +++ b/fireblocks_client/paths/contracts_contract_id_asset_id/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.external_wallet_asset import ExternalWalletAsset from fireblocks_client.model.error import Error + # Path params ContractIdSchema = schemas.StrSchema AssetIdSchema = schemas.StrSchema @@ -76,21 +71,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -105,80 +100,42 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_asset_in_contract_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _get_asset_in_contract_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_asset_in_contract_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_asset_in_contract_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_asset_in_contract_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Find a contract asset - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_contract_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -194,33 +151,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -235,58 +187,8 @@ class BaseApi(api_client.Api): class GetAssetInContract(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_asset_in_contract( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_asset_in_contract( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_asset_in_contract( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_asset_in_contract( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_asset_in_contract_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_asset_in_contract(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_asset_in_contract_oapg(params, request_options) class ApiForget(BaseApi): @@ -338,11 +240,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_asset_in_contract_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/contracts_contract_id_asset_id/post.py b/fireblocks_client/paths/contracts_contract_id_asset_id/post.py index 3e6a1de6..2947b1d1 100644 --- a/fireblocks_client/paths/contracts_contract_id_asset_id/post.py +++ b/fireblocks_client/paths/contracts_contract_id_asset_id/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -131,19 +125,17 @@ def __new__( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = ExternalWalletAsset ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -158,26 +150,26 @@ def __new__( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -192,21 +184,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -214,86 +206,24 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _add_asset_to_contract_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _add_asset_to_contract_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _add_asset_to_contract_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _add_asset_to_contract_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _add_asset_to_contract_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _add_asset_to_contract_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Add an asset to a contract - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_contract_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -309,44 +239,38 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -361,84 +285,8 @@ class instances class AddAssetToContract(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def add_asset_to_contract( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def add_asset_to_contract( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def add_asset_to_contract( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def add_asset_to_contract( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def add_asset_to_contract( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._add_asset_to_contract_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def add_asset_to_contract(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._add_asset_to_contract_oapg(params, request_options) class ApiForpost(BaseApi): @@ -514,13 +362,13 @@ def post( skip_deserialization: bool = False, ): return self._add_asset_to_contract_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/contracts_contract_id_asset_id/post.pyi b/fireblocks_client/paths/contracts_contract_id_asset_id/post.pyi index be811dec..f0184b7d 100644 --- a/fireblocks_client/paths/contracts_contract_id_asset_id/post.pyi +++ b/fireblocks_client/paths/contracts_contract_id_asset_id/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.external_wallet_asset import ExternalWalletAsset from fireblocks_client.model.error import Error + # Path params ContractIdSchema = schemas.StrSchema AssetIdSchema = schemas.StrSchema @@ -129,13 +124,11 @@ class SchemaForRequestBodyApplicationJson( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema SchemaFor200ResponseBody = ExternalWalletAsset @@ -151,21 +144,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -180,104 +173,42 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _add_asset_to_contract_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _add_asset_to_contract_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _add_asset_to_contract_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _add_asset_to_contract_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _add_asset_to_contract_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _add_asset_to_contract_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Add an asset to a contract - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_contract_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -293,44 +224,38 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -345,84 +270,8 @@ class BaseApi(api_client.Api): class AddAssetToContract(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def add_asset_to_contract( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def add_asset_to_contract( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def add_asset_to_contract( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def add_asset_to_contract( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def add_asset_to_contract( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._add_asset_to_contract_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def add_asset_to_contract(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._add_asset_to_contract_oapg(params, request_options) class ApiForpost(BaseApi): @@ -498,13 +347,13 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._add_asset_to_contract_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/estimate_network_fee/get.py b/fireblocks_client/paths/estimate_network_fee/get.py index 7a8f242d..471a674c 100644 --- a/fireblocks_client/paths/estimate_network_fee/get.py +++ b/fireblocks_client/paths/estimate_network_fee/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -59,9 +53,9 @@ class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams) ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = EstimatedNetworkFeeResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -76,26 +70,26 @@ class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams) class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -110,21 +104,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -132,103 +126,55 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _estimate_network_fee_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _estimate_network_fee_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _estimate_network_fee_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _estimate_network_fee_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _estimate_network_fee_oapg(self, params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): """ Estimate the required fee for an asset - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["asset_id"] = params.get("asset_id") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + used_path = path.value prefix_separator_iterator = None for parameter in ( - request_query_asset_id, - ): + request_query_asset_id, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -243,58 +189,8 @@ class instances class EstimateNetworkFee(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def estimate_network_fee( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def estimate_network_fee( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def estimate_network_fee( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def estimate_network_fee( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._estimate_network_fee_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def estimate_network_fee(self ,params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): + return self._estimate_network_fee_oapg(params, request_options) class ApiForget(BaseApi): @@ -346,11 +242,11 @@ def get( skip_deserialization: bool = False, ): return self._estimate_network_fee_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/estimate_network_fee/get.pyi b/fireblocks_client/paths/estimate_network_fee/get.pyi index bfe50266..a56a8ae0 100644 --- a/fireblocks_client/paths/estimate_network_fee/get.pyi +++ b/fireblocks_client/paths/estimate_network_fee/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.estimated_network_fee_response import EstimatedNetworkFeeResponse from fireblocks_client.model.error import Error + # Query params AssetIdSchema = schemas.StrSchema RequestRequiredQueryParams = typing_extensions.TypedDict( @@ -69,21 +64,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -98,121 +93,73 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _estimate_network_fee_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _estimate_network_fee_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _estimate_network_fee_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _estimate_network_fee_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _estimate_network_fee_oapg(self, params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): """ Estimate the required fee for an asset - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["asset_id"] = params.get("asset_id") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + used_path = path.value prefix_separator_iterator = None for parameter in ( - request_query_asset_id, - ): + request_query_asset_id, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -227,58 +174,8 @@ class BaseApi(api_client.Api): class EstimateNetworkFee(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def estimate_network_fee( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def estimate_network_fee( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def estimate_network_fee( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def estimate_network_fee( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._estimate_network_fee_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def estimate_network_fee(self ,params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): + return self._estimate_network_fee_oapg(params, request_options) class ApiForget(BaseApi): @@ -330,11 +227,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._estimate_network_fee_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/exchange_accounts/get.py b/fireblocks_client/paths/exchange_accounts/get.py index 010f630c..bc97955e 100644 --- a/fireblocks_client/paths/exchange_accounts/get.py +++ b/fireblocks_client/paths/exchange_accounts/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -32,9 +26,9 @@ XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) @@ -74,26 +68,26 @@ def __getitem__(self, i: int) -> 'ExchangeAccount': class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -108,21 +102,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -130,85 +124,39 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_exchange_accounts_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_exchange_accounts_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_exchange_accounts_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_exchange_accounts_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_exchange_accounts_oapg(self, request_options: RequestOptions = None): """ List exchange accounts - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -223,53 +171,8 @@ class instances class GetExchangeAccounts(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_exchange_accounts( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_exchange_accounts( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_exchange_accounts( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_exchange_accounts( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_exchange_accounts_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_exchange_accounts(self , request_options: RequestOptions = None): + return self._get_exchange_accounts_oapg(request_options) class ApiForget(BaseApi): @@ -317,10 +220,10 @@ def get( skip_deserialization: bool = False, ): return self._get_exchange_accounts_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/exchange_accounts/get.pyi b/fireblocks_client/paths/exchange_accounts/get.pyi index c73e388d..97958fac 100644 --- a/fireblocks_client/paths/exchange_accounts/get.pyi +++ b/fireblocks_client/paths/exchange_accounts/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.exchange_account import ExchangeAccount from fireblocks_client.model.error import Error + XRequestIDSchema = schemas.StrSchema @@ -67,21 +62,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -96,103 +91,57 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_exchange_accounts_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_exchange_accounts_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_exchange_accounts_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_exchange_accounts_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_exchange_accounts_oapg(self, request_options: RequestOptions = None): """ List exchange accounts - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -207,53 +156,8 @@ class BaseApi(api_client.Api): class GetExchangeAccounts(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_exchange_accounts( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_exchange_accounts( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_exchange_accounts( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_exchange_accounts( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_exchange_accounts_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_exchange_accounts(self , request_options: RequestOptions = None): + return self._get_exchange_accounts_oapg(request_options) class ApiForget(BaseApi): @@ -301,10 +205,10 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_exchange_accounts_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/exchange_accounts_exchange_account_id/get.py b/fireblocks_client/paths/exchange_accounts_exchange_account_id/get.py index 6d11d3ed..719a8cb9 100644 --- a/fireblocks_client/paths/exchange_accounts_exchange_account_id/get.py +++ b/fireblocks_client/paths/exchange_accounts_exchange_account_id/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -58,9 +52,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = ExchangeAccount ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -75,26 +69,26 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -109,21 +103,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -131,62 +125,23 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_exchange_account_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_exchange_account_by_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_exchange_account_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_exchange_account_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_exchange_account_by_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Find a specific exchange account - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_exchange_account_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -201,33 +156,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -242,58 +192,8 @@ class instances class GetExchangeAccountById(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_exchange_account_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_exchange_account_by_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_exchange_account_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_exchange_account_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_exchange_account_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_exchange_account_by_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_exchange_account_by_id_oapg(params, request_options) class ApiForget(BaseApi): @@ -345,11 +245,11 @@ def get( skip_deserialization: bool = False, ): return self._get_exchange_account_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/exchange_accounts_exchange_account_id/get.pyi b/fireblocks_client/paths/exchange_accounts_exchange_account_id/get.pyi index 733cddc2..8478aa59 100644 --- a/fireblocks_client/paths/exchange_accounts_exchange_account_id/get.pyi +++ b/fireblocks_client/paths/exchange_accounts_exchange_account_id/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.exchange_account import ExchangeAccount from fireblocks_client.model.error import Error + # Path params ExchangeAccountIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -68,21 +63,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -97,80 +92,41 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_exchange_account_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_exchange_account_by_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_exchange_account_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_exchange_account_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_exchange_account_by_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Find a specific exchange account - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_exchange_account_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -185,33 +141,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -226,58 +177,8 @@ class BaseApi(api_client.Api): class GetExchangeAccountById(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_exchange_account_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_exchange_account_by_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_exchange_account_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_exchange_account_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_exchange_account_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_exchange_account_by_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_exchange_account_by_id_oapg(params, request_options) class ApiForget(BaseApi): @@ -329,11 +230,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_exchange_account_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/exchange_accounts_exchange_account_id_asset_id/get.py b/fireblocks_client/paths/exchange_accounts_exchange_account_id_asset_id/get.py index a28896f6..a2d2f7f9 100644 --- a/fireblocks_client/paths/exchange_accounts_exchange_account_id_asset_id/get.py +++ b/fireblocks_client/paths/exchange_accounts_exchange_account_id_asset_id/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -66,9 +60,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = ExchangeAsset ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -83,26 +77,26 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -117,21 +111,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -139,62 +133,24 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_exchange_account_asset_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_exchange_account_asset_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_exchange_account_asset_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_exchange_account_asset_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_exchange_account_asset_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Find an asset for an exchange account - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_exchange_account_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -210,33 +166,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -251,58 +202,8 @@ class instances class GetExchangeAccountAsset(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_exchange_account_asset( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_exchange_account_asset( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_exchange_account_asset( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_exchange_account_asset( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_exchange_account_asset_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_exchange_account_asset(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_exchange_account_asset_oapg(params, request_options) class ApiForget(BaseApi): @@ -354,11 +255,11 @@ def get( skip_deserialization: bool = False, ): return self._get_exchange_account_asset_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/exchange_accounts_exchange_account_id_asset_id/get.pyi b/fireblocks_client/paths/exchange_accounts_exchange_account_id_asset_id/get.pyi index 7ce74919..607ba276 100644 --- a/fireblocks_client/paths/exchange_accounts_exchange_account_id_asset_id/get.pyi +++ b/fireblocks_client/paths/exchange_accounts_exchange_account_id_asset_id/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.exchange_asset import ExchangeAsset from fireblocks_client.model.error import Error + # Path params ExchangeAccountIdSchema = schemas.StrSchema AssetIdSchema = schemas.StrSchema @@ -76,21 +71,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -105,80 +100,42 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_exchange_account_asset_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _get_exchange_account_asset_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_exchange_account_asset_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_exchange_account_asset_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_exchange_account_asset_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Find an asset for an exchange account - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_exchange_account_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -194,33 +151,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -235,58 +187,8 @@ class BaseApi(api_client.Api): class GetExchangeAccountAsset(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_exchange_account_asset( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_exchange_account_asset( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_exchange_account_asset( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_exchange_account_asset( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_exchange_account_asset_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_exchange_account_asset(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_exchange_account_asset_oapg(params, request_options) class ApiForget(BaseApi): @@ -338,11 +240,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_exchange_account_asset_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/exchange_accounts_exchange_account_id_convert/post.py b/fireblocks_client/paths/exchange_accounts_exchange_account_id_convert/post.py index 2a69b23c..aa872ee3 100644 --- a/fireblocks_client/paths/exchange_accounts_exchange_account_id_convert/post.py +++ b/fireblocks_client/paths/exchange_accounts_exchange_account_id_convert/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -136,19 +130,17 @@ def __new__( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor200 = typing_extensions.TypedDict( 'ResponseHeadersFor200', @@ -168,14 +160,14 @@ class ApiResponseFor200(api_client.ApiResponse): _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -190,107 +182,44 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _convert_assets_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _convert_assets_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _convert_assets_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _convert_assets_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _convert_assets_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _convert_assets_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Convert exchange account funds from the source asset to the destination asset. Coinbase (USD to USDC, USDC to USD) and Bitso (MXN to USD) are supported conversions. - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_exchange_account_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -305,44 +234,38 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -357,84 +280,8 @@ class instances class ConvertAssets(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def convert_assets( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def convert_assets( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def convert_assets( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def convert_assets( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def convert_assets( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._convert_assets_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def convert_assets(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._convert_assets_oapg(params, request_options) class ApiForpost(BaseApi): @@ -510,13 +357,13 @@ def post( skip_deserialization: bool = False, ): return self._convert_assets_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/exchange_accounts_exchange_account_id_convert/post.pyi b/fireblocks_client/paths/exchange_accounts_exchange_account_id_convert/post.pyi index a15f533f..a466fe0a 100644 --- a/fireblocks_client/paths/exchange_accounts_exchange_account_id_convert/post.pyi +++ b/fireblocks_client/paths/exchange_accounts_exchange_account_id_convert/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error + # Path params ExchangeAccountIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -134,13 +129,11 @@ class SchemaForRequestBodyApplicationJson( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -161,9 +154,9 @@ class ApiResponseFor200(api_client.ApiResponse): _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -178,103 +171,40 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _convert_assets_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _convert_assets_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _convert_assets_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _convert_assets_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _convert_assets_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _convert_assets_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Convert exchange account funds from the source asset to the destination asset. Coinbase (USD to USDC, USDC to USD) and Bitso (MXN to USD) are supported conversions. - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_exchange_account_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -289,44 +219,38 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -341,84 +265,8 @@ class BaseApi(api_client.Api): class ConvertAssets(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def convert_assets( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def convert_assets( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def convert_assets( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def convert_assets( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def convert_assets( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._convert_assets_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def convert_assets(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._convert_assets_oapg(params, request_options) class ApiForpost(BaseApi): @@ -494,13 +342,13 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._convert_assets_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/exchange_accounts_exchange_account_id_internal_transfer/post.py b/fireblocks_client/paths/exchange_accounts_exchange_account_id_internal_transfer/post.py index 60729f96..2a6d51ea 100644 --- a/fireblocks_client/paths/exchange_accounts_exchange_account_id_internal_transfer/post.py +++ b/fireblocks_client/paths/exchange_accounts_exchange_account_id_internal_transfer/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -58,19 +52,17 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) # body param SchemaForRequestBodyApplicationJson = CreateInternalTransferRequest - - request_body_create_internal_transfer_request = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor201 = typing_extensions.TypedDict( 'ResponseHeadersFor201', @@ -90,14 +82,14 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -112,107 +104,44 @@ class ApiResponseFor201(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '201': _response_for_201, 'default': _response_for_default, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _internal_transfer_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - @typing.overload - def _internal_transfer_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _internal_transfer_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _internal_transfer_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _internal_transfer_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _internal_transfer_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): """ Internal tranfer for exchange accounts - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_exchange_account_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -227,44 +156,38 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_create_internal_transfer_request.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_create_internal_transfer_request.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -279,84 +202,8 @@ class instances class InternalTransfer(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def internal_transfer( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def internal_transfer( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def internal_transfer( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def internal_transfer( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def internal_transfer( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._internal_transfer_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def internal_transfer(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): + return self._internal_transfer_oapg(params, request_options) class ApiForpost(BaseApi): @@ -432,13 +279,13 @@ def post( skip_deserialization: bool = False, ): return self._internal_transfer_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/exchange_accounts_exchange_account_id_internal_transfer/post.pyi b/fireblocks_client/paths/exchange_accounts_exchange_account_id_internal_transfer/post.pyi index a181ab83..3e51526f 100644 --- a/fireblocks_client/paths/exchange_accounts_exchange_account_id_internal_transfer/post.pyi +++ b/fireblocks_client/paths/exchange_accounts_exchange_account_id_internal_transfer/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.create_internal_transfer_request import CreateInternalTransferRequest from fireblocks_client.model.error import Error + # Path params ExchangeAccountIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -56,13 +51,11 @@ request_path_exchange_account_id = api_client.PathParameter( ) # body param SchemaForRequestBodyApplicationJson = CreateInternalTransferRequest - - request_body_create_internal_transfer_request = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema ResponseHeadersFor201 = typing_extensions.TypedDict( @@ -83,9 +76,9 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -100,103 +93,40 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _internal_transfer_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - @typing.overload - def _internal_transfer_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _internal_transfer_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _internal_transfer_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _internal_transfer_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _internal_transfer_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): """ Internal tranfer for exchange accounts - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_exchange_account_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -211,44 +141,38 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_create_internal_transfer_request.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_create_internal_transfer_request.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -263,84 +187,8 @@ class BaseApi(api_client.Api): class InternalTransfer(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def internal_transfer( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def internal_transfer( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def internal_transfer( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def internal_transfer( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def internal_transfer( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._internal_transfer_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def internal_transfer(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): + return self._internal_transfer_oapg(params, request_options) class ApiForpost(BaseApi): @@ -416,13 +264,13 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._internal_transfer_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/external_wallets/get.py b/fireblocks_client/paths/external_wallets/get.py index 42818fe1..58f8cacf 100644 --- a/fireblocks_client/paths/external_wallets/get.py +++ b/fireblocks_client/paths/external_wallets/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -32,9 +26,9 @@ XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) @@ -74,26 +68,26 @@ def __getitem__(self, i: int) -> 'UnmanagedWallet': class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -108,21 +102,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -130,85 +124,39 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_external_wallets_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_external_wallets_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_external_wallets_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_external_wallets_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_external_wallets_oapg(self, request_options: RequestOptions = None): """ List external wallets - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -223,53 +171,8 @@ class instances class GetExternalWallets(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_external_wallets( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_external_wallets( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_external_wallets( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_external_wallets( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_external_wallets_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_external_wallets(self , request_options: RequestOptions = None): + return self._get_external_wallets_oapg(request_options) class ApiForget(BaseApi): @@ -317,10 +220,10 @@ def get( skip_deserialization: bool = False, ): return self._get_external_wallets_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/external_wallets/get.pyi b/fireblocks_client/paths/external_wallets/get.pyi index ea3c8f99..6d117af0 100644 --- a/fireblocks_client/paths/external_wallets/get.pyi +++ b/fireblocks_client/paths/external_wallets/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.unmanaged_wallet import UnmanagedWallet from fireblocks_client.model.error import Error + XRequestIDSchema = schemas.StrSchema @@ -67,21 +62,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -96,103 +91,57 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_external_wallets_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_external_wallets_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_external_wallets_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_external_wallets_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_external_wallets_oapg(self, request_options: RequestOptions = None): """ List external wallets - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -207,53 +156,8 @@ class BaseApi(api_client.Api): class GetExternalWallets(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_external_wallets( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_external_wallets( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_external_wallets( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_external_wallets( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_external_wallets_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_external_wallets(self , request_options: RequestOptions = None): + return self._get_external_wallets_oapg(request_options) class ApiForget(BaseApi): @@ -301,10 +205,10 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_external_wallets_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/external_wallets/post.py b/fireblocks_client/paths/external_wallets/post.py index 0540d062..1e0973e7 100644 --- a/fireblocks_client/paths/external_wallets/post.py +++ b/fireblocks_client/paths/external_wallets/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -92,19 +86,17 @@ def __new__( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = UnmanagedWallet ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -119,26 +111,26 @@ def __new__( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -153,21 +145,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -175,119 +167,49 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_external_wallet_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _create_external_wallet_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _create_external_wallet_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_external_wallet_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _create_external_wallet_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_external_wallet_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): """ Create an external wallet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -302,78 +224,8 @@ class instances class CreateExternalWallet(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create_external_wallet( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def create_external_wallet( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def create_external_wallet( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_external_wallet( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_external_wallet( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_external_wallet_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create_external_wallet(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): + return self._create_external_wallet_oapg(params, request_options) class ApiForpost(BaseApi): @@ -444,12 +296,12 @@ def post( skip_deserialization: bool = False, ): return self._create_external_wallet_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/external_wallets/post.pyi b/fireblocks_client/paths/external_wallets/post.pyi index bf56bbe3..4ea5e385 100644 --- a/fireblocks_client/paths/external_wallets/post.pyi +++ b/fireblocks_client/paths/external_wallets/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.unmanaged_wallet import UnmanagedWallet from fireblocks_client.model.error import Error + # body param @@ -90,13 +85,11 @@ class SchemaForRequestBodyApplicationJson( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema SchemaFor200ResponseBody = UnmanagedWallet @@ -112,21 +105,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -141,137 +134,67 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_external_wallet_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _create_external_wallet_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _create_external_wallet_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_external_wallet_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _create_external_wallet_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_external_wallet_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): """ Create an external wallet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -286,78 +209,8 @@ class BaseApi(api_client.Api): class CreateExternalWallet(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create_external_wallet( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def create_external_wallet( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def create_external_wallet( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_external_wallet( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_external_wallet( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_external_wallet_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create_external_wallet(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): + return self._create_external_wallet_oapg(params, request_options) class ApiForpost(BaseApi): @@ -428,12 +281,12 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._create_external_wallet_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/external_wallets_wallet_id/delete.py b/fireblocks_client/paths/external_wallets_wallet_id/delete.py index cda290c2..83a89ddb 100644 --- a/fireblocks_client/paths/external_wallets_wallet_id/delete.py +++ b/fireblocks_client/paths/external_wallets_wallet_id/delete.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -57,9 +51,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor201 = typing_extensions.TypedDict( 'ResponseHeadersFor201', @@ -79,14 +73,14 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -101,83 +95,44 @@ class ApiResponseFor201(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '201': _response_for_201, 'default': _response_for_default, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _delete_external_wallet_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _delete_external_wallet_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _delete_external_wallet_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _delete_external_wallet_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _delete_external_wallet_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Delete an external wallet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_wallet_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -192,33 +147,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='delete'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -233,58 +183,8 @@ class instances class DeleteExternalWallet(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def delete_external_wallet( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def delete_external_wallet( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete_external_wallet( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete_external_wallet( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_external_wallet_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def delete_external_wallet(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._delete_external_wallet_oapg(params, request_options) class ApiFordelete(BaseApi): @@ -336,11 +236,11 @@ def delete( skip_deserialization: bool = False, ): return self._delete_external_wallet_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/external_wallets_wallet_id/delete.pyi b/fireblocks_client/paths/external_wallets_wallet_id/delete.pyi index 88f928ec..faf92b62 100644 --- a/fireblocks_client/paths/external_wallets_wallet_id/delete.pyi +++ b/fireblocks_client/paths/external_wallets_wallet_id/delete.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error + # Path params WalletIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -72,9 +67,9 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -89,79 +84,40 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _delete_external_wallet_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _delete_external_wallet_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _delete_external_wallet_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _delete_external_wallet_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _delete_external_wallet_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Delete an external wallet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_wallet_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -176,33 +132,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='delete'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -217,58 +168,8 @@ class BaseApi(api_client.Api): class DeleteExternalWallet(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def delete_external_wallet( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def delete_external_wallet( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete_external_wallet( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete_external_wallet( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_external_wallet_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def delete_external_wallet(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._delete_external_wallet_oapg(params, request_options) class ApiFordelete(BaseApi): @@ -320,11 +221,11 @@ class ApiFordelete(BaseApi): skip_deserialization: bool = False, ): return self._delete_external_wallet_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/external_wallets_wallet_id/get.py b/fireblocks_client/paths/external_wallets_wallet_id/get.py index bcb9e341..f3e70409 100644 --- a/fireblocks_client/paths/external_wallets_wallet_id/get.py +++ b/fireblocks_client/paths/external_wallets_wallet_id/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -58,9 +52,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = UnmanagedWallet ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -75,26 +69,26 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -109,21 +103,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -131,62 +125,23 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_external_wallet_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_external_wallet_by_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_external_wallet_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_external_wallet_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_external_wallet_by_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Find an external wallet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_wallet_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -201,33 +156,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -242,58 +192,8 @@ class instances class GetExternalWalletById(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_external_wallet_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_external_wallet_by_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_external_wallet_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_external_wallet_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_external_wallet_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_external_wallet_by_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_external_wallet_by_id_oapg(params, request_options) class ApiForget(BaseApi): @@ -345,11 +245,11 @@ def get( skip_deserialization: bool = False, ): return self._get_external_wallet_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/external_wallets_wallet_id/get.pyi b/fireblocks_client/paths/external_wallets_wallet_id/get.pyi index 7acc55c9..b9f9def2 100644 --- a/fireblocks_client/paths/external_wallets_wallet_id/get.pyi +++ b/fireblocks_client/paths/external_wallets_wallet_id/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.unmanaged_wallet import UnmanagedWallet from fireblocks_client.model.error import Error + # Path params WalletIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -68,21 +63,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -97,80 +92,41 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_external_wallet_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_external_wallet_by_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_external_wallet_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_external_wallet_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_external_wallet_by_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Find an external wallet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_wallet_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -185,33 +141,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -226,58 +177,8 @@ class BaseApi(api_client.Api): class GetExternalWalletById(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_external_wallet_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_external_wallet_by_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_external_wallet_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_external_wallet_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_external_wallet_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_external_wallet_by_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_external_wallet_by_id_oapg(params, request_options) class ApiForget(BaseApi): @@ -329,11 +230,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_external_wallet_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/external_wallets_wallet_id_asset_id/delete.py b/fireblocks_client/paths/external_wallets_wallet_id_asset_id/delete.py index 4921d7e1..07cda8d7 100644 --- a/fireblocks_client/paths/external_wallets_wallet_id_asset_id/delete.py +++ b/fireblocks_client/paths/external_wallets_wallet_id_asset_id/delete.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -65,9 +59,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor201 = typing_extensions.TypedDict( 'ResponseHeadersFor201', @@ -87,14 +81,14 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -109,83 +103,45 @@ class ApiResponseFor201(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '201': _response_for_201, 'default': _response_for_default, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _remove_asset_from_external_wallet_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _remove_asset_from_external_wallet_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _remove_asset_from_external_wallet_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _remove_asset_from_external_wallet_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _remove_asset_from_external_wallet_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Delete an asset from an external wallet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_wallet_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -201,33 +157,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='delete'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -242,58 +193,8 @@ class instances class RemoveAssetFromExternalWallet(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def remove_asset_from_external_wallet( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def remove_asset_from_external_wallet( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def remove_asset_from_external_wallet( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def remove_asset_from_external_wallet( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._remove_asset_from_external_wallet_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def remove_asset_from_external_wallet(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._remove_asset_from_external_wallet_oapg(params, request_options) class ApiFordelete(BaseApi): @@ -345,11 +246,11 @@ def delete( skip_deserialization: bool = False, ): return self._remove_asset_from_external_wallet_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/external_wallets_wallet_id_asset_id/delete.pyi b/fireblocks_client/paths/external_wallets_wallet_id_asset_id/delete.pyi index c32abed4..4aac08e7 100644 --- a/fireblocks_client/paths/external_wallets_wallet_id_asset_id/delete.pyi +++ b/fireblocks_client/paths/external_wallets_wallet_id_asset_id/delete.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error + # Path params WalletIdSchema = schemas.StrSchema AssetIdSchema = schemas.StrSchema @@ -80,9 +75,9 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -97,79 +92,41 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _remove_asset_from_external_wallet_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - @typing.overload - def _remove_asset_from_external_wallet_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _remove_asset_from_external_wallet_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _remove_asset_from_external_wallet_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _remove_asset_from_external_wallet_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Delete an asset from an external wallet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_wallet_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -185,33 +142,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='delete'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -226,58 +178,8 @@ class BaseApi(api_client.Api): class RemoveAssetFromExternalWallet(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def remove_asset_from_external_wallet( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def remove_asset_from_external_wallet( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def remove_asset_from_external_wallet( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def remove_asset_from_external_wallet( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._remove_asset_from_external_wallet_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def remove_asset_from_external_wallet(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._remove_asset_from_external_wallet_oapg(params, request_options) class ApiFordelete(BaseApi): @@ -329,11 +231,11 @@ class ApiFordelete(BaseApi): skip_deserialization: bool = False, ): return self._remove_asset_from_external_wallet_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/external_wallets_wallet_id_asset_id/get.py b/fireblocks_client/paths/external_wallets_wallet_id_asset_id/get.py index c8f939a5..b5df5a58 100644 --- a/fireblocks_client/paths/external_wallets_wallet_id_asset_id/get.py +++ b/fireblocks_client/paths/external_wallets_wallet_id_asset_id/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -66,9 +60,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = ExternalWalletAsset ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -83,26 +77,26 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -117,21 +111,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -139,62 +133,24 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_asset_in_external_wallet_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_asset_in_external_wallet_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_asset_in_external_wallet_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_asset_in_external_wallet_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_asset_in_external_wallet_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Get an asset from an external wallet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_wallet_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -210,33 +166,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -251,58 +202,8 @@ class instances class GetAssetInExternalWallet(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_asset_in_external_wallet( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_asset_in_external_wallet( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_asset_in_external_wallet( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_asset_in_external_wallet( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_asset_in_external_wallet_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_asset_in_external_wallet(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_asset_in_external_wallet_oapg(params, request_options) class ApiForget(BaseApi): @@ -354,11 +255,11 @@ def get( skip_deserialization: bool = False, ): return self._get_asset_in_external_wallet_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/external_wallets_wallet_id_asset_id/get.pyi b/fireblocks_client/paths/external_wallets_wallet_id_asset_id/get.pyi index 17e35918..6a87038b 100644 --- a/fireblocks_client/paths/external_wallets_wallet_id_asset_id/get.pyi +++ b/fireblocks_client/paths/external_wallets_wallet_id_asset_id/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.external_wallet_asset import ExternalWalletAsset from fireblocks_client.model.error import Error + # Path params WalletIdSchema = schemas.StrSchema AssetIdSchema = schemas.StrSchema @@ -76,21 +71,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -105,80 +100,42 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_asset_in_external_wallet_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _get_asset_in_external_wallet_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_asset_in_external_wallet_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_asset_in_external_wallet_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_asset_in_external_wallet_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Get an asset from an external wallet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_wallet_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -194,33 +151,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -235,58 +187,8 @@ class BaseApi(api_client.Api): class GetAssetInExternalWallet(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_asset_in_external_wallet( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_asset_in_external_wallet( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_asset_in_external_wallet( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_asset_in_external_wallet( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_asset_in_external_wallet_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_asset_in_external_wallet(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_asset_in_external_wallet_oapg(params, request_options) class ApiForget(BaseApi): @@ -338,11 +240,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_asset_in_external_wallet_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/external_wallets_wallet_id_asset_id/post.py b/fireblocks_client/paths/external_wallets_wallet_id_asset_id/post.py index 0d15a5ee..d4ebbe49 100644 --- a/fireblocks_client/paths/external_wallets_wallet_id_asset_id/post.py +++ b/fireblocks_client/paths/external_wallets_wallet_id_asset_id/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -668,19 +662,17 @@ def __new__( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = ExternalWalletAsset ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -695,26 +687,26 @@ def __new__( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -729,21 +721,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -751,86 +743,24 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _add_asset_to_external_wallet_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _add_asset_to_external_wallet_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _add_asset_to_external_wallet_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _add_asset_to_external_wallet_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _add_asset_to_external_wallet_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _add_asset_to_external_wallet_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Add an asset to an external wallet. - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_wallet_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -846,44 +776,38 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -898,84 +822,8 @@ class instances class AddAssetToExternalWallet(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def add_asset_to_external_wallet( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def add_asset_to_external_wallet( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def add_asset_to_external_wallet( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def add_asset_to_external_wallet( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def add_asset_to_external_wallet( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._add_asset_to_external_wallet_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def add_asset_to_external_wallet(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._add_asset_to_external_wallet_oapg(params, request_options) class ApiForpost(BaseApi): @@ -1051,13 +899,13 @@ def post( skip_deserialization: bool = False, ): return self._add_asset_to_external_wallet_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/external_wallets_wallet_id_asset_id/post.pyi b/fireblocks_client/paths/external_wallets_wallet_id_asset_id/post.pyi index 630bfbff..ee194f9e 100644 --- a/fireblocks_client/paths/external_wallets_wallet_id_asset_id/post.pyi +++ b/fireblocks_client/paths/external_wallets_wallet_id_asset_id/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.external_wallet_asset import ExternalWalletAsset from fireblocks_client.model.error import Error + # Path params WalletIdSchema = schemas.StrSchema AssetIdSchema = schemas.StrSchema @@ -666,13 +661,11 @@ class SchemaForRequestBodyApplicationJson( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema SchemaFor200ResponseBody = ExternalWalletAsset @@ -688,21 +681,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -717,104 +710,42 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _add_asset_to_external_wallet_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _add_asset_to_external_wallet_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _add_asset_to_external_wallet_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _add_asset_to_external_wallet_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _add_asset_to_external_wallet_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _add_asset_to_external_wallet_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Add an asset to an external wallet. - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_wallet_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -830,44 +761,38 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -882,84 +807,8 @@ class BaseApi(api_client.Api): class AddAssetToExternalWallet(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def add_asset_to_external_wallet( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def add_asset_to_external_wallet( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def add_asset_to_external_wallet( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def add_asset_to_external_wallet( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def add_asset_to_external_wallet( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._add_asset_to_external_wallet_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def add_asset_to_external_wallet(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._add_asset_to_external_wallet_oapg(params, request_options) class ApiForpost(BaseApi): @@ -1035,13 +884,13 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._add_asset_to_external_wallet_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/external_wallets_wallet_id_set_customer_ref_id/post.py b/fireblocks_client/paths/external_wallets_wallet_id_set_customer_ref_id/post.py index 739999e6..ba1f85e0 100644 --- a/fireblocks_client/paths/external_wallets_wallet_id_set_customer_ref_id/post.py +++ b/fireblocks_client/paths/external_wallets_wallet_id_set_customer_ref_id/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -107,20 +101,18 @@ def __new__( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor201 = typing_extensions.TypedDict( 'ResponseHeadersFor201', @@ -140,14 +132,14 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -162,107 +154,44 @@ class ApiResponseFor201(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '201': _response_for_201, 'default': _response_for_default, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _set_customer_ref_id_for_external_wallet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - @typing.overload - def _set_customer_ref_id_for_external_wallet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _set_customer_ref_id_for_external_wallet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _set_customer_ref_id_for_external_wallet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _set_customer_ref_id_for_external_wallet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _set_customer_ref_id_for_external_wallet_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Set an AML customer reference ID for an external wallet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_wallet_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -277,46 +206,42 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(any_type, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -331,84 +256,8 @@ class instances class SetCustomerRefIdForExternalWallet(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def set_customer_ref_id_for_external_wallet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def set_customer_ref_id_for_external_wallet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def set_customer_ref_id_for_external_wallet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def set_customer_ref_id_for_external_wallet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def set_customer_ref_id_for_external_wallet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._set_customer_ref_id_for_external_wallet_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def set_customer_ref_id_for_external_wallet(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._set_customer_ref_id_for_external_wallet_oapg(params, request_options) class ApiForpost(BaseApi): @@ -484,13 +333,13 @@ def post( skip_deserialization: bool = False, ): return self._set_customer_ref_id_for_external_wallet_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/external_wallets_wallet_id_set_customer_ref_id/post.pyi b/fireblocks_client/paths/external_wallets_wallet_id_set_customer_ref_id/post.pyi index 8b616e8e..afdea86b 100644 --- a/fireblocks_client/paths/external_wallets_wallet_id_set_customer_ref_id/post.pyi +++ b/fireblocks_client/paths/external_wallets_wallet_id_set_customer_ref_id/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error + # Path params WalletIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -105,13 +100,11 @@ class SchemaForRequestBodyApplicationJson( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema @@ -133,9 +126,9 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -150,103 +143,40 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _set_customer_ref_id_for_external_wallet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - @typing.overload - def _set_customer_ref_id_for_external_wallet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _set_customer_ref_id_for_external_wallet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _set_customer_ref_id_for_external_wallet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _set_customer_ref_id_for_external_wallet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _set_customer_ref_id_for_external_wallet_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Set an AML customer reference ID for an external wallet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_wallet_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -261,46 +191,42 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(any_type, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -315,84 +241,8 @@ class BaseApi(api_client.Api): class SetCustomerRefIdForExternalWallet(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def set_customer_ref_id_for_external_wallet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def set_customer_ref_id_for_external_wallet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def set_customer_ref_id_for_external_wallet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def set_customer_ref_id_for_external_wallet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def set_customer_ref_id_for_external_wallet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._set_customer_ref_id_for_external_wallet_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def set_customer_ref_id_for_external_wallet(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._set_customer_ref_id_for_external_wallet_oapg(params, request_options) class ApiForpost(BaseApi): @@ -468,13 +318,13 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._set_customer_ref_id_for_external_wallet_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/fiat_accounts/get.py b/fireblocks_client/paths/fiat_accounts/get.py index 62d8ca9b..aa26dbd0 100644 --- a/fireblocks_client/paths/fiat_accounts/get.py +++ b/fireblocks_client/paths/fiat_accounts/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -32,9 +26,9 @@ XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) @@ -74,26 +68,26 @@ def __getitem__(self, i: int) -> 'FiatAccount': class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -108,21 +102,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -130,85 +124,39 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_fiat_accounts_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_fiat_accounts_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_fiat_accounts_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_fiat_accounts_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_fiat_accounts_oapg(self, request_options: RequestOptions = None): """ List fiat accounts - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -223,53 +171,8 @@ class instances class GetFiatAccounts(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_fiat_accounts( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_fiat_accounts( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_fiat_accounts( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_fiat_accounts( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_fiat_accounts_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_fiat_accounts(self , request_options: RequestOptions = None): + return self._get_fiat_accounts_oapg(request_options) class ApiForget(BaseApi): @@ -317,10 +220,10 @@ def get( skip_deserialization: bool = False, ): return self._get_fiat_accounts_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/fiat_accounts/get.pyi b/fireblocks_client/paths/fiat_accounts/get.pyi index 43494c5b..253a6f13 100644 --- a/fireblocks_client/paths/fiat_accounts/get.pyi +++ b/fireblocks_client/paths/fiat_accounts/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.fiat_account import FiatAccount from fireblocks_client.model.error import Error + XRequestIDSchema = schemas.StrSchema @@ -67,21 +62,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -96,103 +91,57 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_fiat_accounts_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_fiat_accounts_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_fiat_accounts_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_fiat_accounts_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_fiat_accounts_oapg(self, request_options: RequestOptions = None): """ List fiat accounts - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -207,53 +156,8 @@ class BaseApi(api_client.Api): class GetFiatAccounts(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_fiat_accounts( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_fiat_accounts( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_fiat_accounts( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_fiat_accounts( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_fiat_accounts_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_fiat_accounts(self , request_options: RequestOptions = None): + return self._get_fiat_accounts_oapg(request_options) class ApiForget(BaseApi): @@ -301,10 +205,10 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_fiat_accounts_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/fiat_accounts_account_id/get.py b/fireblocks_client/paths/fiat_accounts_account_id/get.py index aba37fcc..c1b32a9a 100644 --- a/fireblocks_client/paths/fiat_accounts_account_id/get.py +++ b/fireblocks_client/paths/fiat_accounts_account_id/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -58,9 +52,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = FiatAccount ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -75,26 +69,26 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -109,21 +103,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -131,62 +125,23 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_fiat_account_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_fiat_account_by_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_fiat_account_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_fiat_account_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_fiat_account_by_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Find a specific fiat account - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_account_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -201,33 +156,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -242,58 +192,8 @@ class instances class GetFiatAccountById(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_fiat_account_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_fiat_account_by_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_fiat_account_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_fiat_account_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_fiat_account_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_fiat_account_by_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_fiat_account_by_id_oapg(params, request_options) class ApiForget(BaseApi): @@ -345,11 +245,11 @@ def get( skip_deserialization: bool = False, ): return self._get_fiat_account_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/fiat_accounts_account_id/get.pyi b/fireblocks_client/paths/fiat_accounts_account_id/get.pyi index 35bf0a78..b5266ea0 100644 --- a/fireblocks_client/paths/fiat_accounts_account_id/get.pyi +++ b/fireblocks_client/paths/fiat_accounts_account_id/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.fiat_account import FiatAccount from fireblocks_client.model.error import Error + # Path params AccountIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -68,21 +63,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -97,80 +92,41 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_fiat_account_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_fiat_account_by_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_fiat_account_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_fiat_account_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_fiat_account_by_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Find a specific fiat account - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_account_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -185,33 +141,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -226,58 +177,8 @@ class BaseApi(api_client.Api): class GetFiatAccountById(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_fiat_account_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_fiat_account_by_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_fiat_account_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_fiat_account_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_fiat_account_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_fiat_account_by_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_fiat_account_by_id_oapg(params, request_options) class ApiForget(BaseApi): @@ -329,11 +230,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_fiat_account_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/fiat_accounts_account_id_deposit_from_linked_dda/post.py b/fireblocks_client/paths/fiat_accounts_account_id_deposit_from_linked_dda/post.py index 23dcc267..1547921c 100644 --- a/fireblocks_client/paths/fiat_accounts_account_id_deposit_from_linked_dda/post.py +++ b/fireblocks_client/paths/fiat_accounts_account_id_deposit_from_linked_dda/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -107,19 +101,17 @@ def __new__( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor201 = typing_extensions.TypedDict( 'ResponseHeadersFor201', @@ -139,14 +131,14 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -161,107 +153,44 @@ class ApiResponseFor201(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '201': _response_for_201, 'default': _response_for_default, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _deposit_funds_from_linked_dda_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - @typing.overload - def _deposit_funds_from_linked_dda_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _deposit_funds_from_linked_dda_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _deposit_funds_from_linked_dda_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _deposit_funds_from_linked_dda_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _deposit_funds_from_linked_dda_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Deposit funds from DDA - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_account_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -276,44 +205,38 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -328,84 +251,8 @@ class instances class DepositFundsFromLinkedDda(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def deposit_funds_from_linked_dda( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def deposit_funds_from_linked_dda( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def deposit_funds_from_linked_dda( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def deposit_funds_from_linked_dda( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def deposit_funds_from_linked_dda( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._deposit_funds_from_linked_dda_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def deposit_funds_from_linked_dda(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._deposit_funds_from_linked_dda_oapg(params, request_options) class ApiForpost(BaseApi): @@ -481,13 +328,13 @@ def post( skip_deserialization: bool = False, ): return self._deposit_funds_from_linked_dda_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/fiat_accounts_account_id_deposit_from_linked_dda/post.pyi b/fireblocks_client/paths/fiat_accounts_account_id_deposit_from_linked_dda/post.pyi index a0d8b7d5..c6c626dd 100644 --- a/fireblocks_client/paths/fiat_accounts_account_id_deposit_from_linked_dda/post.pyi +++ b/fireblocks_client/paths/fiat_accounts_account_id_deposit_from_linked_dda/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error + # Path params AccountIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -105,13 +100,11 @@ class SchemaForRequestBodyApplicationJson( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema ResponseHeadersFor201 = typing_extensions.TypedDict( @@ -132,9 +125,9 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -149,103 +142,40 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _deposit_funds_from_linked_dda_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - @typing.overload - def _deposit_funds_from_linked_dda_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _deposit_funds_from_linked_dda_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _deposit_funds_from_linked_dda_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _deposit_funds_from_linked_dda_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _deposit_funds_from_linked_dda_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Deposit funds from DDA - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_account_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -260,44 +190,38 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -312,84 +236,8 @@ class BaseApi(api_client.Api): class DepositFundsFromLinkedDda(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def deposit_funds_from_linked_dda( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def deposit_funds_from_linked_dda( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def deposit_funds_from_linked_dda( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def deposit_funds_from_linked_dda( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def deposit_funds_from_linked_dda( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._deposit_funds_from_linked_dda_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def deposit_funds_from_linked_dda(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._deposit_funds_from_linked_dda_oapg(params, request_options) class ApiForpost(BaseApi): @@ -465,13 +313,13 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._deposit_funds_from_linked_dda_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/fiat_accounts_account_id_redeem_to_linked_dda/post.py b/fireblocks_client/paths/fiat_accounts_account_id_redeem_to_linked_dda/post.py index 51b90048..c64bdbb7 100644 --- a/fireblocks_client/paths/fiat_accounts_account_id_redeem_to_linked_dda/post.py +++ b/fireblocks_client/paths/fiat_accounts_account_id_redeem_to_linked_dda/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -107,19 +101,17 @@ def __new__( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor201 = typing_extensions.TypedDict( 'ResponseHeadersFor201', @@ -139,14 +131,14 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -161,107 +153,44 @@ class ApiResponseFor201(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '201': _response_for_201, 'default': _response_for_default, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _redeem_funds_to_linked_dda_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - @typing.overload - def _redeem_funds_to_linked_dda_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _redeem_funds_to_linked_dda_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _redeem_funds_to_linked_dda_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _redeem_funds_to_linked_dda_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _redeem_funds_to_linked_dda_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Redeem funds to DDA - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_account_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -276,44 +205,38 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -328,84 +251,8 @@ class instances class RedeemFundsToLinkedDda(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def redeem_funds_to_linked_dda( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def redeem_funds_to_linked_dda( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def redeem_funds_to_linked_dda( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def redeem_funds_to_linked_dda( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def redeem_funds_to_linked_dda( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._redeem_funds_to_linked_dda_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def redeem_funds_to_linked_dda(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._redeem_funds_to_linked_dda_oapg(params, request_options) class ApiForpost(BaseApi): @@ -481,13 +328,13 @@ def post( skip_deserialization: bool = False, ): return self._redeem_funds_to_linked_dda_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/fiat_accounts_account_id_redeem_to_linked_dda/post.pyi b/fireblocks_client/paths/fiat_accounts_account_id_redeem_to_linked_dda/post.pyi index 5f20ae35..f19dec28 100644 --- a/fireblocks_client/paths/fiat_accounts_account_id_redeem_to_linked_dda/post.pyi +++ b/fireblocks_client/paths/fiat_accounts_account_id_redeem_to_linked_dda/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error + # Path params AccountIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -105,13 +100,11 @@ class SchemaForRequestBodyApplicationJson( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema ResponseHeadersFor201 = typing_extensions.TypedDict( @@ -132,9 +125,9 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -149,103 +142,40 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _redeem_funds_to_linked_dda_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - @typing.overload - def _redeem_funds_to_linked_dda_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _redeem_funds_to_linked_dda_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _redeem_funds_to_linked_dda_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _redeem_funds_to_linked_dda_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _redeem_funds_to_linked_dda_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Redeem funds to DDA - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_account_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -260,44 +190,38 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -312,84 +236,8 @@ class BaseApi(api_client.Api): class RedeemFundsToLinkedDda(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def redeem_funds_to_linked_dda( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def redeem_funds_to_linked_dda( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def redeem_funds_to_linked_dda( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def redeem_funds_to_linked_dda( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def redeem_funds_to_linked_dda( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._redeem_funds_to_linked_dda_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def redeem_funds_to_linked_dda(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._redeem_funds_to_linked_dda_oapg(params, request_options) class ApiForpost(BaseApi): @@ -465,13 +313,13 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._redeem_funds_to_linked_dda_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/gas_station/get.py b/fireblocks_client/paths/gas_station/get.py index 4fdf02c0..8da666ec 100644 --- a/fireblocks_client/paths/gas_station/get.py +++ b/fireblocks_client/paths/gas_station/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -32,9 +26,9 @@ XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = GasStationPropertiesResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -49,26 +43,26 @@ class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -83,21 +77,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -105,85 +99,39 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_gas_station_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_gas_station_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_gas_station_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_gas_station_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_gas_station_oapg(self, request_options: RequestOptions = None): """ Get gas station settings - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -198,53 +146,8 @@ class instances class GetGasStation(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_gas_station( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_gas_station( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_gas_station( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_gas_station( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_gas_station_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_gas_station(self , request_options: RequestOptions = None): + return self._get_gas_station_oapg(request_options) class ApiForget(BaseApi): @@ -292,10 +195,10 @@ def get( skip_deserialization: bool = False, ): return self._get_gas_station_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/gas_station/get.pyi b/fireblocks_client/paths/gas_station/get.pyi index 7ba23d96..8fc2501e 100644 --- a/fireblocks_client/paths/gas_station/get.pyi +++ b/fireblocks_client/paths/gas_station/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.gas_station_properties_response import GasStationPropertiesResponse from fireblocks_client.model.error import Error + XRequestIDSchema = schemas.StrSchema SchemaFor200ResponseBody = GasStationPropertiesResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -42,21 +37,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -71,103 +66,57 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_gas_station_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_gas_station_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_gas_station_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_gas_station_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_gas_station_oapg(self, request_options: RequestOptions = None): """ Get gas station settings - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -182,53 +131,8 @@ class BaseApi(api_client.Api): class GetGasStation(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_gas_station( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_gas_station( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_gas_station( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_gas_station( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_gas_station_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_gas_station(self , request_options: RequestOptions = None): + return self._get_gas_station_oapg(request_options) class ApiForget(BaseApi): @@ -276,10 +180,10 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_gas_station_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/gas_station_asset_id/get.py b/fireblocks_client/paths/gas_station_asset_id/get.py index e787e345..48c5bb0c 100644 --- a/fireblocks_client/paths/gas_station_asset_id/get.py +++ b/fireblocks_client/paths/gas_station_asset_id/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -58,9 +52,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = GasStationPropertiesResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -75,26 +69,26 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -109,21 +103,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -131,62 +125,23 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_gas_station_by_asset_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_gas_station_by_asset_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_gas_station_by_asset_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_gas_station_by_asset_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_gas_station_by_asset_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Get gas station settings by asset - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -201,33 +156,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -242,58 +192,8 @@ class instances class GetGasStationByAssetId(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_gas_station_by_asset_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_gas_station_by_asset_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_gas_station_by_asset_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_gas_station_by_asset_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_gas_station_by_asset_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_gas_station_by_asset_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_gas_station_by_asset_id_oapg(params, request_options) class ApiForget(BaseApi): @@ -345,11 +245,11 @@ def get( skip_deserialization: bool = False, ): return self._get_gas_station_by_asset_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/gas_station_asset_id/get.pyi b/fireblocks_client/paths/gas_station_asset_id/get.pyi index db729514..849f932f 100644 --- a/fireblocks_client/paths/gas_station_asset_id/get.pyi +++ b/fireblocks_client/paths/gas_station_asset_id/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.gas_station_properties_response import GasStationPropertiesResponse from fireblocks_client.model.error import Error + # Path params AssetIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -68,21 +63,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -97,80 +92,41 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_gas_station_by_asset_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_gas_station_by_asset_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_gas_station_by_asset_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_gas_station_by_asset_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_gas_station_by_asset_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Get gas station settings by asset - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -185,33 +141,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -226,58 +177,8 @@ class BaseApi(api_client.Api): class GetGasStationByAssetId(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_gas_station_by_asset_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_gas_station_by_asset_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_gas_station_by_asset_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_gas_station_by_asset_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_gas_station_by_asset_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_gas_station_by_asset_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_gas_station_by_asset_id_oapg(params, request_options) class ApiForget(BaseApi): @@ -329,11 +230,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_gas_station_by_asset_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/gas_station_configuration/put.py b/fireblocks_client/paths/gas_station_configuration/put.py index d0b5a424..f13a0b87 100644 --- a/fireblocks_client/paths/gas_station_configuration/put.py +++ b/fireblocks_client/paths/gas_station_configuration/put.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -32,20 +26,18 @@ # body param SchemaForRequestBodyApplicationJson = GasStationConfiguration - - request_body_gas_station_configuration = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor201 = typing_extensions.TypedDict( 'ResponseHeadersFor201', @@ -65,14 +57,14 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -87,142 +79,74 @@ class ApiResponseFor201(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '201': _response_for_201, 'default': _response_for_default, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _update_gas_station_configuration_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _update_gas_station_configuration_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _update_gas_station_configuration_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_gas_station_configuration_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _update_gas_station_configuration_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _update_gas_station_configuration_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): """ Edit gas station settings - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(gas_station_configuration, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_gas_station_configuration.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_gas_station_configuration.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='put'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -237,78 +161,8 @@ class instances class UpdateGasStationConfiguration(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def update_gas_station_configuration( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def update_gas_station_configuration( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def update_gas_station_configuration( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_gas_station_configuration( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def update_gas_station_configuration( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_gas_station_configuration_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def update_gas_station_configuration(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): + return self._update_gas_station_configuration_oapg(params, request_options) class ApiForput(BaseApi): @@ -379,12 +233,12 @@ def put( skip_deserialization: bool = False, ): return self._update_gas_station_configuration_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/gas_station_configuration/put.pyi b/fireblocks_client/paths/gas_station_configuration/put.pyi index f786a302..7e7fe647 100644 --- a/fireblocks_client/paths/gas_station_configuration/put.pyi +++ b/fireblocks_client/paths/gas_station_configuration/put.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,15 +22,14 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.gas_station_configuration import GasStationConfiguration from fireblocks_client.model.error import Error + # body param SchemaForRequestBodyApplicationJson = GasStationConfiguration - - request_body_gas_station_configuration = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema @@ -58,9 +51,9 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -75,138 +68,70 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _update_gas_station_configuration_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _update_gas_station_configuration_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _update_gas_station_configuration_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_gas_station_configuration_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _update_gas_station_configuration_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _update_gas_station_configuration_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): """ Edit gas station settings - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(gas_station_configuration, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_gas_station_configuration.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_gas_station_configuration.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='put'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -221,78 +146,8 @@ class BaseApi(api_client.Api): class UpdateGasStationConfiguration(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def update_gas_station_configuration( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def update_gas_station_configuration( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def update_gas_station_configuration( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_gas_station_configuration( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def update_gas_station_configuration( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_gas_station_configuration_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def update_gas_station_configuration(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): + return self._update_gas_station_configuration_oapg(params, request_options) class ApiForput(BaseApi): @@ -363,12 +218,12 @@ class ApiForput(BaseApi): skip_deserialization: bool = False, ): return self._update_gas_station_configuration_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/gas_station_configuration_asset_id/put.py b/fireblocks_client/paths/gas_station_configuration_asset_id/put.py index 7b9d2d18..dbb5f464 100644 --- a/fireblocks_client/paths/gas_station_configuration_asset_id/put.py +++ b/fireblocks_client/paths/gas_station_configuration_asset_id/put.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -58,20 +52,18 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) # body param SchemaForRequestBodyApplicationJson = GasStationConfiguration - - request_body_gas_station_configuration = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor201 = typing_extensions.TypedDict( 'ResponseHeadersFor201', @@ -91,14 +83,14 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -113,107 +105,44 @@ class ApiResponseFor201(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '201': _response_for_201, 'default': _response_for_default, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _update_gas_station_configuration_by_asset_id_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - @typing.overload - def _update_gas_station_configuration_by_asset_id_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _update_gas_station_configuration_by_asset_id_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_gas_station_configuration_by_asset_id_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _update_gas_station_configuration_by_asset_id_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _update_gas_station_configuration_by_asset_id_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): """ Edit gas station settings for an asset - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -228,46 +157,42 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(gas_station_configuration, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_gas_station_configuration.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_gas_station_configuration.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='put'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -282,84 +207,8 @@ class instances class UpdateGasStationConfigurationByAssetId(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def update_gas_station_configuration_by_asset_id( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def update_gas_station_configuration_by_asset_id( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def update_gas_station_configuration_by_asset_id( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_gas_station_configuration_by_asset_id( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def update_gas_station_configuration_by_asset_id( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_gas_station_configuration_by_asset_id_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def update_gas_station_configuration_by_asset_id(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): + return self._update_gas_station_configuration_by_asset_id_oapg(params, request_options) class ApiForput(BaseApi): @@ -435,13 +284,13 @@ def put( skip_deserialization: bool = False, ): return self._update_gas_station_configuration_by_asset_id_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/gas_station_configuration_asset_id/put.pyi b/fireblocks_client/paths/gas_station_configuration_asset_id/put.pyi index c6f156af..6be0365d 100644 --- a/fireblocks_client/paths/gas_station_configuration_asset_id/put.pyi +++ b/fireblocks_client/paths/gas_station_configuration_asset_id/put.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.gas_station_configuration import GasStationConfiguration from fireblocks_client.model.error import Error + # Path params AssetIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -56,13 +51,11 @@ request_path_asset_id = api_client.PathParameter( ) # body param SchemaForRequestBodyApplicationJson = GasStationConfiguration - - request_body_gas_station_configuration = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema @@ -84,9 +77,9 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -101,103 +94,40 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _update_gas_station_configuration_by_asset_id_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - @typing.overload - def _update_gas_station_configuration_by_asset_id_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _update_gas_station_configuration_by_asset_id_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_gas_station_configuration_by_asset_id_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _update_gas_station_configuration_by_asset_id_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _update_gas_station_configuration_by_asset_id_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): """ Edit gas station settings for an asset - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -212,46 +142,42 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(gas_station_configuration, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_gas_station_configuration.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_gas_station_configuration.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='put'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -266,84 +192,8 @@ class BaseApi(api_client.Api): class UpdateGasStationConfigurationByAssetId(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def update_gas_station_configuration_by_asset_id( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def update_gas_station_configuration_by_asset_id( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def update_gas_station_configuration_by_asset_id( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_gas_station_configuration_by_asset_id( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def update_gas_station_configuration_by_asset_id( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_gas_station_configuration_by_asset_id_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def update_gas_station_configuration_by_asset_id(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): + return self._update_gas_station_configuration_by_asset_id_oapg(params, request_options) class ApiForput(BaseApi): @@ -419,13 +269,13 @@ class ApiForput(BaseApi): skip_deserialization: bool = False, ): return self._update_gas_station_configuration_by_asset_id_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/internal_wallets/get.py b/fireblocks_client/paths/internal_wallets/get.py index 3a35a957..f3ba39f6 100644 --- a/fireblocks_client/paths/internal_wallets/get.py +++ b/fireblocks_client/paths/internal_wallets/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -32,9 +26,9 @@ XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) @@ -74,26 +68,26 @@ def __getitem__(self, i: int) -> 'UnmanagedWallet': class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -108,21 +102,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -130,85 +124,39 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_internal_wallets_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_internal_wallets_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_internal_wallets_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_internal_wallets_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_internal_wallets_oapg(self, request_options: RequestOptions = None): """ List internal wallets - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -223,53 +171,8 @@ class instances class GetInternalWallets(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_internal_wallets( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_internal_wallets( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_internal_wallets( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_internal_wallets( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_internal_wallets_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_internal_wallets(self , request_options: RequestOptions = None): + return self._get_internal_wallets_oapg(request_options) class ApiForget(BaseApi): @@ -317,10 +220,10 @@ def get( skip_deserialization: bool = False, ): return self._get_internal_wallets_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/internal_wallets/get.pyi b/fireblocks_client/paths/internal_wallets/get.pyi index 39069352..1fe9df46 100644 --- a/fireblocks_client/paths/internal_wallets/get.pyi +++ b/fireblocks_client/paths/internal_wallets/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.unmanaged_wallet import UnmanagedWallet from fireblocks_client.model.error import Error + XRequestIDSchema = schemas.StrSchema @@ -67,21 +62,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -96,103 +91,57 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_internal_wallets_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_internal_wallets_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_internal_wallets_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_internal_wallets_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_internal_wallets_oapg(self, request_options: RequestOptions = None): """ List internal wallets - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -207,53 +156,8 @@ class BaseApi(api_client.Api): class GetInternalWallets(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_internal_wallets( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_internal_wallets( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_internal_wallets( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_internal_wallets( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_internal_wallets_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_internal_wallets(self , request_options: RequestOptions = None): + return self._get_internal_wallets_oapg(request_options) class ApiForget(BaseApi): @@ -301,10 +205,10 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_internal_wallets_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/internal_wallets/post.py b/fireblocks_client/paths/internal_wallets/post.py index b552865b..5dd14394 100644 --- a/fireblocks_client/paths/internal_wallets/post.py +++ b/fireblocks_client/paths/internal_wallets/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -92,19 +86,17 @@ def __new__( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = UnmanagedWallet ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -119,26 +111,26 @@ def __new__( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -153,21 +145,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -175,119 +167,49 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_internal_wallet_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _create_internal_wallet_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _create_internal_wallet_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_internal_wallet_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _create_internal_wallet_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_internal_wallet_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): """ Create an internal wallet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -302,78 +224,8 @@ class instances class CreateInternalWallet(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create_internal_wallet( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def create_internal_wallet( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def create_internal_wallet( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_internal_wallet( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_internal_wallet( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_internal_wallet_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create_internal_wallet(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): + return self._create_internal_wallet_oapg(params, request_options) class ApiForpost(BaseApi): @@ -444,12 +296,12 @@ def post( skip_deserialization: bool = False, ): return self._create_internal_wallet_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/internal_wallets/post.pyi b/fireblocks_client/paths/internal_wallets/post.pyi index dc8ec9f8..28afd146 100644 --- a/fireblocks_client/paths/internal_wallets/post.pyi +++ b/fireblocks_client/paths/internal_wallets/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.unmanaged_wallet import UnmanagedWallet from fireblocks_client.model.error import Error + # body param @@ -90,13 +85,11 @@ class SchemaForRequestBodyApplicationJson( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema SchemaFor200ResponseBody = UnmanagedWallet @@ -112,21 +105,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -141,137 +134,67 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_internal_wallet_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _create_internal_wallet_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _create_internal_wallet_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_internal_wallet_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _create_internal_wallet_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_internal_wallet_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): """ Create an internal wallet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -286,78 +209,8 @@ class BaseApi(api_client.Api): class CreateInternalWallet(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create_internal_wallet( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def create_internal_wallet( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def create_internal_wallet( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_internal_wallet( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_internal_wallet( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_internal_wallet_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create_internal_wallet(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): + return self._create_internal_wallet_oapg(params, request_options) class ApiForpost(BaseApi): @@ -428,12 +281,12 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._create_internal_wallet_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/internal_wallets_wallet_id/delete.py b/fireblocks_client/paths/internal_wallets_wallet_id/delete.py index 4f0b75d2..53fcb078 100644 --- a/fireblocks_client/paths/internal_wallets_wallet_id/delete.py +++ b/fireblocks_client/paths/internal_wallets_wallet_id/delete.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -57,9 +51,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor201 = typing_extensions.TypedDict( 'ResponseHeadersFor201', @@ -79,14 +73,14 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -101,83 +95,44 @@ class ApiResponseFor201(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '201': _response_for_201, 'default': _response_for_default, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _delete_internal_wallet_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _delete_internal_wallet_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _delete_internal_wallet_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _delete_internal_wallet_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _delete_internal_wallet_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Delete an internal wallet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_wallet_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -192,33 +147,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='delete'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -233,58 +183,8 @@ class instances class DeleteInternalWallet(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def delete_internal_wallet( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def delete_internal_wallet( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete_internal_wallet( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete_internal_wallet( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_internal_wallet_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def delete_internal_wallet(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._delete_internal_wallet_oapg(params, request_options) class ApiFordelete(BaseApi): @@ -336,11 +236,11 @@ def delete( skip_deserialization: bool = False, ): return self._delete_internal_wallet_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/internal_wallets_wallet_id/delete.pyi b/fireblocks_client/paths/internal_wallets_wallet_id/delete.pyi index c7796226..bb3ee083 100644 --- a/fireblocks_client/paths/internal_wallets_wallet_id/delete.pyi +++ b/fireblocks_client/paths/internal_wallets_wallet_id/delete.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error + # Path params WalletIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -72,9 +67,9 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -89,79 +84,40 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _delete_internal_wallet_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _delete_internal_wallet_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _delete_internal_wallet_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _delete_internal_wallet_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _delete_internal_wallet_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Delete an internal wallet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_wallet_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -176,33 +132,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='delete'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -217,58 +168,8 @@ class BaseApi(api_client.Api): class DeleteInternalWallet(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def delete_internal_wallet( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def delete_internal_wallet( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete_internal_wallet( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete_internal_wallet( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_internal_wallet_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def delete_internal_wallet(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._delete_internal_wallet_oapg(params, request_options) class ApiFordelete(BaseApi): @@ -320,11 +221,11 @@ class ApiFordelete(BaseApi): skip_deserialization: bool = False, ): return self._delete_internal_wallet_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/internal_wallets_wallet_id/get.py b/fireblocks_client/paths/internal_wallets_wallet_id/get.py index 428b484e..41edf279 100644 --- a/fireblocks_client/paths/internal_wallets_wallet_id/get.py +++ b/fireblocks_client/paths/internal_wallets_wallet_id/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -58,9 +52,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = UnmanagedWallet ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -75,26 +69,26 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -109,21 +103,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -131,62 +125,23 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_internal_wallet_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_internal_wallet_by_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_internal_wallet_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_internal_wallet_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_internal_wallet_by_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Get assets for internal wallet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_wallet_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -201,33 +156,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -242,58 +192,8 @@ class instances class GetInternalWalletById(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_internal_wallet_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_internal_wallet_by_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_internal_wallet_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_internal_wallet_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_internal_wallet_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_internal_wallet_by_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_internal_wallet_by_id_oapg(params, request_options) class ApiForget(BaseApi): @@ -345,11 +245,11 @@ def get( skip_deserialization: bool = False, ): return self._get_internal_wallet_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/internal_wallets_wallet_id/get.pyi b/fireblocks_client/paths/internal_wallets_wallet_id/get.pyi index 27a9401a..a8b0d8e1 100644 --- a/fireblocks_client/paths/internal_wallets_wallet_id/get.pyi +++ b/fireblocks_client/paths/internal_wallets_wallet_id/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.unmanaged_wallet import UnmanagedWallet from fireblocks_client.model.error import Error + # Path params WalletIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -68,21 +63,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -97,80 +92,41 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_internal_wallet_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_internal_wallet_by_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_internal_wallet_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_internal_wallet_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_internal_wallet_by_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Get assets for internal wallet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_wallet_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -185,33 +141,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -226,58 +177,8 @@ class BaseApi(api_client.Api): class GetInternalWalletById(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_internal_wallet_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_internal_wallet_by_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_internal_wallet_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_internal_wallet_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_internal_wallet_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_internal_wallet_by_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_internal_wallet_by_id_oapg(params, request_options) class ApiForget(BaseApi): @@ -329,11 +230,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_internal_wallet_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/internal_wallets_wallet_id_asset_id/delete.py b/fireblocks_client/paths/internal_wallets_wallet_id_asset_id/delete.py index 8bf961d4..a00262e3 100644 --- a/fireblocks_client/paths/internal_wallets_wallet_id_asset_id/delete.py +++ b/fireblocks_client/paths/internal_wallets_wallet_id_asset_id/delete.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -65,9 +59,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor201 = typing_extensions.TypedDict( 'ResponseHeadersFor201', @@ -87,14 +81,14 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -109,83 +103,45 @@ class ApiResponseFor201(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '201': _response_for_201, 'default': _response_for_default, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _delete_internal_wallet_asset_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _delete_internal_wallet_asset_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _delete_internal_wallet_asset_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _delete_internal_wallet_asset_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _delete_internal_wallet_asset_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Delete a whitelisted address from an internal wallet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_wallet_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -201,33 +157,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='delete'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -242,58 +193,8 @@ class instances class DeleteInternalWalletAsset(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def delete_internal_wallet_asset( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def delete_internal_wallet_asset( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete_internal_wallet_asset( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete_internal_wallet_asset( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_internal_wallet_asset_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def delete_internal_wallet_asset(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._delete_internal_wallet_asset_oapg(params, request_options) class ApiFordelete(BaseApi): @@ -345,11 +246,11 @@ def delete( skip_deserialization: bool = False, ): return self._delete_internal_wallet_asset_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/internal_wallets_wallet_id_asset_id/delete.pyi b/fireblocks_client/paths/internal_wallets_wallet_id_asset_id/delete.pyi index 481fcb84..b15092e5 100644 --- a/fireblocks_client/paths/internal_wallets_wallet_id_asset_id/delete.pyi +++ b/fireblocks_client/paths/internal_wallets_wallet_id_asset_id/delete.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error + # Path params WalletIdSchema = schemas.StrSchema AssetIdSchema = schemas.StrSchema @@ -80,9 +75,9 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -97,79 +92,41 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _delete_internal_wallet_asset_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - @typing.overload - def _delete_internal_wallet_asset_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _delete_internal_wallet_asset_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _delete_internal_wallet_asset_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _delete_internal_wallet_asset_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Delete a whitelisted address from an internal wallet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_wallet_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -185,33 +142,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='delete'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -226,58 +178,8 @@ class BaseApi(api_client.Api): class DeleteInternalWalletAsset(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def delete_internal_wallet_asset( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def delete_internal_wallet_asset( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete_internal_wallet_asset( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete_internal_wallet_asset( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_internal_wallet_asset_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def delete_internal_wallet_asset(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._delete_internal_wallet_asset_oapg(params, request_options) class ApiFordelete(BaseApi): @@ -329,11 +231,11 @@ class ApiFordelete(BaseApi): skip_deserialization: bool = False, ): return self._delete_internal_wallet_asset_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/internal_wallets_wallet_id_asset_id/get.py b/fireblocks_client/paths/internal_wallets_wallet_id_asset_id/get.py index 5ef92efa..ffe3c7e0 100644 --- a/fireblocks_client/paths/internal_wallets_wallet_id_asset_id/get.py +++ b/fireblocks_client/paths/internal_wallets_wallet_id_asset_id/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -66,9 +60,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = WalletAsset ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -83,26 +77,26 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -117,21 +111,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -139,62 +133,24 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_internal_wallet_asset_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_internal_wallet_asset_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_internal_wallet_asset_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_internal_wallet_asset_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_internal_wallet_asset_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Get an asset from an internal wallet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_wallet_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -210,33 +166,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -251,58 +202,8 @@ class instances class GetInternalWalletAsset(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_internal_wallet_asset( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_internal_wallet_asset( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_internal_wallet_asset( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_internal_wallet_asset( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_internal_wallet_asset_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_internal_wallet_asset(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_internal_wallet_asset_oapg(params, request_options) class ApiForget(BaseApi): @@ -354,11 +255,11 @@ def get( skip_deserialization: bool = False, ): return self._get_internal_wallet_asset_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/internal_wallets_wallet_id_asset_id/get.pyi b/fireblocks_client/paths/internal_wallets_wallet_id_asset_id/get.pyi index dd9116f9..ccd947d8 100644 --- a/fireblocks_client/paths/internal_wallets_wallet_id_asset_id/get.pyi +++ b/fireblocks_client/paths/internal_wallets_wallet_id_asset_id/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error from fireblocks_client.model.wallet_asset import WalletAsset + # Path params WalletIdSchema = schemas.StrSchema AssetIdSchema = schemas.StrSchema @@ -76,21 +71,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -105,80 +100,42 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_internal_wallet_asset_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _get_internal_wallet_asset_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_internal_wallet_asset_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_internal_wallet_asset_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_internal_wallet_asset_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Get an asset from an internal wallet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_wallet_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -194,33 +151,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -235,58 +187,8 @@ class BaseApi(api_client.Api): class GetInternalWalletAsset(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_internal_wallet_asset( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_internal_wallet_asset( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_internal_wallet_asset( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_internal_wallet_asset( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_internal_wallet_asset_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_internal_wallet_asset(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_internal_wallet_asset_oapg(params, request_options) class ApiForget(BaseApi): @@ -338,11 +240,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_internal_wallet_asset_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/internal_wallets_wallet_id_asset_id/post.py b/fireblocks_client/paths/internal_wallets_wallet_id_asset_id/post.py index 677ca32b..0e1b3f7e 100644 --- a/fireblocks_client/paths/internal_wallets_wallet_id_asset_id/post.py +++ b/fireblocks_client/paths/internal_wallets_wallet_id_asset_id/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -131,19 +125,17 @@ def __new__( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = WalletAsset ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -158,26 +150,26 @@ def __new__( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -192,21 +184,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -214,86 +206,24 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_internal_wallet_asset_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _create_internal_wallet_asset_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _create_internal_wallet_asset_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_internal_wallet_asset_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _create_internal_wallet_asset_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_internal_wallet_asset_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Add an asset to an internal wallet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_wallet_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -309,44 +239,38 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -361,84 +285,8 @@ class instances class CreateInternalWalletAsset(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create_internal_wallet_asset( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def create_internal_wallet_asset( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def create_internal_wallet_asset( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_internal_wallet_asset( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_internal_wallet_asset( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_internal_wallet_asset_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create_internal_wallet_asset(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._create_internal_wallet_asset_oapg(params, request_options) class ApiForpost(BaseApi): @@ -514,13 +362,13 @@ def post( skip_deserialization: bool = False, ): return self._create_internal_wallet_asset_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/internal_wallets_wallet_id_asset_id/post.pyi b/fireblocks_client/paths/internal_wallets_wallet_id_asset_id/post.pyi index 6a90851c..8fe105f2 100644 --- a/fireblocks_client/paths/internal_wallets_wallet_id_asset_id/post.pyi +++ b/fireblocks_client/paths/internal_wallets_wallet_id_asset_id/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error from fireblocks_client.model.wallet_asset import WalletAsset + # Path params WalletIdSchema = schemas.StrSchema AssetIdSchema = schemas.StrSchema @@ -129,13 +124,11 @@ class SchemaForRequestBodyApplicationJson( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema SchemaFor200ResponseBody = WalletAsset @@ -151,21 +144,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -180,104 +173,42 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_internal_wallet_asset_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _create_internal_wallet_asset_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _create_internal_wallet_asset_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_internal_wallet_asset_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _create_internal_wallet_asset_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_internal_wallet_asset_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Add an asset to an internal wallet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_wallet_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -293,44 +224,38 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -345,84 +270,8 @@ class BaseApi(api_client.Api): class CreateInternalWalletAsset(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create_internal_wallet_asset( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def create_internal_wallet_asset( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def create_internal_wallet_asset( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_internal_wallet_asset( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_internal_wallet_asset( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_internal_wallet_asset_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create_internal_wallet_asset(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._create_internal_wallet_asset_oapg(params, request_options) class ApiForpost(BaseApi): @@ -498,13 +347,13 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._create_internal_wallet_asset_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/internal_wallets_wallet_id_set_customer_ref_id/post.py b/fireblocks_client/paths/internal_wallets_wallet_id_set_customer_ref_id/post.py index 90fb7d02..735f7c90 100644 --- a/fireblocks_client/paths/internal_wallets_wallet_id_set_customer_ref_id/post.py +++ b/fireblocks_client/paths/internal_wallets_wallet_id_set_customer_ref_id/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -107,20 +101,18 @@ def __new__( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor201 = typing_extensions.TypedDict( 'ResponseHeadersFor201', @@ -140,14 +132,14 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -162,107 +154,44 @@ class ApiResponseFor201(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '201': _response_for_201, 'default': _response_for_default, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _set_customer_ref_id_for_internal_wallet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - @typing.overload - def _set_customer_ref_id_for_internal_wallet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _set_customer_ref_id_for_internal_wallet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _set_customer_ref_id_for_internal_wallet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _set_customer_ref_id_for_internal_wallet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _set_customer_ref_id_for_internal_wallet_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Set an AML/KYT customer reference ID for an internal wallet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_wallet_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -277,46 +206,42 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(any_type, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -331,84 +256,8 @@ class instances class SetCustomerRefIdForInternalWallet(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def set_customer_ref_id_for_internal_wallet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def set_customer_ref_id_for_internal_wallet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def set_customer_ref_id_for_internal_wallet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def set_customer_ref_id_for_internal_wallet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def set_customer_ref_id_for_internal_wallet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._set_customer_ref_id_for_internal_wallet_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def set_customer_ref_id_for_internal_wallet(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._set_customer_ref_id_for_internal_wallet_oapg(params, request_options) class ApiForpost(BaseApi): @@ -484,13 +333,13 @@ def post( skip_deserialization: bool = False, ): return self._set_customer_ref_id_for_internal_wallet_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/internal_wallets_wallet_id_set_customer_ref_id/post.pyi b/fireblocks_client/paths/internal_wallets_wallet_id_set_customer_ref_id/post.pyi index 3818f9ed..f8fce86a 100644 --- a/fireblocks_client/paths/internal_wallets_wallet_id_set_customer_ref_id/post.pyi +++ b/fireblocks_client/paths/internal_wallets_wallet_id_set_customer_ref_id/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error + # Path params WalletIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -105,13 +100,11 @@ class SchemaForRequestBodyApplicationJson( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema @@ -133,9 +126,9 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -150,103 +143,40 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _set_customer_ref_id_for_internal_wallet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - @typing.overload - def _set_customer_ref_id_for_internal_wallet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _set_customer_ref_id_for_internal_wallet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _set_customer_ref_id_for_internal_wallet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _set_customer_ref_id_for_internal_wallet_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _set_customer_ref_id_for_internal_wallet_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Set an AML/KYT customer reference ID for an internal wallet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_wallet_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -261,46 +191,42 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(any_type, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -315,84 +241,8 @@ class BaseApi(api_client.Api): class SetCustomerRefIdForInternalWallet(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def set_customer_ref_id_for_internal_wallet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def set_customer_ref_id_for_internal_wallet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def set_customer_ref_id_for_internal_wallet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def set_customer_ref_id_for_internal_wallet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def set_customer_ref_id_for_internal_wallet( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._set_customer_ref_id_for_internal_wallet_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def set_customer_ref_id_for_internal_wallet(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._set_customer_ref_id_for_internal_wallet_oapg(params, request_options) class ApiForpost(BaseApi): @@ -468,13 +318,13 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._set_customer_ref_id_for_internal_wallet_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/management_ota/get.py b/fireblocks_client/paths/management_ota/get.py index 7dd75958..54596a59 100644 --- a/fireblocks_client/paths/management_ota/get.py +++ b/fireblocks_client/paths/management_ota/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -84,18 +78,18 @@ def __new__( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) @dataclass @@ -107,86 +101,42 @@ class ApiResponseFor404(api_client.ApiResponse): _response_for_404 = api_client.OpenApiResponse( response_cls=ApiResponseFor404, -) + ) _status_code_to_response = { '200': _response_for_200, '404': _response_for_404, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_ota_status_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - @typing.overload - def _get_ota_status_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_ota_status_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_ota_status_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_ota_status_oapg(self, request_options: RequestOptions = None): """ Returns current OTA status - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -201,51 +151,8 @@ class instances class GetOtaStatus(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_ota_status( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get_ota_status( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_ota_status( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_ota_status( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_ota_status_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_ota_status(self , request_options: RequestOptions = None): + return self._get_ota_status_oapg(request_options) class ApiForget(BaseApi): @@ -291,10 +198,10 @@ def get( skip_deserialization: bool = False, ): return self._get_ota_status_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/management_ota/get.pyi b/fireblocks_client/paths/management_ota/get.pyi index 9534ce5d..6df9260e 100644 --- a/fireblocks_client/paths/management_ota/get.pyi +++ b/fireblocks_client/paths/management_ota/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 + class SchemaFor200ResponseBodyApplicationJson( schemas.AnyTypeSchema, ): @@ -82,18 +77,18 @@ class SchemaFor200ResponseBodyApplicationJson( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) @dataclass @@ -105,82 +100,38 @@ class ApiResponseFor404(api_client.ApiResponse): _response_for_404 = api_client.OpenApiResponse( response_cls=ApiResponseFor404, -) + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_ota_status_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _get_ota_status_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_ota_status_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_ota_status_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_ota_status_oapg(self, request_options: RequestOptions = None): """ Returns current OTA status - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -195,51 +146,8 @@ class BaseApi(api_client.Api): class GetOtaStatus(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_ota_status( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get_ota_status( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_ota_status( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_ota_status( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_ota_status_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_ota_status(self , request_options: RequestOptions = None): + return self._get_ota_status_oapg(request_options) class ApiForget(BaseApi): @@ -285,10 +193,10 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_ota_status_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/management_ota/post.py b/fireblocks_client/paths/management_ota/post.py index efac49f6..33a16905 100644 --- a/fireblocks_client/paths/management_ota/post.py +++ b/fireblocks_client/paths/management_ota/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -79,13 +73,11 @@ def __new__( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) @@ -99,7 +91,7 @@ class ApiResponseFor202(api_client.ApiResponse): _response_for_202 = api_client.OpenApiResponse( response_cls=ApiResponseFor202, -) + ) @dataclass @@ -111,7 +103,7 @@ class ApiResponseFor400(api_client.ApiResponse): _response_for_400 = api_client.OpenApiResponse( response_cls=ApiResponseFor400, -) + ) @dataclass @@ -123,7 +115,7 @@ class ApiResponseFor409(api_client.ApiResponse): _response_for_409 = api_client.OpenApiResponse( response_cls=ApiResponseFor409, -) + ) @dataclass @@ -135,7 +127,7 @@ class ApiResponseFor500(api_client.ApiResponse): _response_for_500 = api_client.OpenApiResponse( response_cls=ApiResponseFor500, -) + ) _status_code_to_response = { '202': _response_for_202, '400': _response_for_400, @@ -145,102 +137,45 @@ class ApiResponseFor500(api_client.ApiResponse): class BaseApi(api_client.Api): - @typing.overload - def _set_ota_status_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor202, - ]: ... - - @typing.overload - def _set_ota_status_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor202, - ]: ... - - - @typing.overload - def _set_ota_status_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _set_ota_status_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor202, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _set_ota_status_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _set_ota_status_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): """ Enable or disable transactions to OTA - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling + body = params.get(any_type, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -255,69 +190,8 @@ class instances class SetOtaStatus(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def set_ota_status( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor202, - ]: ... - - @typing.overload - def set_ota_status( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor202, - ]: ... - - - @typing.overload - def set_ota_status( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def set_ota_status( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor202, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def set_ota_status( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._set_ota_status_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def set_ota_status(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): + return self._set_ota_status_oapg(params, request_options) class ApiForpost(BaseApi): @@ -380,11 +254,11 @@ def post( skip_deserialization: bool = False, ): return self._set_ota_status_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/management_ota/post.pyi b/fireblocks_client/paths/management_ota/post.pyi index 14cfb841..703245cc 100644 --- a/fireblocks_client/paths/management_ota/post.pyi +++ b/fireblocks_client/paths/management_ota/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -25,6 +19,7 @@ import frozendict # noqa: F401 from fireblocks_client import schemas # noqa: F401 + # body param @@ -77,13 +72,11 @@ class SchemaForRequestBodyApplicationJson( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) @@ -97,7 +90,7 @@ class ApiResponseFor202(api_client.ApiResponse): _response_for_202 = api_client.OpenApiResponse( response_cls=ApiResponseFor202, -) + ) @dataclass @@ -109,7 +102,7 @@ class ApiResponseFor400(api_client.ApiResponse): _response_for_400 = api_client.OpenApiResponse( response_cls=ApiResponseFor400, -) + ) @dataclass @@ -121,7 +114,7 @@ class ApiResponseFor409(api_client.ApiResponse): _response_for_409 = api_client.OpenApiResponse( response_cls=ApiResponseFor409, -) + ) @dataclass @@ -133,106 +126,49 @@ class ApiResponseFor500(api_client.ApiResponse): _response_for_500 = api_client.OpenApiResponse( response_cls=ApiResponseFor500, -) + ) class BaseApi(api_client.Api): - @typing.overload - def _set_ota_status_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor202, - ]: ... - - @typing.overload - def _set_ota_status_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor202, - ]: ... - - - @typing.overload - def _set_ota_status_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _set_ota_status_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor202, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _set_ota_status_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _set_ota_status_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): """ Enable or disable transactions to OTA - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling + body = params.get(any_type, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -247,69 +183,8 @@ class BaseApi(api_client.Api): class SetOtaStatus(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def set_ota_status( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor202, - ]: ... - - @typing.overload - def set_ota_status( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor202, - ]: ... - - - @typing.overload - def set_ota_status( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def set_ota_status( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor202, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def set_ota_status( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._set_ota_status_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def set_ota_status(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): + return self._set_ota_status_oapg(params, request_options) class ApiForpost(BaseApi): @@ -372,11 +247,11 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._set_ota_status_oapg( - body=body, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/network_connections/get.py b/fireblocks_client/paths/network_connections/get.py index 71604bb8..dd06e2dd 100644 --- a/fireblocks_client/paths/network_connections/get.py +++ b/fireblocks_client/paths/network_connections/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -32,9 +26,9 @@ XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) @@ -74,26 +68,26 @@ def __getitem__(self, i: int) -> 'NetworkConnectionResponse': class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -108,21 +102,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -130,85 +124,39 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_network_connections_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_network_connections_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_network_connections_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_network_connections_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_network_connections_oapg(self, request_options: RequestOptions = None): """ List network connections - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -223,53 +171,8 @@ class instances class GetNetworkConnections(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_network_connections( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_network_connections( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_network_connections( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_network_connections( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_network_connections_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_network_connections(self , request_options: RequestOptions = None): + return self._get_network_connections_oapg(request_options) class ApiForget(BaseApi): @@ -317,10 +220,10 @@ def get( skip_deserialization: bool = False, ): return self._get_network_connections_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/network_connections/get.pyi b/fireblocks_client/paths/network_connections/get.pyi index f2c0436b..ced18ec7 100644 --- a/fireblocks_client/paths/network_connections/get.pyi +++ b/fireblocks_client/paths/network_connections/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error from fireblocks_client.model.network_connection_response import NetworkConnectionResponse + XRequestIDSchema = schemas.StrSchema @@ -67,21 +62,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -96,103 +91,57 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_network_connections_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_network_connections_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_network_connections_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_network_connections_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_network_connections_oapg(self, request_options: RequestOptions = None): """ List network connections - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -207,53 +156,8 @@ class BaseApi(api_client.Api): class GetNetworkConnections(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_network_connections( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_network_connections( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_network_connections( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_network_connections( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_network_connections_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_network_connections(self , request_options: RequestOptions = None): + return self._get_network_connections_oapg(request_options) class ApiForget(BaseApi): @@ -301,10 +205,10 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_network_connections_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/network_connections/post.py b/fireblocks_client/paths/network_connections/post.py index 8d777b67..3cf9aab1 100644 --- a/fireblocks_client/paths/network_connections/post.py +++ b/fireblocks_client/paths/network_connections/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -33,19 +27,17 @@ # body param SchemaForRequestBodyApplicationJson = NetworkConnection - - request_body_network_connection = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor201ResponseBody = NetworkConnectionResponse ResponseHeadersFor201 = typing_extensions.TypedDict( @@ -60,26 +52,26 @@ class ApiResponseFor201(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor201ResponseBody, - ] + SchemaFor201ResponseBody, + ] headers: ResponseHeadersFor201 _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, content={ - '*/*': api_client.MediaType( - schema=SchemaFor201ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor201ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -94,21 +86,21 @@ class ApiResponseFor201(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '201': _response_for_201, 'default': _response_for_default, @@ -116,119 +108,49 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_network_connection_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _create_network_connection_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _create_network_connection_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_network_connection_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _create_network_connection_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_network_connection_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): """ Creates a new network connection - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_network_connection.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_network_connection.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -243,78 +165,8 @@ class instances class CreateNetworkConnection(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create_network_connection( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def create_network_connection( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def create_network_connection( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_network_connection( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_network_connection( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_network_connection_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create_network_connection(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): + return self._create_network_connection_oapg(params, request_options) class ApiForpost(BaseApi): @@ -385,12 +237,12 @@ def post( skip_deserialization: bool = False, ): return self._create_network_connection_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/network_connections/post.pyi b/fireblocks_client/paths/network_connections/post.pyi index 01a8c2fc..f76403ae 100644 --- a/fireblocks_client/paths/network_connections/post.pyi +++ b/fireblocks_client/paths/network_connections/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -29,15 +23,14 @@ from fireblocks_client.model.error import Error from fireblocks_client.model.network_connection import NetworkConnection from fireblocks_client.model.network_connection_response import NetworkConnectionResponse + # body param SchemaForRequestBodyApplicationJson = NetworkConnection - - request_body_network_connection = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema SchemaFor201ResponseBody = NetworkConnectionResponse @@ -53,21 +46,21 @@ ResponseHeadersFor201 = typing_extensions.TypedDict( class ApiResponseFor201(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor201ResponseBody, - ] + SchemaFor201ResponseBody, + ] headers: ResponseHeadersFor201 _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, content={ - '*/*': api_client.MediaType( - schema=SchemaFor201ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor201ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -82,137 +75,67 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_network_connection_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _create_network_connection_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _create_network_connection_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_network_connection_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _create_network_connection_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_network_connection_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): """ Creates a new network connection - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_network_connection.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_network_connection.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -227,78 +150,8 @@ class BaseApi(api_client.Api): class CreateNetworkConnection(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create_network_connection( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def create_network_connection( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def create_network_connection( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_network_connection( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_network_connection( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_network_connection_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create_network_connection(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): + return self._create_network_connection_oapg(params, request_options) class ApiForpost(BaseApi): @@ -369,12 +222,12 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._create_network_connection_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/network_connections_connection_id/delete.py b/fireblocks_client/paths/network_connections_connection_id/delete.py index 1f1b3053..a1e5eb8d 100644 --- a/fireblocks_client/paths/network_connections_connection_id/delete.py +++ b/fireblocks_client/paths/network_connections_connection_id/delete.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -57,9 +51,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) @@ -129,26 +123,26 @@ def __new__( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -163,21 +157,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -185,62 +179,23 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _delete_network_connection_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _delete_network_connection_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _delete_network_connection_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _delete_network_connection_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _delete_network_connection_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Deletes a network connection by ID - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_connection_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -255,33 +210,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='delete'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -296,58 +246,8 @@ class instances class DeleteNetworkConnection(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def delete_network_connection( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def delete_network_connection( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete_network_connection( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete_network_connection( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_network_connection_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def delete_network_connection(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._delete_network_connection_oapg(params, request_options) class ApiFordelete(BaseApi): @@ -399,11 +299,11 @@ def delete( skip_deserialization: bool = False, ): return self._delete_network_connection_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/network_connections_connection_id/delete.pyi b/fireblocks_client/paths/network_connections_connection_id/delete.pyi index 6af3e470..cf3fe986 100644 --- a/fireblocks_client/paths/network_connections_connection_id/delete.pyi +++ b/fireblocks_client/paths/network_connections_connection_id/delete.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error + # Path params ConnectionIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -122,21 +117,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -151,80 +146,41 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _delete_network_connection_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _delete_network_connection_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _delete_network_connection_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _delete_network_connection_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _delete_network_connection_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Deletes a network connection by ID - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_connection_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -239,33 +195,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='delete'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -280,58 +231,8 @@ class BaseApi(api_client.Api): class DeleteNetworkConnection(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def delete_network_connection( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def delete_network_connection( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete_network_connection( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete_network_connection( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_network_connection_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def delete_network_connection(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._delete_network_connection_oapg(params, request_options) class ApiFordelete(BaseApi): @@ -383,11 +284,11 @@ class ApiFordelete(BaseApi): skip_deserialization: bool = False, ): return self._delete_network_connection_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/network_connections_connection_id/get.py b/fireblocks_client/paths/network_connections_connection_id/get.py index 34140ba8..1a9a76bb 100644 --- a/fireblocks_client/paths/network_connections_connection_id/get.py +++ b/fireblocks_client/paths/network_connections_connection_id/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -58,9 +52,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = NetworkConnectionResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -75,26 +69,26 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -109,21 +103,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -131,62 +125,23 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_network_connection_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_network_connection_by_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_network_connection_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_network_connection_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_network_connection_by_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Get a network connection - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_connection_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -201,33 +156,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -242,58 +192,8 @@ class instances class GetNetworkConnectionById(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_network_connection_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_network_connection_by_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_network_connection_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_network_connection_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_network_connection_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_network_connection_by_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_network_connection_by_id_oapg(params, request_options) class ApiForget(BaseApi): @@ -345,11 +245,11 @@ def get( skip_deserialization: bool = False, ): return self._get_network_connection_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/network_connections_connection_id/get.pyi b/fireblocks_client/paths/network_connections_connection_id/get.pyi index c60a76d9..8ce5bf1b 100644 --- a/fireblocks_client/paths/network_connections_connection_id/get.pyi +++ b/fireblocks_client/paths/network_connections_connection_id/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error from fireblocks_client.model.network_connection_response import NetworkConnectionResponse + # Path params ConnectionIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -68,21 +63,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -97,80 +92,41 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_network_connection_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_network_connection_by_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_network_connection_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_network_connection_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_network_connection_by_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Get a network connection - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_connection_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -185,33 +141,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -226,58 +177,8 @@ class BaseApi(api_client.Api): class GetNetworkConnectionById(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_network_connection_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_network_connection_by_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_network_connection_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_network_connection_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_network_connection_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_network_connection_by_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_network_connection_by_id_oapg(params, request_options) class ApiForget(BaseApi): @@ -329,11 +230,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_network_connection_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/network_connections_connection_id_is_third_party_routing_asset_type/get.py b/fireblocks_client/paths/network_connections_connection_id_is_third_party_routing_asset_type/get.py index b310bab5..668ee07d 100644 --- a/fireblocks_client/paths/network_connections_connection_id_is_third_party_routing_asset_type/get.py +++ b/fireblocks_client/paths/network_connections_connection_id_is_third_party_routing_asset_type/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -95,9 +89,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) @@ -172,26 +166,26 @@ def __new__( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -206,21 +200,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -228,62 +222,24 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _check_third_party_routing_for_network_connection_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _check_third_party_routing_for_network_connection_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _check_third_party_routing_for_network_connection_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _check_third_party_routing_for_network_connection_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _check_third_party_routing_for_network_connection_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Retrieve third-party network routing validation by asset type. - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_connection_id, + request_path_asset_type, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -299,33 +255,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -340,58 +291,8 @@ class instances class CheckThirdPartyRoutingForNetworkConnection(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def check_third_party_routing_for_network_connection( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def check_third_party_routing_for_network_connection( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def check_third_party_routing_for_network_connection( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def check_third_party_routing_for_network_connection( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._check_third_party_routing_for_network_connection_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def check_third_party_routing_for_network_connection(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._check_third_party_routing_for_network_connection_oapg(params, request_options) class ApiForget(BaseApi): @@ -443,11 +344,11 @@ def get( skip_deserialization: bool = False, ): return self._check_third_party_routing_for_network_connection_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/network_connections_connection_id_is_third_party_routing_asset_type/get.pyi b/fireblocks_client/paths/network_connections_connection_id_is_third_party_routing_asset_type/get.pyi index e6b15532..10d8c875 100644 --- a/fireblocks_client/paths/network_connections_connection_id_is_third_party_routing_asset_type/get.pyi +++ b/fireblocks_client/paths/network_connections_connection_id_is_third_party_routing_asset_type/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error + # Path params ConnectionIdSchema = schemas.StrSchema @@ -155,21 +150,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -184,80 +179,42 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _check_third_party_routing_for_network_connection_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _check_third_party_routing_for_network_connection_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _check_third_party_routing_for_network_connection_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _check_third_party_routing_for_network_connection_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _check_third_party_routing_for_network_connection_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Retrieve third-party network routing validation by asset type. - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_connection_id, + request_path_asset_type, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -273,33 +230,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -314,58 +266,8 @@ class BaseApi(api_client.Api): class CheckThirdPartyRoutingForNetworkConnection(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def check_third_party_routing_for_network_connection( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def check_third_party_routing_for_network_connection( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def check_third_party_routing_for_network_connection( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def check_third_party_routing_for_network_connection( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._check_third_party_routing_for_network_connection_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def check_third_party_routing_for_network_connection(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._check_third_party_routing_for_network_connection_oapg(params, request_options) class ApiForget(BaseApi): @@ -417,11 +319,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._check_third_party_routing_for_network_connection_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/network_connections_connection_id_set_routing_policy/patch.py b/fireblocks_client/paths/network_connections_connection_id_set_routing_policy/patch.py index 8c53e531..6d658ce5 100644 --- a/fireblocks_client/paths/network_connections_connection_id_set_routing_policy/patch.py +++ b/fireblocks_client/paths/network_connections_connection_id_set_routing_policy/patch.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -116,19 +110,17 @@ def __new__( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) @@ -198,26 +190,26 @@ def __new__( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -232,21 +224,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -254,86 +246,23 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _set_routing_policy_for_network_connection_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _set_routing_policy_for_network_connection_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _set_routing_policy_for_network_connection_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _set_routing_policy_for_network_connection_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _set_routing_policy_for_network_connection_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _set_routing_policy_for_network_connection_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Update network connection routing policy. - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_connection_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -348,44 +277,38 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='patch'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -400,84 +323,8 @@ class instances class SetRoutingPolicyForNetworkConnection(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def set_routing_policy_for_network_connection( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def set_routing_policy_for_network_connection( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def set_routing_policy_for_network_connection( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def set_routing_policy_for_network_connection( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def set_routing_policy_for_network_connection( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._set_routing_policy_for_network_connection_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def set_routing_policy_for_network_connection(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._set_routing_policy_for_network_connection_oapg(params, request_options) class ApiForpatch(BaseApi): @@ -553,13 +400,13 @@ def patch( skip_deserialization: bool = False, ): return self._set_routing_policy_for_network_connection_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/network_connections_connection_id_set_routing_policy/patch.pyi b/fireblocks_client/paths/network_connections_connection_id_set_routing_policy/patch.pyi index c228ce81..78a67fa5 100644 --- a/fireblocks_client/paths/network_connections_connection_id_set_routing_policy/patch.pyi +++ b/fireblocks_client/paths/network_connections_connection_id_set_routing_policy/patch.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.network_connection_routing_policy import NetworkConnectionRoutingPolicy from fireblocks_client.model.error import Error + # Path params ConnectionIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -114,13 +109,11 @@ class SchemaForRequestBodyApplicationJson( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema @@ -191,21 +184,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -220,104 +213,41 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _set_routing_policy_for_network_connection_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _set_routing_policy_for_network_connection_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _set_routing_policy_for_network_connection_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _set_routing_policy_for_network_connection_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _set_routing_policy_for_network_connection_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _set_routing_policy_for_network_connection_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Update network connection routing policy. - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_connection_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -332,44 +262,38 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='patch'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -384,84 +308,8 @@ class BaseApi(api_client.Api): class SetRoutingPolicyForNetworkConnection(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def set_routing_policy_for_network_connection( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def set_routing_policy_for_network_connection( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def set_routing_policy_for_network_connection( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def set_routing_policy_for_network_connection( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def set_routing_policy_for_network_connection( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._set_routing_policy_for_network_connection_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def set_routing_policy_for_network_connection(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._set_routing_policy_for_network_connection_oapg(params, request_options) class ApiForpatch(BaseApi): @@ -537,13 +385,13 @@ class ApiForpatch(BaseApi): skip_deserialization: bool = False, ): return self._set_routing_policy_for_network_connection_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/network_ids/get.py b/fireblocks_client/paths/network_ids/get.py index a1a4ce90..ebdb2889 100644 --- a/fireblocks_client/paths/network_ids/get.py +++ b/fireblocks_client/paths/network_ids/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -32,9 +26,9 @@ XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) @@ -106,26 +100,26 @@ def __getitem__(self, i: int) -> MetaOapg.items: class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -140,21 +134,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -162,85 +156,39 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_network_ids_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_network_ids_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_network_ids_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_network_ids_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_network_ids_oapg(self, request_options: RequestOptions = None): """ Returns all network IDs, both local IDs and discoverable remote IDs - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -255,53 +203,8 @@ class instances class GetNetworkIds(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_network_ids( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_network_ids( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_network_ids( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_network_ids( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_network_ids_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_network_ids(self , request_options: RequestOptions = None): + return self._get_network_ids_oapg(request_options) class ApiForget(BaseApi): @@ -349,10 +252,10 @@ def get( skip_deserialization: bool = False, ): return self._get_network_ids_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/network_ids/get.pyi b/fireblocks_client/paths/network_ids/get.pyi index 31652ed9..42b3735a 100644 --- a/fireblocks_client/paths/network_ids/get.pyi +++ b/fireblocks_client/paths/network_ids/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.network_id_response import NetworkIdResponse from fireblocks_client.model.error import Error + XRequestIDSchema = schemas.StrSchema @@ -99,21 +94,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -128,103 +123,57 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_network_ids_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_network_ids_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_network_ids_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_network_ids_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_network_ids_oapg(self, request_options: RequestOptions = None): """ Returns all network IDs, both local IDs and discoverable remote IDs - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -239,53 +188,8 @@ class BaseApi(api_client.Api): class GetNetworkIds(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_network_ids( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_network_ids( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_network_ids( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_network_ids( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_network_ids_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_network_ids(self , request_options: RequestOptions = None): + return self._get_network_ids_oapg(request_options) class ApiForget(BaseApi): @@ -333,10 +237,10 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_network_ids_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/network_ids/post.py b/fireblocks_client/paths/network_ids/post.py index 7cc67dc3..fc87c4db 100644 --- a/fireblocks_client/paths/network_ids/post.py +++ b/fireblocks_client/paths/network_ids/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -101,19 +95,17 @@ def __new__( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor201ResponseBody = NetworkIdResponse ResponseHeadersFor201 = typing_extensions.TypedDict( @@ -128,26 +120,26 @@ def __new__( class ApiResponseFor201(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor201ResponseBody, - ] + SchemaFor201ResponseBody, + ] headers: ResponseHeadersFor201 _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, content={ - '*/*': api_client.MediaType( - schema=SchemaFor201ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor201ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -162,21 +154,21 @@ class ApiResponseFor201(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '201': _response_for_201, 'default': _response_for_default, @@ -184,119 +176,49 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_network_id_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _create_network_id_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _create_network_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_network_id_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _create_network_id_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_network_id_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): """ Creates a new Network ID - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -311,78 +233,8 @@ class instances class CreateNetworkId(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create_network_id( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def create_network_id( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def create_network_id( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_network_id( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_network_id( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_network_id_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create_network_id(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): + return self._create_network_id_oapg(params, request_options) class ApiForpost(BaseApi): @@ -453,12 +305,12 @@ def post( skip_deserialization: bool = False, ): return self._create_network_id_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/network_ids/post.pyi b/fireblocks_client/paths/network_ids/post.pyi index 0c5239f6..90531465 100644 --- a/fireblocks_client/paths/network_ids/post.pyi +++ b/fireblocks_client/paths/network_ids/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -29,6 +23,7 @@ from fireblocks_client.model.network_id_response import NetworkIdResponse from fireblocks_client.model.network_id_routing_policy import NetworkIdRoutingPolicy from fireblocks_client.model.error import Error + # body param @@ -99,13 +94,11 @@ class SchemaForRequestBodyApplicationJson( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema SchemaFor201ResponseBody = NetworkIdResponse @@ -121,21 +114,21 @@ ResponseHeadersFor201 = typing_extensions.TypedDict( class ApiResponseFor201(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor201ResponseBody, - ] + SchemaFor201ResponseBody, + ] headers: ResponseHeadersFor201 _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, content={ - '*/*': api_client.MediaType( - schema=SchemaFor201ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor201ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -150,137 +143,67 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_network_id_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _create_network_id_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _create_network_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_network_id_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _create_network_id_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_network_id_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): """ Creates a new Network ID - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -295,78 +218,8 @@ class BaseApi(api_client.Api): class CreateNetworkId(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create_network_id( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def create_network_id( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def create_network_id( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_network_id( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_network_id( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_network_id_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create_network_id(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): + return self._create_network_id_oapg(params, request_options) class ApiForpost(BaseApi): @@ -437,12 +290,12 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._create_network_id_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/network_ids_network_id/delete.py b/fireblocks_client/paths/network_ids_network_id/delete.py index 03047f30..aa63b025 100644 --- a/fireblocks_client/paths/network_ids_network_id/delete.py +++ b/fireblocks_client/paths/network_ids_network_id/delete.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -117,23 +111,23 @@ def __new__( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, -) + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -148,21 +142,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -170,62 +164,23 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _delete_network_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _delete_network_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _delete_network_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _delete_network_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _delete_network_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Deletes specific network ID. - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_network_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -240,33 +195,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='delete'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -281,58 +231,8 @@ class instances class DeleteNetworkId(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def delete_network_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def delete_network_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete_network_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete_network_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_network_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def delete_network_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._delete_network_id_oapg(params, request_options) class ApiFordelete(BaseApi): @@ -384,11 +284,11 @@ def delete( skip_deserialization: bool = False, ): return self._delete_network_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/network_ids_network_id/delete.pyi b/fireblocks_client/paths/network_ids_network_id/delete.pyi index 31cd13fa..ae9126d2 100644 --- a/fireblocks_client/paths/network_ids_network_id/delete.pyi +++ b/fireblocks_client/paths/network_ids_network_id/delete.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error + # Path params NetworkIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -115,18 +110,18 @@ class SchemaFor200ResponseBody( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, -) + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -141,80 +136,41 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _delete_network_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _delete_network_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _delete_network_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _delete_network_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _delete_network_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Deletes specific network ID. - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_network_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -229,33 +185,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='delete'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -270,58 +221,8 @@ class BaseApi(api_client.Api): class DeleteNetworkId(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def delete_network_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def delete_network_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete_network_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete_network_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_network_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def delete_network_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._delete_network_id_oapg(params, request_options) class ApiFordelete(BaseApi): @@ -373,11 +274,11 @@ class ApiFordelete(BaseApi): skip_deserialization: bool = False, ): return self._delete_network_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/network_ids_network_id/get.py b/fireblocks_client/paths/network_ids_network_id/get.py index 511f2ff8..517bed35 100644 --- a/fireblocks_client/paths/network_ids_network_id/get.py +++ b/fireblocks_client/paths/network_ids_network_id/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -58,9 +52,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = NetworkIdResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -75,26 +69,26 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -109,21 +103,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -131,62 +125,23 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_network_id_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_network_id_by_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_network_id_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_network_id_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_network_id_by_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Returns specific network ID. - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_network_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -201,33 +156,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -242,58 +192,8 @@ class instances class GetNetworkIdById(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_network_id_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_network_id_by_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_network_id_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_network_id_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_network_id_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_network_id_by_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_network_id_by_id_oapg(params, request_options) class ApiForget(BaseApi): @@ -345,11 +245,11 @@ def get( skip_deserialization: bool = False, ): return self._get_network_id_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/network_ids_network_id/get.pyi b/fireblocks_client/paths/network_ids_network_id/get.pyi index dc3d83ec..249ebe98 100644 --- a/fireblocks_client/paths/network_ids_network_id/get.pyi +++ b/fireblocks_client/paths/network_ids_network_id/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.network_id_response import NetworkIdResponse from fireblocks_client.model.error import Error + # Path params NetworkIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -68,21 +63,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -97,80 +92,41 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_network_id_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_network_id_by_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_network_id_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_network_id_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_network_id_by_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Returns specific network ID. - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_network_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -185,33 +141,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -226,58 +177,8 @@ class BaseApi(api_client.Api): class GetNetworkIdById(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_network_id_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_network_id_by_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_network_id_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_network_id_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_network_id_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_network_id_by_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_network_id_by_id_oapg(params, request_options) class ApiForget(BaseApi): @@ -329,11 +230,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_network_id_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/network_ids_network_id_set_discoverability/patch.py b/fireblocks_client/paths/network_ids_network_id_set_discoverability/patch.py index 40f93e71..e138ee59 100644 --- a/fireblocks_client/paths/network_ids_network_id_set_discoverability/patch.py +++ b/fireblocks_client/paths/network_ids_network_id_set_discoverability/patch.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -112,20 +106,18 @@ def __new__( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) @@ -195,26 +187,26 @@ def __new__( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -229,21 +221,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -251,86 +243,23 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _set_discoverability_for_network_id_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _set_discoverability_for_network_id_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _set_discoverability_for_network_id_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _set_discoverability_for_network_id_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _set_discoverability_for_network_id_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _set_discoverability_for_network_id_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Update network ID's discoverability. - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_network_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -345,46 +274,42 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(any_type, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='patch'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -399,84 +324,8 @@ class instances class SetDiscoverabilityForNetworkId(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def set_discoverability_for_network_id( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def set_discoverability_for_network_id( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def set_discoverability_for_network_id( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def set_discoverability_for_network_id( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def set_discoverability_for_network_id( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._set_discoverability_for_network_id_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def set_discoverability_for_network_id(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._set_discoverability_for_network_id_oapg(params, request_options) class ApiForpatch(BaseApi): @@ -552,13 +401,13 @@ def patch( skip_deserialization: bool = False, ): return self._set_discoverability_for_network_id_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/network_ids_network_id_set_discoverability/patch.pyi b/fireblocks_client/paths/network_ids_network_id_set_discoverability/patch.pyi index 821585ed..af1c5652 100644 --- a/fireblocks_client/paths/network_ids_network_id_set_discoverability/patch.pyi +++ b/fireblocks_client/paths/network_ids_network_id_set_discoverability/patch.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error + # Path params NetworkIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -110,13 +105,11 @@ class SchemaForRequestBodyApplicationJson( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema @@ -188,21 +181,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -217,104 +210,41 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _set_discoverability_for_network_id_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _set_discoverability_for_network_id_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _set_discoverability_for_network_id_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _set_discoverability_for_network_id_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _set_discoverability_for_network_id_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _set_discoverability_for_network_id_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Update network ID's discoverability. - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_network_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -329,46 +259,42 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(any_type, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='patch'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -383,84 +309,8 @@ class BaseApi(api_client.Api): class SetDiscoverabilityForNetworkId(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def set_discoverability_for_network_id( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def set_discoverability_for_network_id( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def set_discoverability_for_network_id( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def set_discoverability_for_network_id( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def set_discoverability_for_network_id( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._set_discoverability_for_network_id_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def set_discoverability_for_network_id(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._set_discoverability_for_network_id_oapg(params, request_options) class ApiForpatch(BaseApi): @@ -536,13 +386,13 @@ class ApiForpatch(BaseApi): skip_deserialization: bool = False, ): return self._set_discoverability_for_network_id_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/network_ids_network_id_set_name/patch.py b/fireblocks_client/paths/network_ids_network_id_set_name/patch.py index b6733eb5..5f57bd4e 100644 --- a/fireblocks_client/paths/network_ids_network_id_set_name/patch.py +++ b/fireblocks_client/paths/network_ids_network_id_set_name/patch.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -112,20 +106,18 @@ def __new__( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) @@ -195,26 +187,26 @@ def __new__( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -229,21 +221,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -251,86 +243,23 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _set_network_id_name_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _set_network_id_name_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _set_network_id_name_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _set_network_id_name_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _set_network_id_name_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _set_network_id_name_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Update network ID's name. - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_network_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -345,46 +274,42 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(any_type, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='patch'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -399,84 +324,8 @@ class instances class SetNetworkIdName(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def set_network_id_name( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def set_network_id_name( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def set_network_id_name( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def set_network_id_name( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def set_network_id_name( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._set_network_id_name_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def set_network_id_name(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._set_network_id_name_oapg(params, request_options) class ApiForpatch(BaseApi): @@ -552,13 +401,13 @@ def patch( skip_deserialization: bool = False, ): return self._set_network_id_name_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/network_ids_network_id_set_name/patch.pyi b/fireblocks_client/paths/network_ids_network_id_set_name/patch.pyi index 672f52dd..d4c97610 100644 --- a/fireblocks_client/paths/network_ids_network_id_set_name/patch.pyi +++ b/fireblocks_client/paths/network_ids_network_id_set_name/patch.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error + # Path params NetworkIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -110,13 +105,11 @@ class SchemaForRequestBodyApplicationJson( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema @@ -188,21 +181,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -217,104 +210,41 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _set_network_id_name_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _set_network_id_name_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _set_network_id_name_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _set_network_id_name_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _set_network_id_name_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _set_network_id_name_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Update network ID's name. - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_network_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -329,46 +259,42 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(any_type, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='patch'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -383,84 +309,8 @@ class BaseApi(api_client.Api): class SetNetworkIdName(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def set_network_id_name( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def set_network_id_name( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def set_network_id_name( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def set_network_id_name( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def set_network_id_name( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._set_network_id_name_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def set_network_id_name(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._set_network_id_name_oapg(params, request_options) class ApiForpatch(BaseApi): @@ -536,13 +386,13 @@ class ApiForpatch(BaseApi): skip_deserialization: bool = False, ): return self._set_network_id_name_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/network_ids_network_id_set_routing_policy/patch.py b/fireblocks_client/paths/network_ids_network_id_set_routing_policy/patch.py index 5e70e7be..57a90d50 100644 --- a/fireblocks_client/paths/network_ids_network_id_set_routing_policy/patch.py +++ b/fireblocks_client/paths/network_ids_network_id_set_routing_policy/patch.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -116,19 +110,17 @@ def __new__( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) @@ -198,26 +190,26 @@ def __new__( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -232,21 +224,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -254,86 +246,23 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _set_routing_policy_for_network_id_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _set_routing_policy_for_network_id_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _set_routing_policy_for_network_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _set_routing_policy_for_network_id_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _set_routing_policy_for_network_id_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _set_routing_policy_for_network_id_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Update network id routing policy. - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_network_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -348,44 +277,38 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='patch'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -400,84 +323,8 @@ class instances class SetRoutingPolicyForNetworkId(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def set_routing_policy_for_network_id( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def set_routing_policy_for_network_id( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def set_routing_policy_for_network_id( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def set_routing_policy_for_network_id( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def set_routing_policy_for_network_id( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._set_routing_policy_for_network_id_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def set_routing_policy_for_network_id(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._set_routing_policy_for_network_id_oapg(params, request_options) class ApiForpatch(BaseApi): @@ -553,13 +400,13 @@ def patch( skip_deserialization: bool = False, ): return self._set_routing_policy_for_network_id_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/network_ids_network_id_set_routing_policy/patch.pyi b/fireblocks_client/paths/network_ids_network_id_set_routing_policy/patch.pyi index 522deae6..f1deb2f8 100644 --- a/fireblocks_client/paths/network_ids_network_id_set_routing_policy/patch.pyi +++ b/fireblocks_client/paths/network_ids_network_id_set_routing_policy/patch.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.network_id_routing_policy import NetworkIdRoutingPolicy from fireblocks_client.model.error import Error + # Path params NetworkIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -114,13 +109,11 @@ class SchemaForRequestBodyApplicationJson( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema @@ -191,21 +184,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -220,104 +213,41 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _set_routing_policy_for_network_id_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _set_routing_policy_for_network_id_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _set_routing_policy_for_network_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _set_routing_policy_for_network_id_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _set_routing_policy_for_network_id_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _set_routing_policy_for_network_id_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Update network id routing policy. - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_network_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -332,44 +262,38 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='patch'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -384,84 +308,8 @@ class BaseApi(api_client.Api): class SetRoutingPolicyForNetworkId(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def set_routing_policy_for_network_id( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def set_routing_policy_for_network_id( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def set_routing_policy_for_network_id( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def set_routing_policy_for_network_id( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def set_routing_policy_for_network_id( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._set_routing_policy_for_network_id_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def set_routing_policy_for_network_id(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._set_routing_policy_for_network_id_oapg(params, request_options) class ApiForpatch(BaseApi): @@ -537,13 +385,13 @@ class ApiForpatch(BaseApi): skip_deserialization: bool = False, ): return self._set_routing_policy_for_network_id_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/nfts_ownership_collections/get.py b/fireblocks_client/paths/nfts_ownership_collections/get.py index 9cb4f119..32f646ac 100644 --- a/fireblocks_client/paths/nfts_ownership_collections/get.py +++ b/fireblocks_client/paths/nfts_ownership_collections/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -160,9 +154,9 @@ class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams) ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) @@ -265,121 +259,79 @@ def __new__( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _list_owned_collections_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - @typing.overload - def _list_owned_collections_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _list_owned_collections_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _list_owned_collections_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _list_owned_collections_oapg(self, params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): """ List owned collections (paginated) - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["search"] = params.get("search") + query_params["page_cursor"] = params.get("page_cursor") + query_params["page_size"] = params.get("page_size") + query_params["sort"] = params.get("sort") + query_params["order"] = params.get("order") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + used_path = path.value prefix_separator_iterator = None for parameter in ( - request_query_search, - request_query_page_cursor, - request_query_page_size, - request_query_sort, - request_query_order, - ): + request_query_search, + request_query_page_cursor, + request_query_page_size, + request_query_sort, + request_query_order, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -394,56 +346,8 @@ class instances class ListOwnedCollections(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def list_owned_collections( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def list_owned_collections( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def list_owned_collections( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def list_owned_collections( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._list_owned_collections_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def list_owned_collections(self ,params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): + return self._list_owned_collections_oapg(params, request_options) class ApiForget(BaseApi): @@ -493,11 +397,11 @@ def get( skip_deserialization: bool = False, ): return self._list_owned_collections_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/nfts_ownership_collections/get.pyi b/fireblocks_client/paths/nfts_ownership_collections/get.pyi index 0631a188..bf5fe019 100644 --- a/fireblocks_client/paths/nfts_ownership_collections/get.pyi +++ b/fireblocks_client/paths/nfts_ownership_collections/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.paging import Paging from fireblocks_client.model.collection_ownership_response import CollectionOwnershipResponse + # Query params @@ -239,118 +234,76 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _list_owned_collections_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _list_owned_collections_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _list_owned_collections_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _list_owned_collections_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _list_owned_collections_oapg(self, params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): """ List owned collections (paginated) - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["search"] = params.get("search") + query_params["page_cursor"] = params.get("page_cursor") + query_params["page_size"] = params.get("page_size") + query_params["sort"] = params.get("sort") + query_params["order"] = params.get("order") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + used_path = path.value prefix_separator_iterator = None for parameter in ( - request_query_search, - request_query_page_cursor, - request_query_page_size, - request_query_sort, - request_query_order, - ): + request_query_search, + request_query_page_cursor, + request_query_page_size, + request_query_sort, + request_query_order, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -365,56 +318,8 @@ class BaseApi(api_client.Api): class ListOwnedCollections(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def list_owned_collections( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def list_owned_collections( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def list_owned_collections( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def list_owned_collections( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._list_owned_collections_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def list_owned_collections(self ,params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): + return self._list_owned_collections_oapg(params, request_options) class ApiForget(BaseApi): @@ -464,11 +369,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._list_owned_collections_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/nfts_ownership_tokens/get.py b/fireblocks_client/paths/nfts_ownership_tokens/get.py index 187a288b..50d105d0 100644 --- a/fireblocks_client/paths/nfts_ownership_tokens/get.py +++ b/fireblocks_client/paths/nfts_ownership_tokens/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -256,9 +250,9 @@ class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams) ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) @@ -361,126 +355,89 @@ def __new__( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_ownership_tokens_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - @typing.overload - def _get_ownership_tokens_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_ownership_tokens_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_ownership_tokens_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_ownership_tokens_oapg(self, params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): """ List all owned tokens (paginated) - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["blockchain_descriptor"] = params.get("blockchain_descriptor") + query_params["vault_account_ids"] = params.get("vault_account_ids") + query_params["ids"] = params.get("ids") + query_params["collection_ids"] = params.get("collection_ids") + query_params["page_cursor"] = params.get("page_cursor") + query_params["page_size"] = params.get("page_size") + query_params["sort"] = params.get("sort") + query_params["order"] = params.get("order") + query_params["status"] = params.get("status") + query_params["search"] = params.get("search") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + used_path = path.value prefix_separator_iterator = None for parameter in ( - request_query_blockchain_descriptor, - request_query_vault_account_ids, - request_query_ids, - request_query_collection_ids, - request_query_page_cursor, - request_query_page_size, - request_query_sort, - request_query_order, - request_query_status, - request_query_search, - ): + request_query_blockchain_descriptor, + request_query_vault_account_ids, + request_query_ids, + request_query_collection_ids, + request_query_page_cursor, + request_query_page_size, + request_query_sort, + request_query_order, + request_query_status, + request_query_search, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -495,56 +452,8 @@ class instances class GetOwnershipTokens(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_ownership_tokens( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get_ownership_tokens( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_ownership_tokens( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_ownership_tokens( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_ownership_tokens_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_ownership_tokens(self ,params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): + return self._get_ownership_tokens_oapg(params, request_options) class ApiForget(BaseApi): @@ -594,11 +503,11 @@ def get( skip_deserialization: bool = False, ): return self._get_ownership_tokens_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/nfts_ownership_tokens/get.pyi b/fireblocks_client/paths/nfts_ownership_tokens/get.pyi index 211fb7b4..9021f09d 100644 --- a/fireblocks_client/paths/nfts_ownership_tokens/get.pyi +++ b/fireblocks_client/paths/nfts_ownership_tokens/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.paging import Paging from fireblocks_client.model.token_ownership_response import TokenOwnershipResponse + # Query params @@ -316,123 +311,86 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_ownership_tokens_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _get_ownership_tokens_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_ownership_tokens_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_ownership_tokens_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_ownership_tokens_oapg(self, params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): """ List all owned tokens (paginated) - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["blockchain_descriptor"] = params.get("blockchain_descriptor") + query_params["vault_account_ids"] = params.get("vault_account_ids") + query_params["ids"] = params.get("ids") + query_params["collection_ids"] = params.get("collection_ids") + query_params["page_cursor"] = params.get("page_cursor") + query_params["page_size"] = params.get("page_size") + query_params["sort"] = params.get("sort") + query_params["order"] = params.get("order") + query_params["status"] = params.get("status") + query_params["search"] = params.get("search") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + used_path = path.value prefix_separator_iterator = None for parameter in ( - request_query_blockchain_descriptor, - request_query_vault_account_ids, - request_query_ids, - request_query_collection_ids, - request_query_page_cursor, - request_query_page_size, - request_query_sort, - request_query_order, - request_query_status, - request_query_search, - ): + request_query_blockchain_descriptor, + request_query_vault_account_ids, + request_query_ids, + request_query_collection_ids, + request_query_page_cursor, + request_query_page_size, + request_query_sort, + request_query_order, + request_query_status, + request_query_search, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -447,56 +405,8 @@ class BaseApi(api_client.Api): class GetOwnershipTokens(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_ownership_tokens( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get_ownership_tokens( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_ownership_tokens( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_ownership_tokens( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_ownership_tokens_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_ownership_tokens(self ,params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): + return self._get_ownership_tokens_oapg(params, request_options) class ApiForget(BaseApi): @@ -546,11 +456,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_ownership_tokens_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/nfts_ownership_tokens/put.py b/fireblocks_client/paths/nfts_ownership_tokens/put.py index 3643d7f5..7a053e89 100644 --- a/fireblocks_client/paths/nfts_ownership_tokens/put.py +++ b/fireblocks_client/paths/nfts_ownership_tokens/put.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from fireblocks_client import api_client, exceptions @@ -90,9 +84,9 @@ class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams) ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor202 = typing_extensions.TypedDict( 'ResponseHeadersFor202', @@ -112,93 +106,56 @@ class ApiResponseFor202(api_client.ApiResponse): _response_for_202 = api_client.OpenApiResponse( response_cls=ApiResponseFor202, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '202': _response_for_202, } class BaseApi(api_client.Api): - @typing.overload - def _update_ownership_tokens_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor202, - ]: ... - @typing.overload - def _update_ownership_tokens_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_ownership_tokens_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor202, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _update_ownership_tokens_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _update_ownership_tokens_oapg(self, params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): """ Refresh vault account tokens - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["blockchain_descriptor"] = params.get("blockchain_descriptor") + query_params["vault_account_id"] = params.get("vault_account_id") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + used_path = path.value prefix_separator_iterator = None for parameter in ( - request_query_blockchain_descriptor, - request_query_vault_account_id, - ): + request_query_blockchain_descriptor, + request_query_vault_account_id, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - # TODO add cookie handling + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='put'.upper(), - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -213,51 +170,8 @@ class instances class UpdateOwnershipTokens(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def update_ownership_tokens( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor202, - ]: ... - - @typing.overload - def update_ownership_tokens( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_ownership_tokens( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor202, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def update_ownership_tokens( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_ownership_tokens_oapg( - query_params=query_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def update_ownership_tokens(self ,params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): + return self._update_ownership_tokens_oapg(params, request_options) class ApiForput(BaseApi): @@ -303,10 +217,10 @@ def put( skip_deserialization: bool = False, ): return self._update_ownership_tokens_oapg( - query_params=query_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/nfts_ownership_tokens/put.pyi b/fireblocks_client/paths/nfts_ownership_tokens/put.pyi index 1f4e6e8b..210c2948 100644 --- a/fireblocks_client/paths/nfts_ownership_tokens/put.pyi +++ b/fireblocks_client/paths/nfts_ownership_tokens/put.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from fireblocks_client import api_client, exceptions @@ -24,6 +18,7 @@ import frozendict # noqa: F401 from fireblocks_client import schemas # noqa: F401 + # Query params @@ -96,90 +91,53 @@ class ApiResponseFor202(api_client.ApiResponse): _response_for_202 = api_client.OpenApiResponse( response_cls=ApiResponseFor202, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) class BaseApi(api_client.Api): - @typing.overload - def _update_ownership_tokens_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor202, - ]: ... - @typing.overload - def _update_ownership_tokens_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_ownership_tokens_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor202, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _update_ownership_tokens_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _update_ownership_tokens_oapg(self, params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): """ Refresh vault account tokens - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["blockchain_descriptor"] = params.get("blockchain_descriptor") + query_params["vault_account_id"] = params.get("vault_account_id") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + used_path = path.value prefix_separator_iterator = None for parameter in ( - request_query_blockchain_descriptor, - request_query_vault_account_id, - ): + request_query_blockchain_descriptor, + request_query_vault_account_id, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - # TODO add cookie handling + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='put'.upper(), - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -194,51 +152,8 @@ class BaseApi(api_client.Api): class UpdateOwnershipTokens(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def update_ownership_tokens( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor202, - ]: ... - - @typing.overload - def update_ownership_tokens( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_ownership_tokens( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor202, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def update_ownership_tokens( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_ownership_tokens_oapg( - query_params=query_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def update_ownership_tokens(self ,params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): + return self._update_ownership_tokens_oapg(params, request_options) class ApiForput(BaseApi): @@ -284,10 +199,10 @@ class ApiForput(BaseApi): skip_deserialization: bool = False, ): return self._update_ownership_tokens_oapg( - query_params=query_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/nfts_ownership_tokens_id_status/put.py b/fireblocks_client/paths/nfts_ownership_tokens_id_status/put.py index 62b807b1..901b81f9 100644 --- a/fireblocks_client/paths/nfts_ownership_tokens_id_status/put.py +++ b/fireblocks_client/paths/nfts_ownership_tokens_id_status/put.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -57,20 +51,18 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) # body param SchemaForRequestBodyApplicationJson = UpdateTokenOwnershipStatusDto - - request_body_update_token_ownership_status_dto = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor200 = typing_extensions.TypedDict( 'ResponseHeadersFor200', @@ -90,83 +82,28 @@ class ApiResponseFor200(api_client.ApiResponse): _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, } class BaseApi(api_client.Api): - @typing.overload - def _update_token_ownership_status_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _update_token_ownership_status_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _update_token_ownership_status_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _update_token_ownership_status_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _update_token_ownership_status_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _update_token_ownership_status_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): """ Update token ownership status - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -181,39 +118,38 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling + body = params.get(update_token_ownership_status_dto, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_update_token_ownership_status_dto.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_update_token_ownership_status_dto.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='put'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -228,75 +164,8 @@ class instances class UpdateTokenOwnershipStatus(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def update_token_ownership_status( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def update_token_ownership_status( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def update_token_ownership_status( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_token_ownership_status( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def update_token_ownership_status( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_token_ownership_status_oapg( - body=body, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def update_token_ownership_status(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): + return self._update_token_ownership_status_oapg(params, request_options) class ApiForput(BaseApi): @@ -364,12 +233,12 @@ def put( skip_deserialization: bool = False, ): return self._update_token_ownership_status_oapg( - body=body, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/nfts_ownership_tokens_id_status/put.pyi b/fireblocks_client/paths/nfts_ownership_tokens_id_status/put.pyi index 490b4eb9..775648fa 100644 --- a/fireblocks_client/paths/nfts_ownership_tokens_id_status/put.pyi +++ b/fireblocks_client/paths/nfts_ownership_tokens_id_status/put.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.update_token_ownership_status_dto import UpdateTokenOwnershipStatusDto + # Path params IdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -55,13 +50,11 @@ request_path_id = api_client.PathParameter( ) # body param SchemaForRequestBodyApplicationJson = UpdateTokenOwnershipStatusDto - - request_body_update_token_ownership_status_dto = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema @@ -83,80 +76,25 @@ class ApiResponseFor200(api_client.ApiResponse): _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) class BaseApi(api_client.Api): - @typing.overload - def _update_token_ownership_status_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _update_token_ownership_status_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _update_token_ownership_status_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_token_ownership_status_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _update_token_ownership_status_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _update_token_ownership_status_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): """ Update token ownership status - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -171,39 +109,38 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling + body = params.get(update_token_ownership_status_dto, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_update_token_ownership_status_dto.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_update_token_ownership_status_dto.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='put'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -218,75 +155,8 @@ class BaseApi(api_client.Api): class UpdateTokenOwnershipStatus(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def update_token_ownership_status( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def update_token_ownership_status( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def update_token_ownership_status( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_token_ownership_status( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def update_token_ownership_status( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_token_ownership_status_oapg( - body=body, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def update_token_ownership_status(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): + return self._update_token_ownership_status_oapg(params, request_options) class ApiForput(BaseApi): @@ -354,12 +224,12 @@ class ApiForput(BaseApi): skip_deserialization: bool = False, ): return self._update_token_ownership_status_oapg( - body=body, - path_params=path_params, - content_type=content_type, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/nfts_tokens/get.py b/fireblocks_client/paths/nfts_tokens/get.py index c0b167d2..fa235adc 100644 --- a/fireblocks_client/paths/nfts_tokens/get.py +++ b/fireblocks_client/paths/nfts_tokens/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -162,9 +156,9 @@ class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams) ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) @@ -267,121 +261,79 @@ def __new__( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_nfts_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - @typing.overload - def _get_nfts_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_nfts_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_nfts_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_nfts_oapg(self, params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): """ List tokens by IDs - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["ids"] = params.get("ids") + query_params["page_cursor"] = params.get("page_cursor") + query_params["page_size"] = params.get("page_size") + query_params["sort"] = params.get("sort") + query_params["order"] = params.get("order") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + used_path = path.value prefix_separator_iterator = None for parameter in ( - request_query_ids, - request_query_page_cursor, - request_query_page_size, - request_query_sort, - request_query_order, - ): + request_query_ids, + request_query_page_cursor, + request_query_page_size, + request_query_sort, + request_query_order, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -396,56 +348,8 @@ class instances class GetNfts(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_nfts( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get_nfts( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_nfts( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_nfts( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_nfts_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_nfts(self ,params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): + return self._get_nfts_oapg(params, request_options) class ApiForget(BaseApi): @@ -495,11 +399,11 @@ def get( skip_deserialization: bool = False, ): return self._get_nfts_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/nfts_tokens/get.pyi b/fireblocks_client/paths/nfts_tokens/get.pyi index f880627d..8083bb5d 100644 --- a/fireblocks_client/paths/nfts_tokens/get.pyi +++ b/fireblocks_client/paths/nfts_tokens/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.token_response import TokenResponse from fireblocks_client.model.paging import Paging + # Query params IdsSchema = schemas.StrSchema PageCursorSchema = schemas.StrSchema @@ -241,118 +236,76 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_nfts_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _get_nfts_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_nfts_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_nfts_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_nfts_oapg(self, params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): """ List tokens by IDs - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["ids"] = params.get("ids") + query_params["page_cursor"] = params.get("page_cursor") + query_params["page_size"] = params.get("page_size") + query_params["sort"] = params.get("sort") + query_params["order"] = params.get("order") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + used_path = path.value prefix_separator_iterator = None for parameter in ( - request_query_ids, - request_query_page_cursor, - request_query_page_size, - request_query_sort, - request_query_order, - ): + request_query_ids, + request_query_page_cursor, + request_query_page_size, + request_query_sort, + request_query_order, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -367,56 +320,8 @@ class BaseApi(api_client.Api): class GetNfts(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_nfts( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get_nfts( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_nfts( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_nfts( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_nfts_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_nfts(self ,params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): + return self._get_nfts_oapg(params, request_options) class ApiForget(BaseApi): @@ -466,11 +371,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_nfts_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/nfts_tokens_id/get.py b/fireblocks_client/paths/nfts_tokens_id/get.py index 4fbbdae7..bc0e0882 100644 --- a/fireblocks_client/paths/nfts_tokens_id/get.py +++ b/fireblocks_client/paths/nfts_tokens_id/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -57,9 +51,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBodyApplicationJson = TokenResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -74,80 +68,43 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_nft_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _get_nft_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_nft_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_nft_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_nft_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ List token data by ID - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -162,29 +119,24 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -199,56 +151,8 @@ class instances class GetNft(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_nft( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get_nft( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_nft( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_nft( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_nft_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_nft(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_nft_oapg(params, request_options) class ApiForget(BaseApi): @@ -298,11 +202,11 @@ def get( skip_deserialization: bool = False, ): return self._get_nft_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/nfts_tokens_id/get.pyi b/fireblocks_client/paths/nfts_tokens_id/get.pyi index 040cdda3..bb506112 100644 --- a/fireblocks_client/paths/nfts_tokens_id/get.pyi +++ b/fireblocks_client/paths/nfts_tokens_id/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.token_response import TokenResponse + # Path params IdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -67,77 +62,40 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_nft_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - @typing.overload - def _get_nft_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_nft_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_nft_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_nft_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ List token data by ID - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -152,29 +110,24 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -189,56 +142,8 @@ class BaseApi(api_client.Api): class GetNft(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_nft( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get_nft( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_nft( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_nft( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_nft_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_nft(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_nft_oapg(params, request_options) class ApiForget(BaseApi): @@ -288,11 +193,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_nft_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/nfts_tokens_id/put.py b/fireblocks_client/paths/nfts_tokens_id/put.py index 5971d5ab..ceeb7586 100644 --- a/fireblocks_client/paths/nfts_tokens_id/put.py +++ b/fireblocks_client/paths/nfts_tokens_id/put.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from fireblocks_client import api_client, exceptions @@ -54,9 +48,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor202 = typing_extensions.TypedDict( 'ResponseHeadersFor202', @@ -76,61 +70,28 @@ class ApiResponseFor202(api_client.ApiResponse): _response_for_202 = api_client.OpenApiResponse( response_cls=ApiResponseFor202, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '202': _response_for_202, } class BaseApi(api_client.Api): - @typing.overload - def _refresh_nft_metadata_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor202, - ]: ... - - @typing.overload - def _refresh_nft_metadata_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _refresh_nft_metadata_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor202, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _refresh_nft_metadata_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _refresh_nft_metadata_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Refresh token metadata - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -145,23 +106,22 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - # TODO add cookie handling + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='put'.upper(), - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -176,51 +136,8 @@ class instances class RefreshNftMetadata(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def refresh_nft_metadata( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor202, - ]: ... - - @typing.overload - def refresh_nft_metadata( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def refresh_nft_metadata( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor202, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def refresh_nft_metadata( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._refresh_nft_metadata_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def refresh_nft_metadata(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._refresh_nft_metadata_oapg(params, request_options) class ApiForput(BaseApi): @@ -266,10 +183,10 @@ def put( skip_deserialization: bool = False, ): return self._refresh_nft_metadata_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/nfts_tokens_id/put.pyi b/fireblocks_client/paths/nfts_tokens_id/put.pyi index f904baac..b776b37d 100644 --- a/fireblocks_client/paths/nfts_tokens_id/put.pyi +++ b/fireblocks_client/paths/nfts_tokens_id/put.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from fireblocks_client import api_client, exceptions @@ -24,6 +18,7 @@ import frozendict # noqa: F401 from fireblocks_client import schemas # noqa: F401 + # Path params IdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -69,58 +64,25 @@ class ApiResponseFor202(api_client.ApiResponse): _response_for_202 = api_client.OpenApiResponse( response_cls=ApiResponseFor202, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) class BaseApi(api_client.Api): - @typing.overload - def _refresh_nft_metadata_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor202, - ]: ... - @typing.overload - def _refresh_nft_metadata_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _refresh_nft_metadata_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor202, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _refresh_nft_metadata_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _refresh_nft_metadata_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Refresh token metadata - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -135,23 +97,22 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - # TODO add cookie handling + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='put'.upper(), - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -166,51 +127,8 @@ class BaseApi(api_client.Api): class RefreshNftMetadata(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def refresh_nft_metadata( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor202, - ]: ... - - @typing.overload - def refresh_nft_metadata( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def refresh_nft_metadata( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor202, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def refresh_nft_metadata( - self, - path_params: RequestPathParams = frozendict.frozendict(), - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._refresh_nft_metadata_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def refresh_nft_metadata(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._refresh_nft_metadata_oapg(params, request_options) class ApiForput(BaseApi): @@ -256,10 +174,10 @@ class ApiForput(BaseApi): skip_deserialization: bool = False, ): return self._refresh_nft_metadata_oapg( - path_params=path_params, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/off_exchange_add/post.py b/fireblocks_client/paths/off_exchange_add/post.py index d96a445a..c8654abf 100644 --- a/fireblocks_client/paths/off_exchange_add/post.py +++ b/fireblocks_client/paths/off_exchange_add/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -33,13 +27,11 @@ # body param SchemaForRequestBodyApplicationJson = AddCollateralRequestBody - - request_body_add_collateral_request_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) SchemaFor200ResponseBody = CreateTransactionResponse @@ -48,23 +40,23 @@ class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, -) + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -79,21 +71,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -101,119 +93,49 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _add_off_exchange_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _add_off_exchange_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _add_off_exchange_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _add_off_exchange_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _add_off_exchange_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _add_off_exchange_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): """ add collateral - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_add_collateral_request_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_add_collateral_request_body.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -228,78 +150,8 @@ class instances class AddOffExchange(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def add_off_exchange( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def add_off_exchange( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def add_off_exchange( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def add_off_exchange( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def add_off_exchange( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._add_off_exchange_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def add_off_exchange(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): + return self._add_off_exchange_oapg(params, request_options) class ApiForpost(BaseApi): @@ -370,12 +222,12 @@ def post( skip_deserialization: bool = False, ): return self._add_off_exchange_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/off_exchange_add/post.pyi b/fireblocks_client/paths/off_exchange_add/post.pyi index cff11375..c74863ff 100644 --- a/fireblocks_client/paths/off_exchange_add/post.pyi +++ b/fireblocks_client/paths/off_exchange_add/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -29,15 +23,14 @@ from fireblocks_client.model.add_collateral_request_body import AddCollateralReq from fireblocks_client.model.error import Error from fireblocks_client.model.create_transaction_response import CreateTransactionResponse + # body param SchemaForRequestBodyApplicationJson = AddCollateralRequestBody - - request_body_add_collateral_request_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) SchemaFor200ResponseBody = CreateTransactionResponse @@ -46,18 +39,18 @@ SchemaFor200ResponseBody = CreateTransactionResponse class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, -) + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -72,137 +65,67 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _add_off_exchange_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _add_off_exchange_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _add_off_exchange_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _add_off_exchange_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _add_off_exchange_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _add_off_exchange_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): """ add collateral - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_add_collateral_request_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_add_collateral_request_body.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -217,78 +140,8 @@ class BaseApi(api_client.Api): class AddOffExchange(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def add_off_exchange( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def add_off_exchange( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def add_off_exchange( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def add_off_exchange( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def add_off_exchange( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._add_off_exchange_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def add_off_exchange(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): + return self._add_off_exchange_oapg(params, request_options) class ApiForpost(BaseApi): @@ -359,12 +212,12 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._add_off_exchange_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/off_exchange_collateral_accounts_main_exchange_account_id/get.py b/fireblocks_client/paths/off_exchange_collateral_accounts_main_exchange_account_id/get.py index c1a14924..e1188dab 100644 --- a/fireblocks_client/paths/off_exchange_collateral_accounts_main_exchange_account_id/get.py +++ b/fireblocks_client/paths/off_exchange_collateral_accounts_main_exchange_account_id/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -58,9 +52,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = ExchangeAccount ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -75,26 +69,26 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -109,21 +103,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -131,62 +125,23 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_off_exchange_collateral_accounts_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_off_exchange_collateral_accounts_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_off_exchange_collateral_accounts_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_off_exchange_collateral_accounts_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_off_exchange_collateral_accounts_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Find a specific collateral exchange account - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_main_exchange_account_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -201,33 +156,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -242,58 +192,8 @@ class instances class GetOffExchangeCollateralAccounts(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_off_exchange_collateral_accounts( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_off_exchange_collateral_accounts( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_off_exchange_collateral_accounts( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_off_exchange_collateral_accounts( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_off_exchange_collateral_accounts_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_off_exchange_collateral_accounts(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_off_exchange_collateral_accounts_oapg(params, request_options) class ApiForget(BaseApi): @@ -345,11 +245,11 @@ def get( skip_deserialization: bool = False, ): return self._get_off_exchange_collateral_accounts_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/off_exchange_collateral_accounts_main_exchange_account_id/get.pyi b/fireblocks_client/paths/off_exchange_collateral_accounts_main_exchange_account_id/get.pyi index 707723fb..505ebcb8 100644 --- a/fireblocks_client/paths/off_exchange_collateral_accounts_main_exchange_account_id/get.pyi +++ b/fireblocks_client/paths/off_exchange_collateral_accounts_main_exchange_account_id/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.exchange_account import ExchangeAccount from fireblocks_client.model.error import Error + # Path params MainExchangeAccountIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -68,21 +63,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -97,80 +92,41 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_off_exchange_collateral_accounts_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_off_exchange_collateral_accounts_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_off_exchange_collateral_accounts_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_off_exchange_collateral_accounts_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_off_exchange_collateral_accounts_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Find a specific collateral exchange account - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_main_exchange_account_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -185,33 +141,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -226,58 +177,8 @@ class BaseApi(api_client.Api): class GetOffExchangeCollateralAccounts(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_off_exchange_collateral_accounts( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_off_exchange_collateral_accounts( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_off_exchange_collateral_accounts( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_off_exchange_collateral_accounts( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_off_exchange_collateral_accounts_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_off_exchange_collateral_accounts(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_off_exchange_collateral_accounts_oapg(params, request_options) class ApiForget(BaseApi): @@ -329,11 +230,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_off_exchange_collateral_accounts_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/off_exchange_remove/post.py b/fireblocks_client/paths/off_exchange_remove/post.py index ac4d0dc3..4f2af153 100644 --- a/fireblocks_client/paths/off_exchange_remove/post.py +++ b/fireblocks_client/paths/off_exchange_remove/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -33,13 +27,11 @@ # body param SchemaForRequestBodyApplicationJson = RemoveCollateralRequestBody - - request_body_remove_collateral_request_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) SchemaFor200ResponseBody = CreateTransactionResponse @@ -48,23 +40,23 @@ class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, -) + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -79,21 +71,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -101,119 +93,49 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _remove_off_exchange_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _remove_off_exchange_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _remove_off_exchange_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _remove_off_exchange_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _remove_off_exchange_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _remove_off_exchange_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): """ remove collateral - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_remove_collateral_request_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_remove_collateral_request_body.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -228,78 +150,8 @@ class instances class RemoveOffExchange(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def remove_off_exchange( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def remove_off_exchange( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def remove_off_exchange( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def remove_off_exchange( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def remove_off_exchange( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._remove_off_exchange_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def remove_off_exchange(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): + return self._remove_off_exchange_oapg(params, request_options) class ApiForpost(BaseApi): @@ -370,12 +222,12 @@ def post( skip_deserialization: bool = False, ): return self._remove_off_exchange_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/off_exchange_remove/post.pyi b/fireblocks_client/paths/off_exchange_remove/post.pyi index 2615a434..42f44a6c 100644 --- a/fireblocks_client/paths/off_exchange_remove/post.pyi +++ b/fireblocks_client/paths/off_exchange_remove/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -29,15 +23,14 @@ from fireblocks_client.model.remove_collateral_request_body import RemoveCollate from fireblocks_client.model.error import Error from fireblocks_client.model.create_transaction_response import CreateTransactionResponse + # body param SchemaForRequestBodyApplicationJson = RemoveCollateralRequestBody - - request_body_remove_collateral_request_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) SchemaFor200ResponseBody = CreateTransactionResponse @@ -46,18 +39,18 @@ SchemaFor200ResponseBody = CreateTransactionResponse class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, -) + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -72,137 +65,67 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _remove_off_exchange_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _remove_off_exchange_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _remove_off_exchange_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _remove_off_exchange_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _remove_off_exchange_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _remove_off_exchange_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): """ remove collateral - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_remove_collateral_request_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_remove_collateral_request_body.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -217,78 +140,8 @@ class BaseApi(api_client.Api): class RemoveOffExchange(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def remove_off_exchange( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def remove_off_exchange( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def remove_off_exchange( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def remove_off_exchange( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def remove_off_exchange( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._remove_off_exchange_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def remove_off_exchange(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): + return self._remove_off_exchange_oapg(params, request_options) class ApiForpost(BaseApi): @@ -359,12 +212,12 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._remove_off_exchange_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/off_exchange_settlements_trader/post.py b/fireblocks_client/paths/off_exchange_settlements_trader/post.py index da9b7231..f34cbf1d 100644 --- a/fireblocks_client/paths/off_exchange_settlements_trader/post.py +++ b/fireblocks_client/paths/off_exchange_settlements_trader/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -33,13 +27,11 @@ # body param SchemaForRequestBodyApplicationJson = SettlementRequestBody - - request_body_settlement_request_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) SchemaFor201ResponseBody = SettlementResponse @@ -48,23 +40,23 @@ class ApiResponseFor201(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor201ResponseBody, - ] + SchemaFor201ResponseBody, + ] headers: schemas.Unset = schemas.unset _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, content={ - '*/*': api_client.MediaType( - schema=SchemaFor201ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor201ResponseBody), }, -) + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -79,21 +71,21 @@ class ApiResponseFor201(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '201': _response_for_201, 'default': _response_for_default, @@ -101,119 +93,49 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _settle_off_exchange_trades_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _settle_off_exchange_trades_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _settle_off_exchange_trades_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _settle_off_exchange_trades_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _settle_off_exchange_trades_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _settle_off_exchange_trades_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): """ create settlement for a trader - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_settlement_request_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_settlement_request_body.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -228,78 +150,8 @@ class instances class SettleOffExchangeTrades(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def settle_off_exchange_trades( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def settle_off_exchange_trades( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def settle_off_exchange_trades( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def settle_off_exchange_trades( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def settle_off_exchange_trades( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._settle_off_exchange_trades_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def settle_off_exchange_trades(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): + return self._settle_off_exchange_trades_oapg(params, request_options) class ApiForpost(BaseApi): @@ -370,12 +222,12 @@ def post( skip_deserialization: bool = False, ): return self._settle_off_exchange_trades_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/off_exchange_settlements_trader/post.pyi b/fireblocks_client/paths/off_exchange_settlements_trader/post.pyi index 315d57bd..1181ad76 100644 --- a/fireblocks_client/paths/off_exchange_settlements_trader/post.pyi +++ b/fireblocks_client/paths/off_exchange_settlements_trader/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -29,15 +23,14 @@ from fireblocks_client.model.settlement_request_body import SettlementRequestBod from fireblocks_client.model.error import Error from fireblocks_client.model.settlement_response import SettlementResponse + # body param SchemaForRequestBodyApplicationJson = SettlementRequestBody - - request_body_settlement_request_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) SchemaFor201ResponseBody = SettlementResponse @@ -46,18 +39,18 @@ SchemaFor201ResponseBody = SettlementResponse class ApiResponseFor201(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor201ResponseBody, - ] + SchemaFor201ResponseBody, + ] headers: schemas.Unset = schemas.unset _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, content={ - '*/*': api_client.MediaType( - schema=SchemaFor201ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor201ResponseBody), }, -) + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -72,137 +65,67 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _settle_off_exchange_trades_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _settle_off_exchange_trades_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _settle_off_exchange_trades_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _settle_off_exchange_trades_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _settle_off_exchange_trades_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _settle_off_exchange_trades_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): """ create settlement for a trader - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_settlement_request_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_settlement_request_body.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -217,78 +140,8 @@ class BaseApi(api_client.Api): class SettleOffExchangeTrades(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def settle_off_exchange_trades( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def settle_off_exchange_trades( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def settle_off_exchange_trades( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def settle_off_exchange_trades( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def settle_off_exchange_trades( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._settle_off_exchange_trades_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def settle_off_exchange_trades(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): + return self._settle_off_exchange_trades_oapg(params, request_options) class ApiForpost(BaseApi): @@ -359,12 +212,12 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._settle_off_exchange_trades_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/off_exchange_settlements_transactions/get.py b/fireblocks_client/paths/off_exchange_settlements_transactions/get.py index 25104f15..46c5cbb0 100644 --- a/fireblocks_client/paths/off_exchange_settlements_transactions/get.py +++ b/fireblocks_client/paths/off_exchange_settlements_transactions/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -64,23 +58,23 @@ class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams) class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, -) + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -95,21 +89,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -117,103 +111,55 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_off_exchange_settlement_transactions_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_off_exchange_settlement_transactions_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_off_exchange_settlement_transactions_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_off_exchange_settlement_transactions_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_off_exchange_settlement_transactions_oapg(self, params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): """ get settlements transactions from exchange - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["main_exchange_account_id"] = params.get("main_exchange_account_id") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + used_path = path.value prefix_separator_iterator = None for parameter in ( - request_query_main_exchange_account_id, - ): + request_query_main_exchange_account_id, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -228,58 +174,8 @@ class instances class GetOffExchangeSettlementTransactions(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_off_exchange_settlement_transactions( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_off_exchange_settlement_transactions( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_off_exchange_settlement_transactions( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_off_exchange_settlement_transactions( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_off_exchange_settlement_transactions_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_off_exchange_settlement_transactions(self ,params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): + return self._get_off_exchange_settlement_transactions_oapg(params, request_options) class ApiForget(BaseApi): @@ -331,11 +227,11 @@ def get( skip_deserialization: bool = False, ): return self._get_off_exchange_settlement_transactions_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/off_exchange_settlements_transactions/get.pyi b/fireblocks_client/paths/off_exchange_settlements_transactions/get.pyi index 51172d33..70f55361 100644 --- a/fireblocks_client/paths/off_exchange_settlements_transactions/get.pyi +++ b/fireblocks_client/paths/off_exchange_settlements_transactions/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error from fireblocks_client.model.settlement_response import SettlementResponse + # Query params MainExchangeAccountIdSchema = schemas.StrSchema RequestRequiredQueryParams = typing_extensions.TypedDict( @@ -62,18 +57,18 @@ SchemaFor200ResponseBody = SettlementResponse class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, -) + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -88,121 +83,73 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_off_exchange_settlement_transactions_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_off_exchange_settlement_transactions_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_off_exchange_settlement_transactions_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_off_exchange_settlement_transactions_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_off_exchange_settlement_transactions_oapg(self, params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): """ get settlements transactions from exchange - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["main_exchange_account_id"] = params.get("main_exchange_account_id") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + used_path = path.value prefix_separator_iterator = None for parameter in ( - request_query_main_exchange_account_id, - ): + request_query_main_exchange_account_id, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -217,58 +164,8 @@ class BaseApi(api_client.Api): class GetOffExchangeSettlementTransactions(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_off_exchange_settlement_transactions( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_off_exchange_settlement_transactions( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_off_exchange_settlement_transactions( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_off_exchange_settlement_transactions( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_off_exchange_settlement_transactions_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_off_exchange_settlement_transactions(self ,params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): + return self._get_off_exchange_settlement_transactions_oapg(params, request_options) class ApiForget(BaseApi): @@ -320,11 +217,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_off_exchange_settlement_transactions_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/payments_payout/post.py b/fireblocks_client/paths/payments_payout/post.py index 7d5819a6..84cb0ea3 100644 --- a/fireblocks_client/paths/payments_payout/post.py +++ b/fireblocks_client/paths/payments_payout/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -33,13 +27,11 @@ # body param SchemaForRequestBodyApplicationJson = CreatePayoutRequest - - request_body_create_payout_request = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) SchemaFor200ResponseBodyApplicationJson = PayoutResponse @@ -48,18 +40,18 @@ class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) SchemaFor400ResponseBodyApplicationJson = ErrorResponse @@ -67,18 +59,18 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseFor400(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor400ResponseBodyApplicationJson, - ] + SchemaFor400ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_400 = api_client.OpenApiResponse( response_cls=ApiResponseFor400, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor400ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor400ResponseBodyApplicationJson), }, -) + ) SchemaFor401ResponseBodyApplicationJson = ErrorResponse @@ -86,18 +78,18 @@ class ApiResponseFor400(api_client.ApiResponse): class ApiResponseFor401(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor401ResponseBodyApplicationJson, - ] + SchemaFor401ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_401 = api_client.OpenApiResponse( response_cls=ApiResponseFor401, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor401ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor401ResponseBodyApplicationJson), }, -) + ) SchemaFor5XXResponseBodyApplicationJson = ErrorResponse @@ -105,18 +97,18 @@ class ApiResponseFor401(api_client.ApiResponse): class ApiResponseFor5XX(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor5XXResponseBodyApplicationJson, - ] + SchemaFor5XXResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_5XX = api_client.OpenApiResponse( response_cls=ApiResponseFor5XX, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor5XXResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor5XXResponseBodyApplicationJson), }, -) + ) _status_code_to_response = { '200': _response_for_200, '400': _response_for_400, @@ -125,112 +117,45 @@ class ApiResponseFor5XX(api_client.ApiResponse): } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_payout_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - @typing.overload - def _create_payout_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _create_payout_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_payout_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _create_payout_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_payout_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): """ Create a payout instruction set - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_create_payout_request.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_create_payout_request.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -245,75 +170,8 @@ class instances class CreatePayout(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create_payout( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def create_payout( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def create_payout( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_payout( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_payout( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_payout_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create_payout(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): + return self._create_payout_oapg(params, request_options) class ApiForpost(BaseApi): @@ -381,12 +239,12 @@ def post( skip_deserialization: bool = False, ): return self._create_payout_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/payments_payout/post.pyi b/fireblocks_client/paths/payments_payout/post.pyi index 0dfc051a..ad8cc688 100644 --- a/fireblocks_client/paths/payments_payout/post.pyi +++ b/fireblocks_client/paths/payments_payout/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -29,15 +23,14 @@ from fireblocks_client.model.payout_response import PayoutResponse from fireblocks_client.model.error_response import ErrorResponse from fireblocks_client.model.create_payout_request import CreatePayoutRequest + # body param SchemaForRequestBodyApplicationJson = CreatePayoutRequest - - request_body_create_payout_request = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) SchemaFor200ResponseBodyApplicationJson = PayoutResponse @@ -46,18 +39,18 @@ SchemaFor200ResponseBodyApplicationJson = PayoutResponse class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) SchemaFor400ResponseBodyApplicationJson = ErrorResponse @@ -65,18 +58,18 @@ SchemaFor400ResponseBodyApplicationJson = ErrorResponse class ApiResponseFor400(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor400ResponseBodyApplicationJson, - ] + SchemaFor400ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_400 = api_client.OpenApiResponse( response_cls=ApiResponseFor400, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor400ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor400ResponseBodyApplicationJson), }, -) + ) SchemaFor401ResponseBodyApplicationJson = ErrorResponse @@ -84,18 +77,18 @@ SchemaFor401ResponseBodyApplicationJson = ErrorResponse class ApiResponseFor401(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor401ResponseBodyApplicationJson, - ] + SchemaFor401ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_401 = api_client.OpenApiResponse( response_cls=ApiResponseFor401, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor401ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor401ResponseBodyApplicationJson), }, -) + ) SchemaFor5XXResponseBodyApplicationJson = ErrorResponse @@ -103,126 +96,59 @@ SchemaFor5XXResponseBodyApplicationJson = ErrorResponse class ApiResponseFor5XX(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor5XXResponseBodyApplicationJson, - ] + SchemaFor5XXResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_5XX = api_client.OpenApiResponse( response_cls=ApiResponseFor5XX, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor5XXResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor5XXResponseBodyApplicationJson), }, -) + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_payout_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - @typing.overload - def _create_payout_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _create_payout_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_payout_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _create_payout_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_payout_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): """ Create a payout instruction set - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_create_payout_request.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_create_payout_request.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -237,75 +163,8 @@ class BaseApi(api_client.Api): class CreatePayout(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create_payout( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def create_payout( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def create_payout( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_payout( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_payout( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_payout_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create_payout(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): + return self._create_payout_oapg(params, request_options) class ApiForpost(BaseApi): @@ -373,12 +232,12 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._create_payout_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/payments_payout_payout_id/get.py b/fireblocks_client/paths/payments_payout_payout_id/get.py index 8fe5be88..6331dbaa 100644 --- a/fireblocks_client/paths/payments_payout_payout_id/get.py +++ b/fireblocks_client/paths/payments_payout_payout_id/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -63,18 +57,18 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) SchemaFor404ResponseBodyApplicationJson = ErrorResponse @@ -82,18 +76,18 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseFor404(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor404ResponseBodyApplicationJson, - ] + SchemaFor404ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_404 = api_client.OpenApiResponse( response_cls=ApiResponseFor404, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor404ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor404ResponseBodyApplicationJson), }, -) + ) SchemaFor401ResponseBodyApplicationJson = ErrorResponse @@ -101,18 +95,18 @@ class ApiResponseFor404(api_client.ApiResponse): class ApiResponseFor401(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor401ResponseBodyApplicationJson, - ] + SchemaFor401ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_401 = api_client.OpenApiResponse( response_cls=ApiResponseFor401, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor401ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor401ResponseBodyApplicationJson), }, -) + ) SchemaFor5XXResponseBodyApplicationJson = ErrorResponse @@ -120,18 +114,18 @@ class ApiResponseFor401(api_client.ApiResponse): class ApiResponseFor5XX(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor5XXResponseBodyApplicationJson, - ] + SchemaFor5XXResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_5XX = api_client.OpenApiResponse( response_cls=ApiResponseFor5XX, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor5XXResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor5XXResponseBodyApplicationJson), }, -) + ) _status_code_to_response = { '200': _response_for_200, '404': _response_for_404, @@ -140,60 +134,23 @@ class ApiResponseFor5XX(api_client.ApiResponse): } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_payout_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _get_payout_by_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_payout_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_payout_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_payout_by_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Get the status of a payout instruction set - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_payout_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -208,29 +165,24 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -245,56 +197,8 @@ class instances class GetPayoutById(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_payout_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get_payout_by_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_payout_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_payout_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_payout_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_payout_by_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_payout_by_id_oapg(params, request_options) class ApiForget(BaseApi): @@ -344,11 +248,11 @@ def get( skip_deserialization: bool = False, ): return self._get_payout_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/payments_payout_payout_id/get.pyi b/fireblocks_client/paths/payments_payout_payout_id/get.pyi index a955721c..2f1a12c7 100644 --- a/fireblocks_client/paths/payments_payout_payout_id/get.pyi +++ b/fireblocks_client/paths/payments_payout_payout_id/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.payout_response import PayoutResponse from fireblocks_client.model.error_response import ErrorResponse + # Path params PayoutIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -61,18 +56,18 @@ SchemaFor200ResponseBodyApplicationJson = PayoutResponse class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) SchemaFor404ResponseBodyApplicationJson = ErrorResponse @@ -80,18 +75,18 @@ SchemaFor404ResponseBodyApplicationJson = ErrorResponse class ApiResponseFor404(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor404ResponseBodyApplicationJson, - ] + SchemaFor404ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_404 = api_client.OpenApiResponse( response_cls=ApiResponseFor404, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor404ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor404ResponseBodyApplicationJson), }, -) + ) SchemaFor401ResponseBodyApplicationJson = ErrorResponse @@ -99,18 +94,18 @@ SchemaFor401ResponseBodyApplicationJson = ErrorResponse class ApiResponseFor401(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor401ResponseBodyApplicationJson, - ] + SchemaFor401ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_401 = api_client.OpenApiResponse( response_cls=ApiResponseFor401, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor401ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor401ResponseBodyApplicationJson), }, -) + ) SchemaFor5XXResponseBodyApplicationJson = ErrorResponse @@ -118,74 +113,37 @@ SchemaFor5XXResponseBodyApplicationJson = ErrorResponse class ApiResponseFor5XX(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor5XXResponseBodyApplicationJson, - ] + SchemaFor5XXResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_5XX = api_client.OpenApiResponse( response_cls=ApiResponseFor5XX, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor5XXResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor5XXResponseBodyApplicationJson), }, -) + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_payout_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _get_payout_by_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_payout_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_payout_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_payout_by_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Get the status of a payout instruction set - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_payout_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -200,29 +158,24 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -237,56 +190,8 @@ class BaseApi(api_client.Api): class GetPayoutById(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_payout_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get_payout_by_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_payout_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_payout_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_payout_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_payout_by_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_payout_by_id_oapg(params, request_options) class ApiForget(BaseApi): @@ -336,11 +241,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_payout_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/payments_payout_payout_id_actions_execute/post.py b/fireblocks_client/paths/payments_payout_payout_id_actions_execute/post.py index d7c85df6..a5bdfb2b 100644 --- a/fireblocks_client/paths/payments_payout_payout_id_actions_execute/post.py +++ b/fireblocks_client/paths/payments_payout_payout_id_actions_execute/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -63,18 +57,18 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) SchemaFor400ResponseBodyApplicationJson = ErrorResponse @@ -82,18 +76,18 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseFor400(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor400ResponseBodyApplicationJson, - ] + SchemaFor400ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_400 = api_client.OpenApiResponse( response_cls=ApiResponseFor400, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor400ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor400ResponseBodyApplicationJson), }, -) + ) SchemaFor401ResponseBodyApplicationJson = ErrorResponse @@ -101,18 +95,18 @@ class ApiResponseFor400(api_client.ApiResponse): class ApiResponseFor401(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor401ResponseBodyApplicationJson, - ] + SchemaFor401ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_401 = api_client.OpenApiResponse( response_cls=ApiResponseFor401, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor401ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor401ResponseBodyApplicationJson), }, -) + ) SchemaFor5XXResponseBodyApplicationJson = ErrorResponse @@ -120,18 +114,18 @@ class ApiResponseFor401(api_client.ApiResponse): class ApiResponseFor5XX(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor5XXResponseBodyApplicationJson, - ] + SchemaFor5XXResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_5XX = api_client.OpenApiResponse( response_cls=ApiResponseFor5XX, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor5XXResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor5XXResponseBodyApplicationJson), }, -) + ) _status_code_to_response = { '200': _response_for_200, '400': _response_for_400, @@ -140,60 +134,23 @@ class ApiResponseFor5XX(api_client.ApiResponse): } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _execute_payout_action_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _execute_payout_action_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _execute_payout_action_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _execute_payout_action_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _execute_payout_action_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Execute a payout instruction set - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_payout_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -208,29 +165,24 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -245,56 +197,8 @@ class instances class ExecutePayoutAction(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def execute_payout_action( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def execute_payout_action( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def execute_payout_action( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def execute_payout_action( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._execute_payout_action_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def execute_payout_action(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._execute_payout_action_oapg(params, request_options) class ApiForpost(BaseApi): @@ -344,11 +248,11 @@ def post( skip_deserialization: bool = False, ): return self._execute_payout_action_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/payments_payout_payout_id_actions_execute/post.pyi b/fireblocks_client/paths/payments_payout_payout_id_actions_execute/post.pyi index 6968c763..26cff3c7 100644 --- a/fireblocks_client/paths/payments_payout_payout_id_actions_execute/post.pyi +++ b/fireblocks_client/paths/payments_payout_payout_id_actions_execute/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error_response import ErrorResponse from fireblocks_client.model.dispatch_payout_response import DispatchPayoutResponse + # Path params PayoutIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -61,18 +56,18 @@ SchemaFor200ResponseBodyApplicationJson = DispatchPayoutResponse class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) SchemaFor400ResponseBodyApplicationJson = ErrorResponse @@ -80,18 +75,18 @@ SchemaFor400ResponseBodyApplicationJson = ErrorResponse class ApiResponseFor400(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor400ResponseBodyApplicationJson, - ] + SchemaFor400ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_400 = api_client.OpenApiResponse( response_cls=ApiResponseFor400, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor400ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor400ResponseBodyApplicationJson), }, -) + ) SchemaFor401ResponseBodyApplicationJson = ErrorResponse @@ -99,18 +94,18 @@ SchemaFor401ResponseBodyApplicationJson = ErrorResponse class ApiResponseFor401(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor401ResponseBodyApplicationJson, - ] + SchemaFor401ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_401 = api_client.OpenApiResponse( response_cls=ApiResponseFor401, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor401ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor401ResponseBodyApplicationJson), }, -) + ) SchemaFor5XXResponseBodyApplicationJson = ErrorResponse @@ -118,74 +113,37 @@ SchemaFor5XXResponseBodyApplicationJson = ErrorResponse class ApiResponseFor5XX(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor5XXResponseBodyApplicationJson, - ] + SchemaFor5XXResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_5XX = api_client.OpenApiResponse( response_cls=ApiResponseFor5XX, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor5XXResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor5XXResponseBodyApplicationJson), }, -) + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _execute_payout_action_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _execute_payout_action_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _execute_payout_action_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _execute_payout_action_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _execute_payout_action_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Execute a payout instruction set - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_payout_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -200,29 +158,24 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -237,56 +190,8 @@ class BaseApi(api_client.Api): class ExecutePayoutAction(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def execute_payout_action( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def execute_payout_action( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def execute_payout_action( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def execute_payout_action( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._execute_payout_action_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def execute_payout_action(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._execute_payout_action_oapg(params, request_options) class ApiForpost(BaseApi): @@ -336,11 +241,11 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._execute_payout_action_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/payments_xb_settlements_configs/get.py b/fireblocks_client/paths/payments_xb_settlements_configs/get.py index 52b17f5f..c8015422 100644 --- a/fireblocks_client/paths/payments_xb_settlements_configs/get.py +++ b/fireblocks_client/paths/payments_xb_settlements_configs/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -37,18 +31,18 @@ class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) SchemaFor401ResponseBodyApplicationJson = ErrorResponse @@ -56,18 +50,18 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseFor401(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor401ResponseBodyApplicationJson, - ] + SchemaFor401ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_401 = api_client.OpenApiResponse( response_cls=ApiResponseFor401, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor401ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor401ResponseBodyApplicationJson), }, -) + ) SchemaFor5XXResponseBodyApplicationJson = ErrorResponse @@ -75,18 +69,18 @@ class ApiResponseFor401(api_client.ApiResponse): class ApiResponseFor5XX(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor5XXResponseBodyApplicationJson, - ] + SchemaFor5XXResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_5XX = api_client.OpenApiResponse( response_cls=ApiResponseFor5XX, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor5XXResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor5XXResponseBodyApplicationJson), }, -) + ) _status_code_to_response = { '200': _response_for_200, '401': _response_for_401, @@ -94,79 +88,35 @@ class ApiResponseFor5XX(api_client.ApiResponse): } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_xb_settlement_configs_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - @typing.overload - def _get_xb_settlement_configs_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_xb_settlement_configs_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_xb_settlement_configs_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_xb_settlement_configs_oapg(self, request_options: RequestOptions = None): """ Get all the cross-border settlement configurations - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -181,51 +131,8 @@ class instances class GetXbSettlementConfigs(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_xb_settlement_configs( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get_xb_settlement_configs( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_xb_settlement_configs( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_xb_settlement_configs( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_xb_settlement_configs_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_xb_settlement_configs(self , request_options: RequestOptions = None): + return self._get_xb_settlement_configs_oapg(request_options) class ApiForget(BaseApi): @@ -271,10 +178,10 @@ def get( skip_deserialization: bool = False, ): return self._get_xb_settlement_configs_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/payments_xb_settlements_configs/get.pyi b/fireblocks_client/paths/payments_xb_settlements_configs/get.pyi index 819066ea..d40fbabb 100644 --- a/fireblocks_client/paths/payments_xb_settlements_configs/get.pyi +++ b/fireblocks_client/paths/payments_xb_settlements_configs/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error_response import ErrorResponse from fireblocks_client.model.xb_settlement_get_all_configs_response import XBSettlementGetAllConfigsResponse + SchemaFor200ResponseBodyApplicationJson = XBSettlementGetAllConfigsResponse @@ -35,18 +30,18 @@ SchemaFor200ResponseBodyApplicationJson = XBSettlementGetAllConfigsResponse class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) SchemaFor401ResponseBodyApplicationJson = ErrorResponse @@ -54,18 +49,18 @@ SchemaFor401ResponseBodyApplicationJson = ErrorResponse class ApiResponseFor401(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor401ResponseBodyApplicationJson, - ] + SchemaFor401ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_401 = api_client.OpenApiResponse( response_cls=ApiResponseFor401, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor401ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor401ResponseBodyApplicationJson), }, -) + ) SchemaFor5XXResponseBodyApplicationJson = ErrorResponse @@ -73,93 +68,49 @@ SchemaFor5XXResponseBodyApplicationJson = ErrorResponse class ApiResponseFor5XX(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor5XXResponseBodyApplicationJson, - ] + SchemaFor5XXResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_5XX = api_client.OpenApiResponse( response_cls=ApiResponseFor5XX, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor5XXResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor5XXResponseBodyApplicationJson), }, -) + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_xb_settlement_configs_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _get_xb_settlement_configs_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_xb_settlement_configs_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_xb_settlement_configs_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_xb_settlement_configs_oapg(self, request_options: RequestOptions = None): """ Get all the cross-border settlement configurations - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -174,51 +125,8 @@ class BaseApi(api_client.Api): class GetXbSettlementConfigs(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_xb_settlement_configs( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get_xb_settlement_configs( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_xb_settlement_configs( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_xb_settlement_configs( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_xb_settlement_configs_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_xb_settlement_configs(self , request_options: RequestOptions = None): + return self._get_xb_settlement_configs_oapg(request_options) class ApiForget(BaseApi): @@ -264,10 +172,10 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_xb_settlement_configs_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/payments_xb_settlements_configs/post.py b/fireblocks_client/paths/payments_xb_settlements_configs/post.py index 6319b386..b9d1d54e 100644 --- a/fireblocks_client/paths/payments_xb_settlements_configs/post.py +++ b/fireblocks_client/paths/payments_xb_settlements_configs/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -33,13 +27,11 @@ # body param SchemaForRequestBodyApplicationJson = XBSettlementConfigCreationRequestBody - - request_body_xb_settlement_config_creation_request_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) SchemaFor200ResponseBodyApplicationJson = XBSettlementConfigModel @@ -48,18 +40,18 @@ class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) SchemaFor400ResponseBodyApplicationJson = ErrorResponse @@ -67,18 +59,18 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseFor400(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor400ResponseBodyApplicationJson, - ] + SchemaFor400ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_400 = api_client.OpenApiResponse( response_cls=ApiResponseFor400, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor400ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor400ResponseBodyApplicationJson), }, -) + ) SchemaFor401ResponseBodyApplicationJson = ErrorResponse @@ -86,18 +78,18 @@ class ApiResponseFor400(api_client.ApiResponse): class ApiResponseFor401(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor401ResponseBodyApplicationJson, - ] + SchemaFor401ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_401 = api_client.OpenApiResponse( response_cls=ApiResponseFor401, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor401ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor401ResponseBodyApplicationJson), }, -) + ) SchemaFor5XXResponseBodyApplicationJson = ErrorResponse @@ -105,18 +97,18 @@ class ApiResponseFor401(api_client.ApiResponse): class ApiResponseFor5XX(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor5XXResponseBodyApplicationJson, - ] + SchemaFor5XXResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_5XX = api_client.OpenApiResponse( response_cls=ApiResponseFor5XX, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor5XXResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor5XXResponseBodyApplicationJson), }, -) + ) _status_code_to_response = { '200': _response_for_200, '400': _response_for_400, @@ -125,112 +117,45 @@ class ApiResponseFor5XX(api_client.ApiResponse): } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_xb_settlement_config_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - @typing.overload - def _create_xb_settlement_config_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _create_xb_settlement_config_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_xb_settlement_config_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _create_xb_settlement_config_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_xb_settlement_config_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): """ Create a new cross-border settlement configuration - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_xb_settlement_config_creation_request_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_xb_settlement_config_creation_request_body.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -245,75 +170,8 @@ class instances class CreateXbSettlementConfig(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create_xb_settlement_config( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def create_xb_settlement_config( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def create_xb_settlement_config( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_xb_settlement_config( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_xb_settlement_config( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_xb_settlement_config_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create_xb_settlement_config(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): + return self._create_xb_settlement_config_oapg(params, request_options) class ApiForpost(BaseApi): @@ -381,12 +239,12 @@ def post( skip_deserialization: bool = False, ): return self._create_xb_settlement_config_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/payments_xb_settlements_configs/post.pyi b/fireblocks_client/paths/payments_xb_settlements_configs/post.pyi index 682c3ea7..3dd7b237 100644 --- a/fireblocks_client/paths/payments_xb_settlements_configs/post.pyi +++ b/fireblocks_client/paths/payments_xb_settlements_configs/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -29,15 +23,14 @@ from fireblocks_client.model.error_response import ErrorResponse from fireblocks_client.model.xb_settlement_config_model import XBSettlementConfigModel from fireblocks_client.model.xb_settlement_config_creation_request_body import XBSettlementConfigCreationRequestBody + # body param SchemaForRequestBodyApplicationJson = XBSettlementConfigCreationRequestBody - - request_body_xb_settlement_config_creation_request_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) SchemaFor200ResponseBodyApplicationJson = XBSettlementConfigModel @@ -46,18 +39,18 @@ SchemaFor200ResponseBodyApplicationJson = XBSettlementConfigModel class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) SchemaFor400ResponseBodyApplicationJson = ErrorResponse @@ -65,18 +58,18 @@ SchemaFor400ResponseBodyApplicationJson = ErrorResponse class ApiResponseFor400(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor400ResponseBodyApplicationJson, - ] + SchemaFor400ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_400 = api_client.OpenApiResponse( response_cls=ApiResponseFor400, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor400ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor400ResponseBodyApplicationJson), }, -) + ) SchemaFor401ResponseBodyApplicationJson = ErrorResponse @@ -84,18 +77,18 @@ SchemaFor401ResponseBodyApplicationJson = ErrorResponse class ApiResponseFor401(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor401ResponseBodyApplicationJson, - ] + SchemaFor401ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_401 = api_client.OpenApiResponse( response_cls=ApiResponseFor401, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor401ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor401ResponseBodyApplicationJson), }, -) + ) SchemaFor5XXResponseBodyApplicationJson = ErrorResponse @@ -103,126 +96,59 @@ SchemaFor5XXResponseBodyApplicationJson = ErrorResponse class ApiResponseFor5XX(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor5XXResponseBodyApplicationJson, - ] + SchemaFor5XXResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_5XX = api_client.OpenApiResponse( response_cls=ApiResponseFor5XX, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor5XXResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor5XXResponseBodyApplicationJson), }, -) + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_xb_settlement_config_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - @typing.overload - def _create_xb_settlement_config_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _create_xb_settlement_config_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_xb_settlement_config_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _create_xb_settlement_config_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_xb_settlement_config_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): """ Create a new cross-border settlement configuration - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_xb_settlement_config_creation_request_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_xb_settlement_config_creation_request_body.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -237,75 +163,8 @@ class BaseApi(api_client.Api): class CreateXbSettlementConfig(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create_xb_settlement_config( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def create_xb_settlement_config( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def create_xb_settlement_config( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_xb_settlement_config( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_xb_settlement_config( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_xb_settlement_config_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create_xb_settlement_config(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): + return self._create_xb_settlement_config_oapg(params, request_options) class ApiForpost(BaseApi): @@ -373,12 +232,12 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._create_xb_settlement_config_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/payments_xb_settlements_configs_config_id/delete.py b/fireblocks_client/paths/payments_xb_settlements_configs_config_id/delete.py index 6662bb85..e783805d 100644 --- a/fireblocks_client/paths/payments_xb_settlements_configs_config_id/delete.py +++ b/fireblocks_client/paths/payments_xb_settlements_configs_config_id/delete.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -63,18 +57,18 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) SchemaFor404ResponseBodyApplicationJson = ErrorResponse @@ -82,18 +76,18 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseFor404(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor404ResponseBodyApplicationJson, - ] + SchemaFor404ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_404 = api_client.OpenApiResponse( response_cls=ApiResponseFor404, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor404ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor404ResponseBodyApplicationJson), }, -) + ) SchemaFor401ResponseBodyApplicationJson = ErrorResponse @@ -101,18 +95,18 @@ class ApiResponseFor404(api_client.ApiResponse): class ApiResponseFor401(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor401ResponseBodyApplicationJson, - ] + SchemaFor401ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_401 = api_client.OpenApiResponse( response_cls=ApiResponseFor401, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor401ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor401ResponseBodyApplicationJson), }, -) + ) SchemaFor5XXResponseBodyApplicationJson = ErrorResponse @@ -120,18 +114,18 @@ class ApiResponseFor401(api_client.ApiResponse): class ApiResponseFor5XX(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor5XXResponseBodyApplicationJson, - ] + SchemaFor5XXResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_5XX = api_client.OpenApiResponse( response_cls=ApiResponseFor5XX, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor5XXResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor5XXResponseBodyApplicationJson), }, -) + ) _status_code_to_response = { '200': _response_for_200, '404': _response_for_404, @@ -140,60 +134,23 @@ class ApiResponseFor5XX(api_client.ApiResponse): } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _delete_xb_settlement_config_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _delete_xb_settlement_config_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _delete_xb_settlement_config_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _delete_xb_settlement_config_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _delete_xb_settlement_config_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Delete a cross-border settlement configuration - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_config_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -208,29 +165,24 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='delete'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -245,56 +197,8 @@ class instances class DeleteXbSettlementConfig(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def delete_xb_settlement_config( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def delete_xb_settlement_config( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete_xb_settlement_config( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete_xb_settlement_config( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_xb_settlement_config_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def delete_xb_settlement_config(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._delete_xb_settlement_config_oapg(params, request_options) class ApiFordelete(BaseApi): @@ -344,11 +248,11 @@ def delete( skip_deserialization: bool = False, ): return self._delete_xb_settlement_config_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/payments_xb_settlements_configs_config_id/delete.pyi b/fireblocks_client/paths/payments_xb_settlements_configs_config_id/delete.pyi index e712eb73..e48defd0 100644 --- a/fireblocks_client/paths/payments_xb_settlements_configs_config_id/delete.pyi +++ b/fireblocks_client/paths/payments_xb_settlements_configs_config_id/delete.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error_response import ErrorResponse from fireblocks_client.model.xb_settlement_config_model import XBSettlementConfigModel + # Path params ConfigIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -61,18 +56,18 @@ SchemaFor200ResponseBodyApplicationJson = XBSettlementConfigModel class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) SchemaFor404ResponseBodyApplicationJson = ErrorResponse @@ -80,18 +75,18 @@ SchemaFor404ResponseBodyApplicationJson = ErrorResponse class ApiResponseFor404(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor404ResponseBodyApplicationJson, - ] + SchemaFor404ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_404 = api_client.OpenApiResponse( response_cls=ApiResponseFor404, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor404ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor404ResponseBodyApplicationJson), }, -) + ) SchemaFor401ResponseBodyApplicationJson = ErrorResponse @@ -99,18 +94,18 @@ SchemaFor401ResponseBodyApplicationJson = ErrorResponse class ApiResponseFor401(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor401ResponseBodyApplicationJson, - ] + SchemaFor401ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_401 = api_client.OpenApiResponse( response_cls=ApiResponseFor401, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor401ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor401ResponseBodyApplicationJson), }, -) + ) SchemaFor5XXResponseBodyApplicationJson = ErrorResponse @@ -118,74 +113,37 @@ SchemaFor5XXResponseBodyApplicationJson = ErrorResponse class ApiResponseFor5XX(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor5XXResponseBodyApplicationJson, - ] + SchemaFor5XXResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_5XX = api_client.OpenApiResponse( response_cls=ApiResponseFor5XX, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor5XXResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor5XXResponseBodyApplicationJson), }, -) + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _delete_xb_settlement_config_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _delete_xb_settlement_config_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _delete_xb_settlement_config_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _delete_xb_settlement_config_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _delete_xb_settlement_config_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Delete a cross-border settlement configuration - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_config_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -200,29 +158,24 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='delete'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -237,56 +190,8 @@ class BaseApi(api_client.Api): class DeleteXbSettlementConfig(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def delete_xb_settlement_config( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def delete_xb_settlement_config( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete_xb_settlement_config( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete_xb_settlement_config( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_xb_settlement_config_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def delete_xb_settlement_config(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._delete_xb_settlement_config_oapg(params, request_options) class ApiFordelete(BaseApi): @@ -336,11 +241,11 @@ class ApiFordelete(BaseApi): skip_deserialization: bool = False, ): return self._delete_xb_settlement_config_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/payments_xb_settlements_configs_config_id/get.py b/fireblocks_client/paths/payments_xb_settlements_configs_config_id/get.py index f2f631a3..14be03af 100644 --- a/fireblocks_client/paths/payments_xb_settlements_configs_config_id/get.py +++ b/fireblocks_client/paths/payments_xb_settlements_configs_config_id/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -63,18 +57,18 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) SchemaFor404ResponseBodyApplicationJson = ErrorResponse @@ -82,18 +76,18 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseFor404(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor404ResponseBodyApplicationJson, - ] + SchemaFor404ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_404 = api_client.OpenApiResponse( response_cls=ApiResponseFor404, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor404ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor404ResponseBodyApplicationJson), }, -) + ) SchemaFor401ResponseBodyApplicationJson = ErrorResponse @@ -101,18 +95,18 @@ class ApiResponseFor404(api_client.ApiResponse): class ApiResponseFor401(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor401ResponseBodyApplicationJson, - ] + SchemaFor401ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_401 = api_client.OpenApiResponse( response_cls=ApiResponseFor401, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor401ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor401ResponseBodyApplicationJson), }, -) + ) SchemaFor5XXResponseBodyApplicationJson = ErrorResponse @@ -120,18 +114,18 @@ class ApiResponseFor401(api_client.ApiResponse): class ApiResponseFor5XX(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor5XXResponseBodyApplicationJson, - ] + SchemaFor5XXResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_5XX = api_client.OpenApiResponse( response_cls=ApiResponseFor5XX, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor5XXResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor5XXResponseBodyApplicationJson), }, -) + ) _status_code_to_response = { '200': _response_for_200, '404': _response_for_404, @@ -140,60 +134,23 @@ class ApiResponseFor5XX(api_client.ApiResponse): } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_xb_settlement_config_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _get_xb_settlement_config_by_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_xb_settlement_config_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_xb_settlement_config_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_xb_settlement_config_by_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Get a specific cross-border settlement configuration - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_config_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -208,29 +165,24 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -245,56 +197,8 @@ class instances class GetXbSettlementConfigById(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_xb_settlement_config_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get_xb_settlement_config_by_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_xb_settlement_config_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_xb_settlement_config_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_xb_settlement_config_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_xb_settlement_config_by_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_xb_settlement_config_by_id_oapg(params, request_options) class ApiForget(BaseApi): @@ -344,11 +248,11 @@ def get( skip_deserialization: bool = False, ): return self._get_xb_settlement_config_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/payments_xb_settlements_configs_config_id/get.pyi b/fireblocks_client/paths/payments_xb_settlements_configs_config_id/get.pyi index d1370607..812f74a2 100644 --- a/fireblocks_client/paths/payments_xb_settlements_configs_config_id/get.pyi +++ b/fireblocks_client/paths/payments_xb_settlements_configs_config_id/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error_response import ErrorResponse from fireblocks_client.model.xb_settlement_config_model import XBSettlementConfigModel + # Path params ConfigIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -61,18 +56,18 @@ SchemaFor200ResponseBodyApplicationJson = XBSettlementConfigModel class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) SchemaFor404ResponseBodyApplicationJson = ErrorResponse @@ -80,18 +75,18 @@ SchemaFor404ResponseBodyApplicationJson = ErrorResponse class ApiResponseFor404(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor404ResponseBodyApplicationJson, - ] + SchemaFor404ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_404 = api_client.OpenApiResponse( response_cls=ApiResponseFor404, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor404ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor404ResponseBodyApplicationJson), }, -) + ) SchemaFor401ResponseBodyApplicationJson = ErrorResponse @@ -99,18 +94,18 @@ SchemaFor401ResponseBodyApplicationJson = ErrorResponse class ApiResponseFor401(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor401ResponseBodyApplicationJson, - ] + SchemaFor401ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_401 = api_client.OpenApiResponse( response_cls=ApiResponseFor401, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor401ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor401ResponseBodyApplicationJson), }, -) + ) SchemaFor5XXResponseBodyApplicationJson = ErrorResponse @@ -118,74 +113,37 @@ SchemaFor5XXResponseBodyApplicationJson = ErrorResponse class ApiResponseFor5XX(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor5XXResponseBodyApplicationJson, - ] + SchemaFor5XXResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_5XX = api_client.OpenApiResponse( response_cls=ApiResponseFor5XX, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor5XXResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor5XXResponseBodyApplicationJson), }, -) + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_xb_settlement_config_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _get_xb_settlement_config_by_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_xb_settlement_config_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_xb_settlement_config_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_xb_settlement_config_by_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Get a specific cross-border settlement configuration - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_config_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -200,29 +158,24 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -237,56 +190,8 @@ class BaseApi(api_client.Api): class GetXbSettlementConfigById(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_xb_settlement_config_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get_xb_settlement_config_by_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_xb_settlement_config_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_xb_settlement_config_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_xb_settlement_config_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_xb_settlement_config_by_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_xb_settlement_config_by_id_oapg(params, request_options) class ApiForget(BaseApi): @@ -336,11 +241,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_xb_settlement_config_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/payments_xb_settlements_configs_config_id/put.py b/fireblocks_client/paths/payments_xb_settlements_configs_config_id/put.py index b271593b..5e2b8c90 100644 --- a/fireblocks_client/paths/payments_xb_settlements_configs_config_id/put.py +++ b/fireblocks_client/paths/payments_xb_settlements_configs_config_id/put.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -59,13 +53,11 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) # body param SchemaForRequestBodyApplicationJson = XBSettlementConfigEditRequestBody - - request_body_xb_settlement_config_edit_request_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) SchemaFor200ResponseBodyApplicationJson = XBSettlementConfigModel @@ -74,18 +66,18 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) SchemaFor404ResponseBodyApplicationJson = ErrorResponse @@ -93,18 +85,18 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseFor404(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor404ResponseBodyApplicationJson, - ] + SchemaFor404ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_404 = api_client.OpenApiResponse( response_cls=ApiResponseFor404, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor404ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor404ResponseBodyApplicationJson), }, -) + ) SchemaFor400ResponseBodyApplicationJson = ErrorResponse @@ -112,18 +104,18 @@ class ApiResponseFor404(api_client.ApiResponse): class ApiResponseFor400(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor400ResponseBodyApplicationJson, - ] + SchemaFor400ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_400 = api_client.OpenApiResponse( response_cls=ApiResponseFor400, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor400ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor400ResponseBodyApplicationJson), }, -) + ) SchemaFor401ResponseBodyApplicationJson = ErrorResponse @@ -131,18 +123,18 @@ class ApiResponseFor400(api_client.ApiResponse): class ApiResponseFor401(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor401ResponseBodyApplicationJson, - ] + SchemaFor401ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_401 = api_client.OpenApiResponse( response_cls=ApiResponseFor401, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor401ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor401ResponseBodyApplicationJson), }, -) + ) SchemaFor5XXResponseBodyApplicationJson = ErrorResponse @@ -150,18 +142,18 @@ class ApiResponseFor401(api_client.ApiResponse): class ApiResponseFor5XX(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor5XXResponseBodyApplicationJson, - ] + SchemaFor5XXResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_5XX = api_client.OpenApiResponse( response_cls=ApiResponseFor5XX, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor5XXResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor5XXResponseBodyApplicationJson), }, -) + ) _status_code_to_response = { '200': _response_for_200, '404': _response_for_404, @@ -171,83 +163,23 @@ class ApiResponseFor5XX(api_client.ApiResponse): } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _update_xb_settlement_config_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _update_xb_settlement_config_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _update_xb_settlement_config_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_xb_settlement_config_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _update_xb_settlement_config_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _update_xb_settlement_config_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): """ Edit a cross-border settlement configuration - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_config_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -262,40 +194,34 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_xb_settlement_config_edit_request_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_xb_settlement_config_edit_request_body.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='put'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -310,81 +236,8 @@ class instances class UpdateXbSettlementConfig(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def update_xb_settlement_config( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def update_xb_settlement_config( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def update_xb_settlement_config( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_xb_settlement_config( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def update_xb_settlement_config( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_xb_settlement_config_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def update_xb_settlement_config(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): + return self._update_xb_settlement_config_oapg(params, request_options) class ApiForput(BaseApi): @@ -457,13 +310,13 @@ def put( skip_deserialization: bool = False, ): return self._update_xb_settlement_config_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/payments_xb_settlements_configs_config_id/put.pyi b/fireblocks_client/paths/payments_xb_settlements_configs_config_id/put.pyi index 420efc6f..93dd360f 100644 --- a/fireblocks_client/paths/payments_xb_settlements_configs_config_id/put.pyi +++ b/fireblocks_client/paths/payments_xb_settlements_configs_config_id/put.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -29,6 +23,7 @@ from fireblocks_client.model.error_response import ErrorResponse from fireblocks_client.model.xb_settlement_config_model import XBSettlementConfigModel from fireblocks_client.model.xb_settlement_config_edit_request_body import XBSettlementConfigEditRequestBody + # Path params ConfigIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -57,13 +52,11 @@ request_path_config_id = api_client.PathParameter( ) # body param SchemaForRequestBodyApplicationJson = XBSettlementConfigEditRequestBody - - request_body_xb_settlement_config_edit_request_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) SchemaFor200ResponseBodyApplicationJson = XBSettlementConfigModel @@ -72,18 +65,18 @@ SchemaFor200ResponseBodyApplicationJson = XBSettlementConfigModel class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) SchemaFor404ResponseBodyApplicationJson = ErrorResponse @@ -91,18 +84,18 @@ SchemaFor404ResponseBodyApplicationJson = ErrorResponse class ApiResponseFor404(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor404ResponseBodyApplicationJson, - ] + SchemaFor404ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_404 = api_client.OpenApiResponse( response_cls=ApiResponseFor404, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor404ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor404ResponseBodyApplicationJson), }, -) + ) SchemaFor400ResponseBodyApplicationJson = ErrorResponse @@ -110,18 +103,18 @@ SchemaFor400ResponseBodyApplicationJson = ErrorResponse class ApiResponseFor400(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor400ResponseBodyApplicationJson, - ] + SchemaFor400ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_400 = api_client.OpenApiResponse( response_cls=ApiResponseFor400, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor400ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor400ResponseBodyApplicationJson), }, -) + ) SchemaFor401ResponseBodyApplicationJson = ErrorResponse @@ -129,18 +122,18 @@ SchemaFor401ResponseBodyApplicationJson = ErrorResponse class ApiResponseFor401(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor401ResponseBodyApplicationJson, - ] + SchemaFor401ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_401 = api_client.OpenApiResponse( response_cls=ApiResponseFor401, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor401ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor401ResponseBodyApplicationJson), }, -) + ) SchemaFor5XXResponseBodyApplicationJson = ErrorResponse @@ -148,97 +141,37 @@ SchemaFor5XXResponseBodyApplicationJson = ErrorResponse class ApiResponseFor5XX(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor5XXResponseBodyApplicationJson, - ] + SchemaFor5XXResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_5XX = api_client.OpenApiResponse( response_cls=ApiResponseFor5XX, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor5XXResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor5XXResponseBodyApplicationJson), }, -) + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _update_xb_settlement_config_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - @typing.overload - def _update_xb_settlement_config_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _update_xb_settlement_config_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_xb_settlement_config_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _update_xb_settlement_config_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _update_xb_settlement_config_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): """ Edit a cross-border settlement configuration - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_config_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -253,40 +186,34 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_xb_settlement_config_edit_request_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_xb_settlement_config_edit_request_body.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='put'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -301,81 +228,8 @@ class BaseApi(api_client.Api): class UpdateXbSettlementConfig(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def update_xb_settlement_config( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def update_xb_settlement_config( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def update_xb_settlement_config( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_xb_settlement_config( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def update_xb_settlement_config( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_xb_settlement_config_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def update_xb_settlement_config(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): + return self._update_xb_settlement_config_oapg(params, request_options) class ApiForput(BaseApi): @@ -448,13 +302,13 @@ class ApiForput(BaseApi): skip_deserialization: bool = False, ): return self._update_xb_settlement_config_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/payments_xb_settlements_flows/post.py b/fireblocks_client/paths/payments_xb_settlements_flows/post.py index ddab1d64..9f80fc05 100644 --- a/fireblocks_client/paths/payments_xb_settlements_flows/post.py +++ b/fireblocks_client/paths/payments_xb_settlements_flows/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -33,13 +27,11 @@ # body param SchemaForRequestBodyApplicationJson = XBSettlementCreateFlowRequestBody - - request_body_xb_settlement_create_flow_request_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) SchemaFor200ResponseBodyApplicationJson = XBSettlementFlowPreviewModel @@ -48,18 +40,18 @@ class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) SchemaFor400ResponseBodyApplicationJson = ErrorResponse @@ -67,18 +59,18 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseFor400(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor400ResponseBodyApplicationJson, - ] + SchemaFor400ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_400 = api_client.OpenApiResponse( response_cls=ApiResponseFor400, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor400ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor400ResponseBodyApplicationJson), }, -) + ) SchemaFor401ResponseBodyApplicationJson = ErrorResponse @@ -86,18 +78,18 @@ class ApiResponseFor400(api_client.ApiResponse): class ApiResponseFor401(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor401ResponseBodyApplicationJson, - ] + SchemaFor401ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_401 = api_client.OpenApiResponse( response_cls=ApiResponseFor401, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor401ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor401ResponseBodyApplicationJson), }, -) + ) SchemaFor5XXResponseBodyApplicationJson = ErrorResponse @@ -105,18 +97,18 @@ class ApiResponseFor401(api_client.ApiResponse): class ApiResponseFor5XX(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor5XXResponseBodyApplicationJson, - ] + SchemaFor5XXResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_5XX = api_client.OpenApiResponse( response_cls=ApiResponseFor5XX, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor5XXResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor5XXResponseBodyApplicationJson), }, -) + ) _status_code_to_response = { '200': _response_for_200, '400': _response_for_400, @@ -125,112 +117,45 @@ class ApiResponseFor5XX(api_client.ApiResponse): } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_xb_settlement_flow_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - @typing.overload - def _create_xb_settlement_flow_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _create_xb_settlement_flow_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_xb_settlement_flow_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _create_xb_settlement_flow_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_xb_settlement_flow_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): """ Create a new cross-border settlement flow - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_xb_settlement_create_flow_request_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_xb_settlement_create_flow_request_body.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -245,75 +170,8 @@ class instances class CreateXbSettlementFlow(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create_xb_settlement_flow( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def create_xb_settlement_flow( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def create_xb_settlement_flow( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_xb_settlement_flow( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_xb_settlement_flow( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_xb_settlement_flow_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create_xb_settlement_flow(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): + return self._create_xb_settlement_flow_oapg(params, request_options) class ApiForpost(BaseApi): @@ -381,12 +239,12 @@ def post( skip_deserialization: bool = False, ): return self._create_xb_settlement_flow_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/payments_xb_settlements_flows/post.pyi b/fireblocks_client/paths/payments_xb_settlements_flows/post.pyi index 9d84b48e..c35f0129 100644 --- a/fireblocks_client/paths/payments_xb_settlements_flows/post.pyi +++ b/fireblocks_client/paths/payments_xb_settlements_flows/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -29,15 +23,14 @@ from fireblocks_client.model.xb_settlement_flow_preview_model import XBSettlemen from fireblocks_client.model.error_response import ErrorResponse from fireblocks_client.model.xb_settlement_create_flow_request_body import XBSettlementCreateFlowRequestBody + # body param SchemaForRequestBodyApplicationJson = XBSettlementCreateFlowRequestBody - - request_body_xb_settlement_create_flow_request_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) SchemaFor200ResponseBodyApplicationJson = XBSettlementFlowPreviewModel @@ -46,18 +39,18 @@ SchemaFor200ResponseBodyApplicationJson = XBSettlementFlowPreviewModel class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) SchemaFor400ResponseBodyApplicationJson = ErrorResponse @@ -65,18 +58,18 @@ SchemaFor400ResponseBodyApplicationJson = ErrorResponse class ApiResponseFor400(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor400ResponseBodyApplicationJson, - ] + SchemaFor400ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_400 = api_client.OpenApiResponse( response_cls=ApiResponseFor400, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor400ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor400ResponseBodyApplicationJson), }, -) + ) SchemaFor401ResponseBodyApplicationJson = ErrorResponse @@ -84,18 +77,18 @@ SchemaFor401ResponseBodyApplicationJson = ErrorResponse class ApiResponseFor401(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor401ResponseBodyApplicationJson, - ] + SchemaFor401ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_401 = api_client.OpenApiResponse( response_cls=ApiResponseFor401, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor401ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor401ResponseBodyApplicationJson), }, -) + ) SchemaFor5XXResponseBodyApplicationJson = ErrorResponse @@ -103,126 +96,59 @@ SchemaFor5XXResponseBodyApplicationJson = ErrorResponse class ApiResponseFor5XX(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor5XXResponseBodyApplicationJson, - ] + SchemaFor5XXResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_5XX = api_client.OpenApiResponse( response_cls=ApiResponseFor5XX, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor5XXResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor5XXResponseBodyApplicationJson), }, -) + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_xb_settlement_flow_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - @typing.overload - def _create_xb_settlement_flow_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _create_xb_settlement_flow_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_xb_settlement_flow_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _create_xb_settlement_flow_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_xb_settlement_flow_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): """ Create a new cross-border settlement flow - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_xb_settlement_create_flow_request_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_xb_settlement_create_flow_request_body.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -237,75 +163,8 @@ class BaseApi(api_client.Api): class CreateXbSettlementFlow(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create_xb_settlement_flow( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def create_xb_settlement_flow( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def create_xb_settlement_flow( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_xb_settlement_flow( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_xb_settlement_flow( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_xb_settlement_flow_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create_xb_settlement_flow(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): + return self._create_xb_settlement_flow_oapg(params, request_options) class ApiForpost(BaseApi): @@ -373,12 +232,12 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._create_xb_settlement_flow_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/payments_xb_settlements_flows_flow_id/get.py b/fireblocks_client/paths/payments_xb_settlements_flows_flow_id/get.py index 16cbb694..8946bf14 100644 --- a/fireblocks_client/paths/payments_xb_settlements_flows_flow_id/get.py +++ b/fireblocks_client/paths/payments_xb_settlements_flows_flow_id/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -63,18 +57,18 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) SchemaFor404ResponseBodyApplicationJson = ErrorResponse @@ -82,18 +76,18 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseFor404(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor404ResponseBodyApplicationJson, - ] + SchemaFor404ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_404 = api_client.OpenApiResponse( response_cls=ApiResponseFor404, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor404ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor404ResponseBodyApplicationJson), }, -) + ) SchemaFor401ResponseBodyApplicationJson = ErrorResponse @@ -101,18 +95,18 @@ class ApiResponseFor404(api_client.ApiResponse): class ApiResponseFor401(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor401ResponseBodyApplicationJson, - ] + SchemaFor401ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_401 = api_client.OpenApiResponse( response_cls=ApiResponseFor401, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor401ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor401ResponseBodyApplicationJson), }, -) + ) SchemaFor5XXResponseBodyApplicationJson = ErrorResponse @@ -120,18 +114,18 @@ class ApiResponseFor401(api_client.ApiResponse): class ApiResponseFor5XX(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor5XXResponseBodyApplicationJson, - ] + SchemaFor5XXResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_5XX = api_client.OpenApiResponse( response_cls=ApiResponseFor5XX, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor5XXResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor5XXResponseBodyApplicationJson), }, -) + ) _status_code_to_response = { '200': _response_for_200, '404': _response_for_404, @@ -140,60 +134,23 @@ class ApiResponseFor5XX(api_client.ApiResponse): } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_xb_settlement_flow_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _get_xb_settlement_flow_by_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_xb_settlement_flow_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_xb_settlement_flow_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_xb_settlement_flow_by_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Get specific cross-border settlement flow details - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_flow_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -208,29 +165,24 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -245,56 +197,8 @@ class instances class GetXbSettlementFlowById(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_xb_settlement_flow_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get_xb_settlement_flow_by_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_xb_settlement_flow_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_xb_settlement_flow_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_xb_settlement_flow_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_xb_settlement_flow_by_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_xb_settlement_flow_by_id_oapg(params, request_options) class ApiForget(BaseApi): @@ -344,11 +248,11 @@ def get( skip_deserialization: bool = False, ): return self._get_xb_settlement_flow_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/payments_xb_settlements_flows_flow_id/get.pyi b/fireblocks_client/paths/payments_xb_settlements_flows_flow_id/get.pyi index ce961204..2ee18b18 100644 --- a/fireblocks_client/paths/payments_xb_settlements_flows_flow_id/get.pyi +++ b/fireblocks_client/paths/payments_xb_settlements_flows_flow_id/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.xb_settlement_get_flow_response import XBSettlementGetFlowResponse from fireblocks_client.model.error_response import ErrorResponse + # Path params FlowIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -61,18 +56,18 @@ SchemaFor200ResponseBodyApplicationJson = XBSettlementGetFlowResponse class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) SchemaFor404ResponseBodyApplicationJson = ErrorResponse @@ -80,18 +75,18 @@ SchemaFor404ResponseBodyApplicationJson = ErrorResponse class ApiResponseFor404(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor404ResponseBodyApplicationJson, - ] + SchemaFor404ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_404 = api_client.OpenApiResponse( response_cls=ApiResponseFor404, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor404ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor404ResponseBodyApplicationJson), }, -) + ) SchemaFor401ResponseBodyApplicationJson = ErrorResponse @@ -99,18 +94,18 @@ SchemaFor401ResponseBodyApplicationJson = ErrorResponse class ApiResponseFor401(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor401ResponseBodyApplicationJson, - ] + SchemaFor401ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_401 = api_client.OpenApiResponse( response_cls=ApiResponseFor401, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor401ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor401ResponseBodyApplicationJson), }, -) + ) SchemaFor5XXResponseBodyApplicationJson = ErrorResponse @@ -118,74 +113,37 @@ SchemaFor5XXResponseBodyApplicationJson = ErrorResponse class ApiResponseFor5XX(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor5XXResponseBodyApplicationJson, - ] + SchemaFor5XXResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_5XX = api_client.OpenApiResponse( response_cls=ApiResponseFor5XX, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor5XXResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor5XXResponseBodyApplicationJson), }, -) + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_xb_settlement_flow_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _get_xb_settlement_flow_by_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_xb_settlement_flow_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_xb_settlement_flow_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_xb_settlement_flow_by_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Get specific cross-border settlement flow details - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_flow_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -200,29 +158,24 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -237,56 +190,8 @@ class BaseApi(api_client.Api): class GetXbSettlementFlowById(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_xb_settlement_flow_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get_xb_settlement_flow_by_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_xb_settlement_flow_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_xb_settlement_flow_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_xb_settlement_flow_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_xb_settlement_flow_by_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_xb_settlement_flow_by_id_oapg(params, request_options) class ApiForget(BaseApi): @@ -336,11 +241,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_xb_settlement_flow_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/payments_xb_settlements_flows_flow_id_actions_execute/post.py b/fireblocks_client/paths/payments_xb_settlements_flows_flow_id_actions_execute/post.py index 240330d0..62400130 100644 --- a/fireblocks_client/paths/payments_xb_settlements_flows_flow_id_actions_execute/post.py +++ b/fireblocks_client/paths/payments_xb_settlements_flows_flow_id_actions_execute/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -59,13 +53,11 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) # body param SchemaForRequestBodyApplicationJson = XBSettlementFlowExecutionRequestBody - - request_body_xb_settlement_flow_execution_request_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) SchemaFor200ResponseBodyApplicationJson = XBSettlementFlowExecutionModel @@ -74,18 +66,18 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) SchemaFor400ResponseBodyApplicationJson = ErrorResponse @@ -93,18 +85,18 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseFor400(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor400ResponseBodyApplicationJson, - ] + SchemaFor400ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_400 = api_client.OpenApiResponse( response_cls=ApiResponseFor400, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor400ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor400ResponseBodyApplicationJson), }, -) + ) SchemaFor404ResponseBodyApplicationJson = ErrorResponse @@ -112,18 +104,18 @@ class ApiResponseFor400(api_client.ApiResponse): class ApiResponseFor404(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor404ResponseBodyApplicationJson, - ] + SchemaFor404ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_404 = api_client.OpenApiResponse( response_cls=ApiResponseFor404, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor404ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor404ResponseBodyApplicationJson), }, -) + ) SchemaFor401ResponseBodyApplicationJson = ErrorResponse @@ -131,18 +123,18 @@ class ApiResponseFor404(api_client.ApiResponse): class ApiResponseFor401(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor401ResponseBodyApplicationJson, - ] + SchemaFor401ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_401 = api_client.OpenApiResponse( response_cls=ApiResponseFor401, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor401ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor401ResponseBodyApplicationJson), }, -) + ) SchemaFor5XXResponseBodyApplicationJson = ErrorResponse @@ -150,18 +142,18 @@ class ApiResponseFor401(api_client.ApiResponse): class ApiResponseFor5XX(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor5XXResponseBodyApplicationJson, - ] + SchemaFor5XXResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_5XX = api_client.OpenApiResponse( response_cls=ApiResponseFor5XX, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor5XXResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor5XXResponseBodyApplicationJson), }, -) + ) _status_code_to_response = { '200': _response_for_200, '400': _response_for_400, @@ -171,83 +163,23 @@ class ApiResponseFor5XX(api_client.ApiResponse): } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _execute_xb_settlement_flow_action_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _execute_xb_settlement_flow_action_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _execute_xb_settlement_flow_action_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _execute_xb_settlement_flow_action_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _execute_xb_settlement_flow_action_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _execute_xb_settlement_flow_action_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): """ Execute cross-border settlement flow - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_flow_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -262,40 +194,34 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_xb_settlement_flow_execution_request_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_xb_settlement_flow_execution_request_body.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -310,81 +236,8 @@ class instances class ExecuteXbSettlementFlowAction(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def execute_xb_settlement_flow_action( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def execute_xb_settlement_flow_action( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def execute_xb_settlement_flow_action( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def execute_xb_settlement_flow_action( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def execute_xb_settlement_flow_action( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._execute_xb_settlement_flow_action_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def execute_xb_settlement_flow_action(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): + return self._execute_xb_settlement_flow_action_oapg(params, request_options) class ApiForpost(BaseApi): @@ -457,13 +310,13 @@ def post( skip_deserialization: bool = False, ): return self._execute_xb_settlement_flow_action_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/payments_xb_settlements_flows_flow_id_actions_execute/post.pyi b/fireblocks_client/paths/payments_xb_settlements_flows_flow_id_actions_execute/post.pyi index 4477ab00..77a679b2 100644 --- a/fireblocks_client/paths/payments_xb_settlements_flows_flow_id_actions_execute/post.pyi +++ b/fireblocks_client/paths/payments_xb_settlements_flows_flow_id_actions_execute/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -29,6 +23,7 @@ from fireblocks_client.model.xb_settlement_flow_execution_request_body import XB from fireblocks_client.model.error_response import ErrorResponse from fireblocks_client.model.xb_settlement_flow_execution_model import XBSettlementFlowExecutionModel + # Path params FlowIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -57,13 +52,11 @@ request_path_flow_id = api_client.PathParameter( ) # body param SchemaForRequestBodyApplicationJson = XBSettlementFlowExecutionRequestBody - - request_body_xb_settlement_flow_execution_request_body = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) SchemaFor200ResponseBodyApplicationJson = XBSettlementFlowExecutionModel @@ -72,18 +65,18 @@ SchemaFor200ResponseBodyApplicationJson = XBSettlementFlowExecutionModel class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) SchemaFor400ResponseBodyApplicationJson = ErrorResponse @@ -91,18 +84,18 @@ SchemaFor400ResponseBodyApplicationJson = ErrorResponse class ApiResponseFor400(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor400ResponseBodyApplicationJson, - ] + SchemaFor400ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_400 = api_client.OpenApiResponse( response_cls=ApiResponseFor400, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor400ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor400ResponseBodyApplicationJson), }, -) + ) SchemaFor404ResponseBodyApplicationJson = ErrorResponse @@ -110,18 +103,18 @@ SchemaFor404ResponseBodyApplicationJson = ErrorResponse class ApiResponseFor404(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor404ResponseBodyApplicationJson, - ] + SchemaFor404ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_404 = api_client.OpenApiResponse( response_cls=ApiResponseFor404, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor404ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor404ResponseBodyApplicationJson), }, -) + ) SchemaFor401ResponseBodyApplicationJson = ErrorResponse @@ -129,18 +122,18 @@ SchemaFor401ResponseBodyApplicationJson = ErrorResponse class ApiResponseFor401(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor401ResponseBodyApplicationJson, - ] + SchemaFor401ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_401 = api_client.OpenApiResponse( response_cls=ApiResponseFor401, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor401ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor401ResponseBodyApplicationJson), }, -) + ) SchemaFor5XXResponseBodyApplicationJson = ErrorResponse @@ -148,97 +141,37 @@ SchemaFor5XXResponseBodyApplicationJson = ErrorResponse class ApiResponseFor5XX(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor5XXResponseBodyApplicationJson, - ] + SchemaFor5XXResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_5XX = api_client.OpenApiResponse( response_cls=ApiResponseFor5XX, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor5XXResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor5XXResponseBodyApplicationJson), }, -) + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _execute_xb_settlement_flow_action_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - @typing.overload - def _execute_xb_settlement_flow_action_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _execute_xb_settlement_flow_action_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _execute_xb_settlement_flow_action_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _execute_xb_settlement_flow_action_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _execute_xb_settlement_flow_action_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): """ Execute cross-border settlement flow - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_flow_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -253,40 +186,34 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_xb_settlement_flow_execution_request_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_xb_settlement_flow_execution_request_body.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -301,81 +228,8 @@ class BaseApi(api_client.Api): class ExecuteXbSettlementFlowAction(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def execute_xb_settlement_flow_action( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def execute_xb_settlement_flow_action( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def execute_xb_settlement_flow_action( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def execute_xb_settlement_flow_action( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def execute_xb_settlement_flow_action( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._execute_xb_settlement_flow_action_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def execute_xb_settlement_flow_action(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): + return self._execute_xb_settlement_flow_action_oapg(params, request_options) class ApiForpost(BaseApi): @@ -448,13 +302,13 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._execute_xb_settlement_flow_action_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/screeening_travel_rule_vasp_update/put.py b/fireblocks_client/paths/screeening_travel_rule_vasp_update/put.py index 9a9aedd2..2671c06c 100644 --- a/fireblocks_client/paths/screeening_travel_rule_vasp_update/put.py +++ b/fireblocks_client/paths/screeening_travel_rule_vasp_update/put.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -31,13 +25,11 @@ # body param SchemaForRequestBodyApplicationJson = TravelRuleUpdateVASPDetails - - request_body_travel_rule_update_vasp_details = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) SchemaFor200ResponseBodyApplicationJson = TravelRuleUpdateVASPDetails @@ -47,18 +39,18 @@ class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) @dataclass @@ -70,7 +62,7 @@ class ApiResponseFor400(api_client.ApiResponse): _response_for_400 = api_client.OpenApiResponse( response_cls=ApiResponseFor400, -) + ) @dataclass @@ -82,7 +74,7 @@ class ApiResponseFor500(api_client.ApiResponse): _response_for_500 = api_client.OpenApiResponse( response_cls=ApiResponseFor500, -) + ) _status_code_to_response = { '200': _response_for_200, '400': _response_for_400, @@ -90,114 +82,49 @@ class ApiResponseFor500(api_client.ApiResponse): } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _travel_rule_api_controller_update_vasp_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _travel_rule_api_controller_update_vasp_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _travel_rule_api_controller_update_vasp_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _travel_rule_api_controller_update_vasp_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _travel_rule_api_controller_update_vasp_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _travel_rule_api_controller_update_vasp_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): """ Add jsonDidKey to VASP details - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(travel_rule_update_vasp_details, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_travel_rule_update_vasp_details.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_travel_rule_update_vasp_details.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='put'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -212,75 +139,8 @@ class instances class TravelRuleApiControllerUpdateVasp(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def travel_rule_api_controller_update_vasp( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def travel_rule_api_controller_update_vasp( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def travel_rule_api_controller_update_vasp( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def travel_rule_api_controller_update_vasp( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def travel_rule_api_controller_update_vasp( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._travel_rule_api_controller_update_vasp_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def travel_rule_api_controller_update_vasp(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): + return self._travel_rule_api_controller_update_vasp_oapg(params, request_options) class ApiForput(BaseApi): @@ -348,12 +208,12 @@ def put( skip_deserialization: bool = False, ): return self._travel_rule_api_controller_update_vasp_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/screeening_travel_rule_vasp_update/put.pyi b/fireblocks_client/paths/screeening_travel_rule_vasp_update/put.pyi index 489cb243..aecacab6 100644 --- a/fireblocks_client/paths/screeening_travel_rule_vasp_update/put.pyi +++ b/fireblocks_client/paths/screeening_travel_rule_vasp_update/put.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,15 +21,14 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.travel_rule_update_vasp_details import TravelRuleUpdateVASPDetails + # body param SchemaForRequestBodyApplicationJson = TravelRuleUpdateVASPDetails - - request_body_travel_rule_update_vasp_details = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) SchemaFor200ResponseBodyApplicationJson = TravelRuleUpdateVASPDetails @@ -45,18 +38,18 @@ SchemaFor200ResponseBodyApplicationJson = TravelRuleUpdateVASPDetails class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) @dataclass @@ -68,7 +61,7 @@ class ApiResponseFor400(api_client.ApiResponse): _response_for_400 = api_client.OpenApiResponse( response_cls=ApiResponseFor400, -) + ) @dataclass @@ -80,117 +73,52 @@ class ApiResponseFor500(api_client.ApiResponse): _response_for_500 = api_client.OpenApiResponse( response_cls=ApiResponseFor500, -) + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _travel_rule_api_controller_update_vasp_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - @typing.overload - def _travel_rule_api_controller_update_vasp_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _travel_rule_api_controller_update_vasp_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _travel_rule_api_controller_update_vasp_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _travel_rule_api_controller_update_vasp_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _travel_rule_api_controller_update_vasp_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): """ Add jsonDidKey to VASP details - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(travel_rule_update_vasp_details, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_travel_rule_update_vasp_details.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_travel_rule_update_vasp_details.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='put'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -205,75 +133,8 @@ class BaseApi(api_client.Api): class TravelRuleApiControllerUpdateVasp(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def travel_rule_api_controller_update_vasp( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def travel_rule_api_controller_update_vasp( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def travel_rule_api_controller_update_vasp( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def travel_rule_api_controller_update_vasp( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def travel_rule_api_controller_update_vasp( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._travel_rule_api_controller_update_vasp_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def travel_rule_api_controller_update_vasp(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): + return self._travel_rule_api_controller_update_vasp_oapg(params, request_options) class ApiForput(BaseApi): @@ -341,12 +202,12 @@ class ApiForput(BaseApi): skip_deserialization: bool = False, ): return self._travel_rule_api_controller_update_vasp_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/screening_travel_rule_transaction_validate/post.py b/fireblocks_client/paths/screening_travel_rule_transaction_validate/post.py index 13f6e880..57285847 100644 --- a/fireblocks_client/paths/screening_travel_rule_transaction_validate/post.py +++ b/fireblocks_client/paths/screening_travel_rule_transaction_validate/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -32,13 +26,11 @@ # body param SchemaForRequestBodyApplicationJson = TravelRuleValidateTransactionRequest - - request_body_travel_rule_validate_transaction_request = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) SchemaFor200ResponseBodyApplicationJson = TravelRuleValidateTransactionResponse @@ -48,18 +40,18 @@ class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) @dataclass @@ -71,7 +63,7 @@ class ApiResponseFor400(api_client.ApiResponse): _response_for_400 = api_client.OpenApiResponse( response_cls=ApiResponseFor400, -) + ) @dataclass @@ -83,7 +75,7 @@ class ApiResponseFor500(api_client.ApiResponse): _response_for_500 = api_client.OpenApiResponse( response_cls=ApiResponseFor500, -) + ) _status_code_to_response = { '200': _response_for_200, '400': _response_for_400, @@ -91,114 +83,49 @@ class ApiResponseFor500(api_client.ApiResponse): } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _validate_travel_rule_transaction_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _validate_travel_rule_transaction_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _validate_travel_rule_transaction_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _validate_travel_rule_transaction_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _validate_travel_rule_transaction_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _validate_travel_rule_transaction_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): """ Validate Travel Rule Transaction - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(travel_rule_validate_transaction_request, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_travel_rule_validate_transaction_request.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_travel_rule_validate_transaction_request.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -213,75 +140,8 @@ class instances class ValidateTravelRuleTransaction(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def validate_travel_rule_transaction( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def validate_travel_rule_transaction( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def validate_travel_rule_transaction( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def validate_travel_rule_transaction( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def validate_travel_rule_transaction( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._validate_travel_rule_transaction_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def validate_travel_rule_transaction(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): + return self._validate_travel_rule_transaction_oapg(params, request_options) class ApiForpost(BaseApi): @@ -349,12 +209,12 @@ def post( skip_deserialization: bool = False, ): return self._validate_travel_rule_transaction_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/screening_travel_rule_transaction_validate/post.pyi b/fireblocks_client/paths/screening_travel_rule_transaction_validate/post.pyi index 3651b56d..0c3a2bf5 100644 --- a/fireblocks_client/paths/screening_travel_rule_transaction_validate/post.pyi +++ b/fireblocks_client/paths/screening_travel_rule_transaction_validate/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,15 +22,14 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.travel_rule_validate_transaction_response import TravelRuleValidateTransactionResponse from fireblocks_client.model.travel_rule_validate_transaction_request import TravelRuleValidateTransactionRequest + # body param SchemaForRequestBodyApplicationJson = TravelRuleValidateTransactionRequest - - request_body_travel_rule_validate_transaction_request = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) SchemaFor200ResponseBodyApplicationJson = TravelRuleValidateTransactionResponse @@ -46,18 +39,18 @@ SchemaFor200ResponseBodyApplicationJson = TravelRuleValidateTransactionResponse class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) @dataclass @@ -69,7 +62,7 @@ class ApiResponseFor400(api_client.ApiResponse): _response_for_400 = api_client.OpenApiResponse( response_cls=ApiResponseFor400, -) + ) @dataclass @@ -81,117 +74,52 @@ class ApiResponseFor500(api_client.ApiResponse): _response_for_500 = api_client.OpenApiResponse( response_cls=ApiResponseFor500, -) + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _validate_travel_rule_transaction_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - @typing.overload - def _validate_travel_rule_transaction_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _validate_travel_rule_transaction_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _validate_travel_rule_transaction_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _validate_travel_rule_transaction_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _validate_travel_rule_transaction_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): """ Validate Travel Rule Transaction - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(travel_rule_validate_transaction_request, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_travel_rule_validate_transaction_request.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_travel_rule_validate_transaction_request.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -206,75 +134,8 @@ class BaseApi(api_client.Api): class ValidateTravelRuleTransaction(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def validate_travel_rule_transaction( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def validate_travel_rule_transaction( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def validate_travel_rule_transaction( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def validate_travel_rule_transaction( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def validate_travel_rule_transaction( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._validate_travel_rule_transaction_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def validate_travel_rule_transaction(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): + return self._validate_travel_rule_transaction_oapg(params, request_options) class ApiForpost(BaseApi): @@ -342,12 +203,12 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._validate_travel_rule_transaction_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/screening_travel_rule_transaction_validate_full/post.py b/fireblocks_client/paths/screening_travel_rule_transaction_validate_full/post.py index 35c2044f..8a8b412d 100644 --- a/fireblocks_client/paths/screening_travel_rule_transaction_validate_full/post.py +++ b/fireblocks_client/paths/screening_travel_rule_transaction_validate_full/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -32,13 +26,11 @@ # body param SchemaForRequestBodyApplicationJson = TravelRuleValidateFullTransactionRequest - - request_body_travel_rule_validate_full_transaction_request = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) SchemaFor200ResponseBodyApplicationJson = TravelRuleValidateTransactionResponse @@ -48,18 +40,18 @@ class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) @dataclass @@ -71,7 +63,7 @@ class ApiResponseFor400(api_client.ApiResponse): _response_for_400 = api_client.OpenApiResponse( response_cls=ApiResponseFor400, -) + ) @dataclass @@ -83,7 +75,7 @@ class ApiResponseFor500(api_client.ApiResponse): _response_for_500 = api_client.OpenApiResponse( response_cls=ApiResponseFor500, -) + ) _status_code_to_response = { '200': _response_for_200, '400': _response_for_400, @@ -91,114 +83,49 @@ class ApiResponseFor500(api_client.ApiResponse): } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _validate_full_travel_rule_transaction_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _validate_full_travel_rule_transaction_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _validate_full_travel_rule_transaction_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _validate_full_travel_rule_transaction_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _validate_full_travel_rule_transaction_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _validate_full_travel_rule_transaction_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): """ Validate Full Travel Rule Transaction - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(travel_rule_validate_full_transaction_request, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_travel_rule_validate_full_transaction_request.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_travel_rule_validate_full_transaction_request.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -213,75 +140,8 @@ class instances class ValidateFullTravelRuleTransaction(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def validate_full_travel_rule_transaction( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def validate_full_travel_rule_transaction( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def validate_full_travel_rule_transaction( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def validate_full_travel_rule_transaction( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def validate_full_travel_rule_transaction( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._validate_full_travel_rule_transaction_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def validate_full_travel_rule_transaction(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): + return self._validate_full_travel_rule_transaction_oapg(params, request_options) class ApiForpost(BaseApi): @@ -349,12 +209,12 @@ def post( skip_deserialization: bool = False, ): return self._validate_full_travel_rule_transaction_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/screening_travel_rule_transaction_validate_full/post.pyi b/fireblocks_client/paths/screening_travel_rule_transaction_validate_full/post.pyi index 53dd5d8e..efb8ab0f 100644 --- a/fireblocks_client/paths/screening_travel_rule_transaction_validate_full/post.pyi +++ b/fireblocks_client/paths/screening_travel_rule_transaction_validate_full/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,15 +22,14 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.travel_rule_validate_full_transaction_request import TravelRuleValidateFullTransactionRequest from fireblocks_client.model.travel_rule_validate_transaction_response import TravelRuleValidateTransactionResponse + # body param SchemaForRequestBodyApplicationJson = TravelRuleValidateFullTransactionRequest - - request_body_travel_rule_validate_full_transaction_request = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) SchemaFor200ResponseBodyApplicationJson = TravelRuleValidateTransactionResponse @@ -46,18 +39,18 @@ SchemaFor200ResponseBodyApplicationJson = TravelRuleValidateTransactionResponse class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) @dataclass @@ -69,7 +62,7 @@ class ApiResponseFor400(api_client.ApiResponse): _response_for_400 = api_client.OpenApiResponse( response_cls=ApiResponseFor400, -) + ) @dataclass @@ -81,117 +74,52 @@ class ApiResponseFor500(api_client.ApiResponse): _response_for_500 = api_client.OpenApiResponse( response_cls=ApiResponseFor500, -) + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _validate_full_travel_rule_transaction_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - @typing.overload - def _validate_full_travel_rule_transaction_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def _validate_full_travel_rule_transaction_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _validate_full_travel_rule_transaction_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _validate_full_travel_rule_transaction_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _validate_full_travel_rule_transaction_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): """ Validate Full Travel Rule Transaction - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(travel_rule_validate_full_transaction_request, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_travel_rule_validate_full_transaction_request.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_travel_rule_validate_full_transaction_request.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -206,75 +134,8 @@ class BaseApi(api_client.Api): class ValidateFullTravelRuleTransaction(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def validate_full_travel_rule_transaction( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def validate_full_travel_rule_transaction( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - - @typing.overload - def validate_full_travel_rule_transaction( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def validate_full_travel_rule_transaction( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def validate_full_travel_rule_transaction( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._validate_full_travel_rule_transaction_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def validate_full_travel_rule_transaction(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): + return self._validate_full_travel_rule_transaction_oapg(params, request_options) class ApiForpost(BaseApi): @@ -342,12 +203,12 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._validate_full_travel_rule_transaction_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/screening_travel_rule_vasp/get.py b/fireblocks_client/paths/screening_travel_rule_vasp/get.py index e1a29a6c..a129d238 100644 --- a/fireblocks_client/paths/screening_travel_rule_vasp/get.py +++ b/fireblocks_client/paths/screening_travel_rule_vasp/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -86,117 +80,74 @@ class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams) class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) _status_code_to_response = { '200': _response_for_200, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_vasps_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _get_vasps_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_vasps_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_vasps_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_vasps_oapg(self, params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): """ Get All VASPs - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["order"] = params.get("order") + query_params["per_page"] = params.get("per_page") + query_params["page"] = params.get("page") + query_params["fields"] = params.get("fields") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + used_path = path.value prefix_separator_iterator = None for parameter in ( - request_query_order, - request_query_per_page, - request_query_page, - request_query_fields, - ): + request_query_order, + request_query_per_page, + request_query_page, + request_query_fields, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -211,56 +162,8 @@ class instances class GetVasps(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_vasps( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get_vasps( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_vasps( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_vasps( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_vasps_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_vasps(self ,params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): + return self._get_vasps_oapg(params, request_options) class ApiForget(BaseApi): @@ -310,11 +213,11 @@ def get( skip_deserialization: bool = False, ): return self._get_vasps_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/screening_travel_rule_vasp/get.pyi b/fireblocks_client/paths/screening_travel_rule_vasp/get.pyi index 430e75cd..bf837f33 100644 --- a/fireblocks_client/paths/screening_travel_rule_vasp/get.pyi +++ b/fireblocks_client/paths/screening_travel_rule_vasp/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.travel_rule_get_all_vasps_response import TravelRuleGetAllVASPsResponse + # Query params OrderSchema = schemas.StrSchema PerPageSchema = schemas.NumberSchema @@ -84,114 +79,71 @@ SchemaFor200ResponseBodyApplicationJson = TravelRuleGetAllVASPsResponse class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_vasps_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - @typing.overload - def _get_vasps_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_vasps_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_vasps_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_vasps_oapg(self, params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): """ Get All VASPs - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["order"] = params.get("order") + query_params["per_page"] = params.get("per_page") + query_params["page"] = params.get("page") + query_params["fields"] = params.get("fields") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + used_path = path.value prefix_separator_iterator = None for parameter in ( - request_query_order, - request_query_per_page, - request_query_page, - request_query_fields, - ): + request_query_order, + request_query_per_page, + request_query_page, + request_query_fields, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -206,56 +158,8 @@ class BaseApi(api_client.Api): class GetVasps(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_vasps( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get_vasps( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_vasps( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_vasps( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_vasps_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_vasps(self ,params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): + return self._get_vasps_oapg(params, request_options) class ApiForget(BaseApi): @@ -305,11 +209,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_vasps_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/screening_travel_rule_vasp_did/get.py b/fireblocks_client/paths/screening_travel_rule_vasp_did/get.py index 71f41885..4be746ec 100644 --- a/fireblocks_client/paths/screening_travel_rule_vasp_did/get.py +++ b/fireblocks_client/paths/screening_travel_rule_vasp_did/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -88,18 +82,18 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) @dataclass @@ -111,7 +105,7 @@ class ApiResponseFor400(api_client.ApiResponse): _response_for_400 = api_client.OpenApiResponse( response_cls=ApiResponseFor400, -) + ) @dataclass @@ -123,7 +117,7 @@ class ApiResponseFor500(api_client.ApiResponse): _response_for_500 = api_client.OpenApiResponse( response_cls=ApiResponseFor500, -) + ) _status_code_to_response = { '200': _response_for_200, '400': _response_for_400, @@ -131,65 +125,26 @@ class ApiResponseFor500(api_client.ApiResponse): } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_vaspby_did_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _get_vaspby_did_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_vaspby_did_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_vaspby_did_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_vaspby_did_oapg(self, params: typing.Union[RequestQueryParams,RequestPathParams] = None, request_options: RequestOptions = None): """ Get VASP details - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["fields"] = params.get("fields") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + path_params = {} + for parameter in ( + request_path_did, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -207,39 +162,34 @@ class instances prefix_separator_iterator = None for parameter in ( - request_query_fields, - ): + request_query_fields, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -254,61 +204,8 @@ class instances class GetVaspbyDid(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_vaspby_did( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get_vaspby_did( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_vaspby_did( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_vaspby_did( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_vaspby_did_oapg( - query_params=query_params, - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_vaspby_did(self ,params: typing.Union[RequestQueryParams,RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_vaspby_did_oapg(params, request_options) class ApiForget(BaseApi): @@ -362,12 +259,12 @@ def get( skip_deserialization: bool = False, ): return self._get_vaspby_did_oapg( - query_params=query_params, - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/screening_travel_rule_vasp_did/get.pyi b/fireblocks_client/paths/screening_travel_rule_vasp_did/get.pyi index c3d90065..74885c36 100644 --- a/fireblocks_client/paths/screening_travel_rule_vasp_did/get.pyi +++ b/fireblocks_client/paths/screening_travel_rule_vasp_did/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.travel_rule_vasp import TravelRuleVASP + # Query params FieldsSchema = schemas.StrSchema RequestRequiredQueryParams = typing_extensions.TypedDict( @@ -86,18 +81,18 @@ SchemaFor200ResponseBodyApplicationJson = TravelRuleVASP class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBodyApplicationJson, - ] + SchemaFor200ResponseBodyApplicationJson, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor200ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor200ResponseBodyApplicationJson), }, -) + ) @dataclass @@ -109,7 +104,7 @@ class ApiResponseFor400(api_client.ApiResponse): _response_for_400 = api_client.OpenApiResponse( response_cls=ApiResponseFor400, -) + ) @dataclass @@ -121,68 +116,29 @@ class ApiResponseFor500(api_client.ApiResponse): _response_for_500 = api_client.OpenApiResponse( response_cls=ApiResponseFor500, -) + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_vaspby_did_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _get_vaspby_did_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_vaspby_did_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_vaspby_did_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_vaspby_did_oapg(self, params: typing.Union[RequestQueryParams,RequestPathParams] = None, request_options: RequestOptions = None): """ Get VASP details - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["fields"] = params.get("fields") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + path_params = {} + for parameter in ( + request_path_did, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -200,39 +156,34 @@ class BaseApi(api_client.Api): prefix_separator_iterator = None for parameter in ( - request_query_fields, - ): + request_query_fields, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -247,61 +198,8 @@ class BaseApi(api_client.Api): class GetVaspbyDid(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_vaspby_did( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get_vaspby_did( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_vaspby_did( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_vaspby_did( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_vaspby_did_oapg( - query_params=query_params, - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_vaspby_did(self ,params: typing.Union[RequestQueryParams,RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_vaspby_did_oapg(params, request_options) class ApiForget(BaseApi): @@ -355,12 +253,12 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_vaspby_did_oapg( - query_params=query_params, - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/supported_assets/get.py b/fireblocks_client/paths/supported_assets/get.py index a11bacc2..934b0747 100644 --- a/fireblocks_client/paths/supported_assets/get.py +++ b/fireblocks_client/paths/supported_assets/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -32,9 +26,9 @@ XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) @@ -74,26 +68,26 @@ def __getitem__(self, i: int) -> 'AssetTypeResponse': class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -108,21 +102,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -130,85 +124,39 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_supported_assets_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_supported_assets_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_supported_assets_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_supported_assets_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_supported_assets_oapg(self, request_options: RequestOptions = None): """ List all asset types supported by Fireblocks - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -223,53 +171,8 @@ class instances class GetSupportedAssets(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_supported_assets( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_supported_assets( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_supported_assets( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_supported_assets( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_supported_assets_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_supported_assets(self , request_options: RequestOptions = None): + return self._get_supported_assets_oapg(request_options) class ApiForget(BaseApi): @@ -317,10 +220,10 @@ def get( skip_deserialization: bool = False, ): return self._get_supported_assets_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/supported_assets/get.pyi b/fireblocks_client/paths/supported_assets/get.pyi index cc1803f0..e58e1a4a 100644 --- a/fireblocks_client/paths/supported_assets/get.pyi +++ b/fireblocks_client/paths/supported_assets/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.asset_type_response import AssetTypeResponse from fireblocks_client.model.error import Error + XRequestIDSchema = schemas.StrSchema @@ -67,21 +62,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -96,103 +91,57 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_supported_assets_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_supported_assets_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_supported_assets_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_supported_assets_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_supported_assets_oapg(self, request_options: RequestOptions = None): """ List all asset types supported by Fireblocks - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -207,53 +156,8 @@ class BaseApi(api_client.Api): class GetSupportedAssets(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_supported_assets( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_supported_assets( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_supported_assets( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_supported_assets( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_supported_assets_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_supported_assets(self , request_options: RequestOptions = None): + return self._get_supported_assets_oapg(request_options) class ApiForget(BaseApi): @@ -301,10 +205,10 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_supported_assets_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/tap_active_policy/get.py b/fireblocks_client/paths/tap_active_policy/get.py index cef6e184..d0478a23 100644 --- a/fireblocks_client/paths/tap_active_policy/get.py +++ b/fireblocks_client/paths/tap_active_policy/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -32,9 +26,9 @@ XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = PolicyAndValidationResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -49,26 +43,26 @@ class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -83,21 +77,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -105,85 +99,39 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_active_policy_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_active_policy_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_active_policy_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_active_policy_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_active_policy_oapg(self, request_options: RequestOptions = None): """ Get the active policy and its validation - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -198,53 +146,8 @@ class instances class GetActivePolicy(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_active_policy( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_active_policy( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_active_policy( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_active_policy( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_active_policy_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_active_policy(self , request_options: RequestOptions = None): + return self._get_active_policy_oapg(request_options) class ApiForget(BaseApi): @@ -292,10 +195,10 @@ def get( skip_deserialization: bool = False, ): return self._get_active_policy_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/tap_active_policy/get.pyi b/fireblocks_client/paths/tap_active_policy/get.pyi index e78f3db4..9d9cb052 100644 --- a/fireblocks_client/paths/tap_active_policy/get.pyi +++ b/fireblocks_client/paths/tap_active_policy/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error from fireblocks_client.model.policy_and_validation_response import PolicyAndValidationResponse + XRequestIDSchema = schemas.StrSchema SchemaFor200ResponseBody = PolicyAndValidationResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -42,21 +37,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -71,103 +66,57 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_active_policy_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_active_policy_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_active_policy_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_active_policy_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_active_policy_oapg(self, request_options: RequestOptions = None): """ Get the active policy and its validation - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -182,53 +131,8 @@ class BaseApi(api_client.Api): class GetActivePolicy(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_active_policy( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_active_policy( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_active_policy( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_active_policy( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_active_policy_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_active_policy(self , request_options: RequestOptions = None): + return self._get_active_policy_oapg(request_options) class ApiForget(BaseApi): @@ -276,10 +180,10 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_active_policy_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/tap_draft/get.py b/fireblocks_client/paths/tap_draft/get.py index 1b09a80c..18e76cd9 100644 --- a/fireblocks_client/paths/tap_draft/get.py +++ b/fireblocks_client/paths/tap_draft/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -32,9 +26,9 @@ XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = DraftReviewAndValidationResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -49,26 +43,26 @@ class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -83,21 +77,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -105,85 +99,39 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_draft_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_draft_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_draft_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_draft_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_draft_oapg(self, request_options: RequestOptions = None): """ Get the active draft - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -198,53 +146,8 @@ class instances class GetDraft(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_draft( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_draft( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_draft( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_draft( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_draft_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_draft(self , request_options: RequestOptions = None): + return self._get_draft_oapg(request_options) class ApiForget(BaseApi): @@ -292,10 +195,10 @@ def get( skip_deserialization: bool = False, ): return self._get_draft_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/tap_draft/get.pyi b/fireblocks_client/paths/tap_draft/get.pyi index 159a324c..e0ca43ea 100644 --- a/fireblocks_client/paths/tap_draft/get.pyi +++ b/fireblocks_client/paths/tap_draft/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.draft_review_and_validation_response import DraftReviewAndValidationResponse from fireblocks_client.model.error import Error + XRequestIDSchema = schemas.StrSchema SchemaFor200ResponseBody = DraftReviewAndValidationResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -42,21 +37,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -71,103 +66,57 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_draft_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_draft_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_draft_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_draft_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_draft_oapg(self, request_options: RequestOptions = None): """ Get the active draft - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -182,53 +131,8 @@ class BaseApi(api_client.Api): class GetDraft(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_draft( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_draft( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_draft( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_draft( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_draft_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_draft(self , request_options: RequestOptions = None): + return self._get_draft_oapg(request_options) class ApiForget(BaseApi): @@ -276,10 +180,10 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_draft_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/tap_draft/post.py b/fireblocks_client/paths/tap_draft/post.py index 8a929681..b7f67320 100644 --- a/fireblocks_client/paths/tap_draft/post.py +++ b/fireblocks_client/paths/tap_draft/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -82,20 +76,18 @@ def __new__( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor201ResponseBody = PublishResult ResponseHeadersFor201 = typing_extensions.TypedDict( @@ -110,26 +102,26 @@ def __new__( class ApiResponseFor201(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor201ResponseBody, - ] + SchemaFor201ResponseBody, + ] headers: ResponseHeadersFor201 _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, content={ - '*/*': api_client.MediaType( - schema=SchemaFor201ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor201ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -144,21 +136,21 @@ class ApiResponseFor201(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '201': _response_for_201, 'default': _response_for_default, @@ -166,121 +158,53 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _publish_draft_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _publish_draft_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _publish_draft_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _publish_draft_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _publish_draft_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _publish_draft_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): """ Send publish request for a certain draft id - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(any_type, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -295,78 +219,8 @@ class instances class PublishDraft(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def publish_draft( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def publish_draft( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def publish_draft( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def publish_draft( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def publish_draft( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._publish_draft_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def publish_draft(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): + return self._publish_draft_oapg(params, request_options) class ApiForpost(BaseApi): @@ -437,12 +291,12 @@ def post( skip_deserialization: bool = False, ): return self._publish_draft_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/tap_draft/post.pyi b/fireblocks_client/paths/tap_draft/post.pyi index 72a8e66b..b2221808 100644 --- a/fireblocks_client/paths/tap_draft/post.pyi +++ b/fireblocks_client/paths/tap_draft/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.publish_result import PublishResult from fireblocks_client.model.error import Error + # body param @@ -80,13 +75,11 @@ class SchemaForRequestBodyApplicationJson( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema @@ -103,21 +96,21 @@ ResponseHeadersFor201 = typing_extensions.TypedDict( class ApiResponseFor201(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor201ResponseBody, - ] + SchemaFor201ResponseBody, + ] headers: ResponseHeadersFor201 _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, content={ - '*/*': api_client.MediaType( - schema=SchemaFor201ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor201ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -132,139 +125,71 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _publish_draft_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _publish_draft_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _publish_draft_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _publish_draft_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _publish_draft_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _publish_draft_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): """ Send publish request for a certain draft id - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(any_type, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -279,78 +204,8 @@ class BaseApi(api_client.Api): class PublishDraft(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def publish_draft( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def publish_draft( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def publish_draft( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def publish_draft( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def publish_draft( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._publish_draft_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def publish_draft(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): + return self._publish_draft_oapg(params, request_options) class ApiForpost(BaseApi): @@ -421,12 +276,12 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._publish_draft_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/tap_draft/put.py b/fireblocks_client/paths/tap_draft/put.py index 8be34faa..4feae5ad 100644 --- a/fireblocks_client/paths/tap_draft/put.py +++ b/fireblocks_client/paths/tap_draft/put.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -108,20 +102,18 @@ def __new__( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = DraftReviewAndValidationResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -136,26 +128,26 @@ def __new__( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -170,21 +162,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -192,121 +184,53 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _update_draft_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _update_draft_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _update_draft_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_draft_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _update_draft_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _update_draft_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): """ Update the draft with a new set of rules - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(any_type, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='put'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -321,78 +245,8 @@ class instances class UpdateDraft(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def update_draft( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def update_draft( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def update_draft( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_draft( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def update_draft( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_draft_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def update_draft(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): + return self._update_draft_oapg(params, request_options) class ApiForput(BaseApi): @@ -463,12 +317,12 @@ def put( skip_deserialization: bool = False, ): return self._update_draft_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/tap_draft/put.pyi b/fireblocks_client/paths/tap_draft/put.pyi index 89a143e5..5c19009d 100644 --- a/fireblocks_client/paths/tap_draft/put.pyi +++ b/fireblocks_client/paths/tap_draft/put.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -29,6 +23,7 @@ from fireblocks_client.model.policy_rule import PolicyRule from fireblocks_client.model.draft_review_and_validation_response import DraftReviewAndValidationResponse from fireblocks_client.model.error import Error + # body param @@ -106,13 +101,11 @@ class SchemaForRequestBodyApplicationJson( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema @@ -129,21 +122,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -158,139 +151,71 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _update_draft_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _update_draft_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _update_draft_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_draft_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _update_draft_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _update_draft_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): """ Update the draft with a new set of rules - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(any_type, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='put'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -305,78 +230,8 @@ class BaseApi(api_client.Api): class UpdateDraft(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def update_draft( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def update_draft( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def update_draft( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_draft( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def update_draft( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_draft_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def update_draft(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): + return self._update_draft_oapg(params, request_options) class ApiForput(BaseApi): @@ -447,12 +302,12 @@ class ApiForput(BaseApi): skip_deserialization: bool = False, ): return self._update_draft_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/tap_publish/post.py b/fireblocks_client/paths/tap_publish/post.py index abbc612a..e3304d74 100644 --- a/fireblocks_client/paths/tap_publish/post.py +++ b/fireblocks_client/paths/tap_publish/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -108,20 +102,18 @@ def __new__( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor201ResponseBody = PublishResult ResponseHeadersFor201 = typing_extensions.TypedDict( @@ -136,26 +128,26 @@ def __new__( class ApiResponseFor201(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor201ResponseBody, - ] + SchemaFor201ResponseBody, + ] headers: ResponseHeadersFor201 _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, content={ - '*/*': api_client.MediaType( - schema=SchemaFor201ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor201ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -170,21 +162,21 @@ class ApiResponseFor201(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '201': _response_for_201, 'default': _response_for_default, @@ -192,121 +184,53 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _publish_policy_rules_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _publish_policy_rules_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _publish_policy_rules_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _publish_policy_rules_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _publish_policy_rules_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _publish_policy_rules_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): """ Send publish request for a set of policy rules - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(any_type, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -321,78 +245,8 @@ class instances class PublishPolicyRules(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def publish_policy_rules( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def publish_policy_rules( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def publish_policy_rules( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def publish_policy_rules( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def publish_policy_rules( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._publish_policy_rules_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def publish_policy_rules(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): + return self._publish_policy_rules_oapg(params, request_options) class ApiForpost(BaseApi): @@ -463,12 +317,12 @@ def post( skip_deserialization: bool = False, ): return self._publish_policy_rules_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/tap_publish/post.pyi b/fireblocks_client/paths/tap_publish/post.pyi index 2e1c6f50..116de25c 100644 --- a/fireblocks_client/paths/tap_publish/post.pyi +++ b/fireblocks_client/paths/tap_publish/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -29,6 +23,7 @@ from fireblocks_client.model.policy_rule import PolicyRule from fireblocks_client.model.publish_result import PublishResult from fireblocks_client.model.error import Error + # body param @@ -106,13 +101,11 @@ class SchemaForRequestBodyApplicationJson( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema @@ -129,21 +122,21 @@ ResponseHeadersFor201 = typing_extensions.TypedDict( class ApiResponseFor201(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor201ResponseBody, - ] + SchemaFor201ResponseBody, + ] headers: ResponseHeadersFor201 _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, content={ - '*/*': api_client.MediaType( - schema=SchemaFor201ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor201ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -158,139 +151,71 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _publish_policy_rules_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _publish_policy_rules_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _publish_policy_rules_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _publish_policy_rules_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _publish_policy_rules_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _publish_policy_rules_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): """ Send publish request for a set of policy rules - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(any_type, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -305,78 +230,8 @@ class BaseApi(api_client.Api): class PublishPolicyRules(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def publish_policy_rules( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def publish_policy_rules( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def publish_policy_rules( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def publish_policy_rules( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def publish_policy_rules( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._publish_policy_rules_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def publish_policy_rules(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): + return self._publish_policy_rules_oapg(params, request_options) class ApiForpost(BaseApi): @@ -447,12 +302,12 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._publish_policy_rules_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/transactions/get.py b/fireblocks_client/paths/transactions/get.py index 4e27ad18..afceea29 100644 --- a/fireblocks_client/paths/transactions/get.py +++ b/fireblocks_client/paths/transactions/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -302,21 +296,21 @@ class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams) ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) NextPageSchema = schemas.StrSchema next_page_parameter = api_client.HeaderParameter( - name="next-page", +name="next-page", style=api_client.ParameterStyle.SIMPLE, - schema=NextPageSchema, + schema=NextPageSchema, ) PrevPageSchema = schemas.StrSchema prev_page_parameter = api_client.HeaderParameter( - name="prev-page", +name="prev-page", style=api_client.ParameterStyle.SIMPLE, - schema=PrevPageSchema, + schema=PrevPageSchema, ) @@ -358,28 +352,28 @@ def __getitem__(self, i: int) -> 'TransactionResponse': class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - next_page_parameter, - prev_page_parameter, - ] -) + x_request_id_parameter, + next_page_parameter, + prev_page_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -394,21 +388,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -416,116 +410,81 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_transactions_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_transactions_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_transactions_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_transactions_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_transactions_oapg(self, params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): """ List transaction history - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["before"] = params.get("before") + query_params["after"] = params.get("after") + query_params["status"] = params.get("status") + query_params["order_by"] = params.get("order_by") + query_params["sort"] = params.get("sort") + query_params["limit"] = params.get("limit") + query_params["source_type"] = params.get("source_type") + query_params["source_id"] = params.get("source_id") + query_params["dest_type"] = params.get("dest_type") + query_params["dest_id"] = params.get("dest_id") + query_params["assets"] = params.get("assets") + query_params["tx_hash"] = params.get("tx_hash") + query_params["source_wallet_id"] = params.get("source_wallet_id") + query_params["dest_wallet_id"] = params.get("dest_wallet_id") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + used_path = path.value prefix_separator_iterator = None for parameter in ( - request_query_before, - request_query_after, - request_query_status, - request_query_order_by, - request_query_sort, - request_query_limit, - request_query_source_type, - request_query_source_id, - request_query_dest_type, - request_query_dest_id, - request_query_assets, - request_query_tx_hash, - request_query_source_wallet_id, - request_query_dest_wallet_id, - ): + request_query_before, + request_query_after, + request_query_status, + request_query_order_by, + request_query_sort, + request_query_limit, + request_query_source_type, + request_query_source_id, + request_query_dest_type, + request_query_dest_id, + request_query_assets, + request_query_tx_hash, + request_query_source_wallet_id, + request_query_dest_wallet_id, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -540,58 +499,8 @@ class instances class GetTransactions(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_transactions( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_transactions( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_transactions( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_transactions( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_transactions_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_transactions(self ,params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): + return self._get_transactions_oapg(params, request_options) class ApiForget(BaseApi): @@ -643,11 +552,11 @@ def get( skip_deserialization: bool = False, ): return self._get_transactions_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/transactions/get.pyi b/fireblocks_client/paths/transactions/get.pyi index c18d49bf..cb59a6cf 100644 --- a/fireblocks_client/paths/transactions/get.pyi +++ b/fireblocks_client/paths/transactions/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error from fireblocks_client.model.transaction_response import TransactionResponse + # Query params BeforeSchema = schemas.StrSchema AfterSchema = schemas.StrSchema @@ -295,23 +290,23 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - next_page_parameter, - prev_page_parameter, - ] -) + x_request_id_parameter, + next_page_parameter, + prev_page_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -326,134 +321,99 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_transactions_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_transactions_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_transactions_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_transactions_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_transactions_oapg(self, params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): """ List transaction history - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["before"] = params.get("before") + query_params["after"] = params.get("after") + query_params["status"] = params.get("status") + query_params["order_by"] = params.get("order_by") + query_params["sort"] = params.get("sort") + query_params["limit"] = params.get("limit") + query_params["source_type"] = params.get("source_type") + query_params["source_id"] = params.get("source_id") + query_params["dest_type"] = params.get("dest_type") + query_params["dest_id"] = params.get("dest_id") + query_params["assets"] = params.get("assets") + query_params["tx_hash"] = params.get("tx_hash") + query_params["source_wallet_id"] = params.get("source_wallet_id") + query_params["dest_wallet_id"] = params.get("dest_wallet_id") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + used_path = path.value prefix_separator_iterator = None for parameter in ( - request_query_before, - request_query_after, - request_query_status, - request_query_order_by, - request_query_sort, - request_query_limit, - request_query_source_type, - request_query_source_id, - request_query_dest_type, - request_query_dest_id, - request_query_assets, - request_query_tx_hash, - request_query_source_wallet_id, - request_query_dest_wallet_id, - ): + request_query_before, + request_query_after, + request_query_status, + request_query_order_by, + request_query_sort, + request_query_limit, + request_query_source_type, + request_query_source_id, + request_query_dest_type, + request_query_dest_id, + request_query_assets, + request_query_tx_hash, + request_query_source_wallet_id, + request_query_dest_wallet_id, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -468,58 +428,8 @@ class BaseApi(api_client.Api): class GetTransactions(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_transactions( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_transactions( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_transactions( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_transactions( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_transactions_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_transactions(self ,params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): + return self._get_transactions_oapg(params, request_options) class ApiForget(BaseApi): @@ -571,11 +481,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_transactions_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/transactions/post.py b/fireblocks_client/paths/transactions/post.py index febb3e7c..9495e108 100644 --- a/fireblocks_client/paths/transactions/post.py +++ b/fireblocks_client/paths/transactions/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -33,19 +27,17 @@ # body param SchemaForRequestBodyApplicationJson = TransactionRequest - - request_body_transaction_request = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = CreateTransactionResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -60,26 +52,26 @@ class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -94,21 +86,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -116,119 +108,55 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_transaction_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _create_transaction_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _create_transaction_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_transaction_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _create_transaction_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_transaction_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): """ Create a new transaction - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_transaction_request.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_transaction_request.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + if (params.get("source", {}).get("type") == 'END_USER_WALLET' and not request_options.get("ncw", {}).get("walletId")): + walletId = request_options.get("data", {}).get("source", {}).get("walletId") + + ncw_wallet_id = request_options.get("ncw", {}).get("walletId") + if ncw_wallet_id: + _headers.add("X-End-User-Wallet-Id", ncwWalletId) + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -243,78 +171,8 @@ class instances class CreateTransaction(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create_transaction( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def create_transaction( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def create_transaction( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_transaction( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_transaction( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_transaction_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create_transaction(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): + return self._create_transaction_oapg(params, request_options) class ApiForpost(BaseApi): @@ -385,12 +243,12 @@ def post( skip_deserialization: bool = False, ): return self._create_transaction_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/transactions/post.pyi b/fireblocks_client/paths/transactions/post.pyi index abe4e2a7..2ef29676 100644 --- a/fireblocks_client/paths/transactions/post.pyi +++ b/fireblocks_client/paths/transactions/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -29,15 +23,14 @@ from fireblocks_client.model.transaction_request import TransactionRequest from fireblocks_client.model.error import Error from fireblocks_client.model.create_transaction_response import CreateTransactionResponse + # body param SchemaForRequestBodyApplicationJson = TransactionRequest - - request_body_transaction_request = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema SchemaFor200ResponseBody = CreateTransactionResponse @@ -53,21 +46,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -82,137 +75,73 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_transaction_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _create_transaction_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _create_transaction_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_transaction_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _create_transaction_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_transaction_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): """ Create a new transaction - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_transaction_request.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_transaction_request.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + if (params.get("source", {}).get("type") == 'END_USER_WALLET' and not request_options.get("ncw", {}).get("walletId")): + walletId = request_options.get("data", {}).get("source", {}).get("walletId") + + ncw_wallet_id = request_options.get("ncw", {}).get("walletId") + if ncw_wallet_id: + _headers.add("X-End-User-Wallet-Id", ncwWalletId) + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -227,78 +156,8 @@ class BaseApi(api_client.Api): class CreateTransaction(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create_transaction( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def create_transaction( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def create_transaction( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_transaction( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_transaction( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_transaction_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create_transaction(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): + return self._create_transaction_oapg(params, request_options) class ApiForpost(BaseApi): @@ -369,12 +228,12 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._create_transaction_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/transactions_estimate_fee/post.py b/fireblocks_client/paths/transactions_estimate_fee/post.py index 928eb295..339466f1 100644 --- a/fireblocks_client/paths/transactions_estimate_fee/post.py +++ b/fireblocks_client/paths/transactions_estimate_fee/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -33,19 +27,17 @@ # body param SchemaForRequestBodyApplicationJson = TransactionRequest - - request_body_transaction_request = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = EstimatedTransactionFeeResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -60,26 +52,26 @@ class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -94,21 +86,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -116,119 +108,49 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _estimate_transaction_fee_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _estimate_transaction_fee_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _estimate_transaction_fee_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _estimate_transaction_fee_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _estimate_transaction_fee_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _estimate_transaction_fee_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): """ Estimate transaction fee - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_transaction_request.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_transaction_request.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -243,78 +165,8 @@ class instances class EstimateTransactionFee(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def estimate_transaction_fee( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def estimate_transaction_fee( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def estimate_transaction_fee( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def estimate_transaction_fee( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def estimate_transaction_fee( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._estimate_transaction_fee_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def estimate_transaction_fee(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): + return self._estimate_transaction_fee_oapg(params, request_options) class ApiForpost(BaseApi): @@ -385,12 +237,12 @@ def post( skip_deserialization: bool = False, ): return self._estimate_transaction_fee_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/transactions_estimate_fee/post.pyi b/fireblocks_client/paths/transactions_estimate_fee/post.pyi index 9d50931d..1f6691e2 100644 --- a/fireblocks_client/paths/transactions_estimate_fee/post.pyi +++ b/fireblocks_client/paths/transactions_estimate_fee/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -29,15 +23,14 @@ from fireblocks_client.model.transaction_request import TransactionRequest from fireblocks_client.model.error import Error from fireblocks_client.model.estimated_transaction_fee_response import EstimatedTransactionFeeResponse + # body param SchemaForRequestBodyApplicationJson = TransactionRequest - - request_body_transaction_request = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema SchemaFor200ResponseBody = EstimatedTransactionFeeResponse @@ -53,21 +46,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -82,137 +75,67 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _estimate_transaction_fee_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _estimate_transaction_fee_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _estimate_transaction_fee_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _estimate_transaction_fee_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _estimate_transaction_fee_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _estimate_transaction_fee_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): """ Estimate transaction fee - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_transaction_request.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_transaction_request.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -227,78 +150,8 @@ class BaseApi(api_client.Api): class EstimateTransactionFee(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def estimate_transaction_fee( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def estimate_transaction_fee( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def estimate_transaction_fee( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def estimate_transaction_fee( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def estimate_transaction_fee( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._estimate_transaction_fee_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def estimate_transaction_fee(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): + return self._estimate_transaction_fee_oapg(params, request_options) class ApiForpost(BaseApi): @@ -369,12 +222,12 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._estimate_transaction_fee_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/transactions_external_tx_id_external_tx_id_/get.py b/fireblocks_client/paths/transactions_external_tx_id_external_tx_id_/get.py index dee6fd15..cdb8b7ed 100644 --- a/fireblocks_client/paths/transactions_external_tx_id_external_tx_id_/get.py +++ b/fireblocks_client/paths/transactions_external_tx_id_external_tx_id_/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -58,9 +52,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = TransactionResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -75,26 +69,26 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -109,21 +103,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -131,62 +125,23 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_transaction_by_external_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_transaction_by_external_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_transaction_by_external_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_transaction_by_external_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_transaction_by_external_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Find a specific transaction by external transaction ID - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_external_tx_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -201,33 +156,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -242,58 +192,8 @@ class instances class GetTransactionByExternalId(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_transaction_by_external_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_transaction_by_external_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_transaction_by_external_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_transaction_by_external_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_transaction_by_external_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_transaction_by_external_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_transaction_by_external_id_oapg(params, request_options) class ApiForget(BaseApi): @@ -345,11 +245,11 @@ def get( skip_deserialization: bool = False, ): return self._get_transaction_by_external_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/transactions_external_tx_id_external_tx_id_/get.pyi b/fireblocks_client/paths/transactions_external_tx_id_external_tx_id_/get.pyi index ce45fb50..024a1af5 100644 --- a/fireblocks_client/paths/transactions_external_tx_id_external_tx_id_/get.pyi +++ b/fireblocks_client/paths/transactions_external_tx_id_external_tx_id_/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error from fireblocks_client.model.transaction_response import TransactionResponse + # Path params ExternalTxIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -68,21 +63,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -97,80 +92,41 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_transaction_by_external_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_transaction_by_external_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_transaction_by_external_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_transaction_by_external_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_transaction_by_external_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Find a specific transaction by external transaction ID - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_external_tx_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -185,33 +141,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -226,58 +177,8 @@ class BaseApi(api_client.Api): class GetTransactionByExternalId(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_transaction_by_external_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_transaction_by_external_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_transaction_by_external_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_transaction_by_external_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_transaction_by_external_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_transaction_by_external_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_transaction_by_external_id_oapg(params, request_options) class ApiForget(BaseApi): @@ -329,11 +230,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_transaction_by_external_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/transactions_tx_id/get.py b/fireblocks_client/paths/transactions_tx_id/get.py index d515a3a8..a3027348 100644 --- a/fireblocks_client/paths/transactions_tx_id/get.py +++ b/fireblocks_client/paths/transactions_tx_id/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -58,9 +52,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = TransactionResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -75,26 +69,26 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor400ResponseBodyApplicationJson = Error ResponseHeadersFor400 = typing_extensions.TypedDict( @@ -109,26 +103,26 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseFor400(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor400ResponseBodyApplicationJson, - ] + SchemaFor400ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor400 _response_for_400 = api_client.OpenApiResponse( response_cls=ApiResponseFor400, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor400ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor400ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -143,21 +137,21 @@ class ApiResponseFor400(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, '400': _response_for_400, @@ -166,62 +160,23 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_transaction_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_transaction_by_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_transaction_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_transaction_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_transaction_by_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Find a specific transaction by Fireblocks transaction ID - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_tx_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -236,33 +191,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -277,58 +227,8 @@ class instances class GetTransactionById(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_transaction_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_transaction_by_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_transaction_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_transaction_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_transaction_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_transaction_by_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_transaction_by_id_oapg(params, request_options) class ApiForget(BaseApi): @@ -380,11 +280,11 @@ def get( skip_deserialization: bool = False, ): return self._get_transaction_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/transactions_tx_id/get.pyi b/fireblocks_client/paths/transactions_tx_id/get.pyi index bee953cd..34c41855 100644 --- a/fireblocks_client/paths/transactions_tx_id/get.pyi +++ b/fireblocks_client/paths/transactions_tx_id/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error from fireblocks_client.model.transaction_response import TransactionResponse + # Path params TxIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -68,21 +63,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor400ResponseBodyApplicationJson = Error ResponseHeadersFor400 = typing_extensions.TypedDict( @@ -97,21 +92,21 @@ ResponseHeadersFor400 = typing_extensions.TypedDict( class ApiResponseFor400(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor400ResponseBodyApplicationJson, - ] + SchemaFor400ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor400 _response_for_400 = api_client.OpenApiResponse( response_cls=ApiResponseFor400, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor400ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor400ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -126,80 +121,41 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_transaction_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _get_transaction_by_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_transaction_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_transaction_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_transaction_by_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Find a specific transaction by Fireblocks transaction ID - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_tx_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -214,33 +170,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -255,58 +206,8 @@ class BaseApi(api_client.Api): class GetTransactionById(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_transaction_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_transaction_by_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_transaction_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_transaction_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_transaction_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_transaction_by_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_transaction_by_id_oapg(params, request_options) class ApiForget(BaseApi): @@ -358,11 +259,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_transaction_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/transactions_tx_id_cancel/post.py b/fireblocks_client/paths/transactions_tx_id_cancel/post.py index 4d8378ef..8777cc27 100644 --- a/fireblocks_client/paths/transactions_tx_id_cancel/post.py +++ b/fireblocks_client/paths/transactions_tx_id_cancel/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -58,9 +52,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = CancelTransactionResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -75,26 +69,26 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -109,21 +103,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -131,62 +125,23 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _cancel_transaction_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _cancel_transaction_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _cancel_transaction_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _cancel_transaction_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _cancel_transaction_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Cancel a transaction - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_tx_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -201,33 +156,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -242,58 +192,8 @@ class instances class CancelTransaction(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def cancel_transaction( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def cancel_transaction( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def cancel_transaction( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def cancel_transaction( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._cancel_transaction_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def cancel_transaction(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._cancel_transaction_oapg(params, request_options) class ApiForpost(BaseApi): @@ -345,11 +245,11 @@ def post( skip_deserialization: bool = False, ): return self._cancel_transaction_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/transactions_tx_id_cancel/post.pyi b/fireblocks_client/paths/transactions_tx_id_cancel/post.pyi index 8050f4ae..41ec3dbb 100644 --- a/fireblocks_client/paths/transactions_tx_id_cancel/post.pyi +++ b/fireblocks_client/paths/transactions_tx_id_cancel/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error from fireblocks_client.model.cancel_transaction_response import CancelTransactionResponse + # Path params TxIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -68,21 +63,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -97,80 +92,41 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _cancel_transaction_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _cancel_transaction_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _cancel_transaction_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _cancel_transaction_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _cancel_transaction_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Cancel a transaction - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_tx_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -185,33 +141,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -226,58 +177,8 @@ class BaseApi(api_client.Api): class CancelTransaction(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def cancel_transaction( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def cancel_transaction( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def cancel_transaction( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def cancel_transaction( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._cancel_transaction_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def cancel_transaction(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._cancel_transaction_oapg(params, request_options) class ApiForpost(BaseApi): @@ -329,11 +230,11 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._cancel_transaction_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/transactions_tx_id_drop/post.py b/fireblocks_client/paths/transactions_tx_id_drop/post.py index 7c8ef378..beebf6d0 100644 --- a/fireblocks_client/paths/transactions_tx_id_drop/post.py +++ b/fireblocks_client/paths/transactions_tx_id_drop/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -59,19 +53,17 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) # body param SchemaForRequestBodyApplicationJson = DropTransactionRequest - - request_body_drop_transaction_request = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = DropTransactionResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -86,26 +78,26 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -120,21 +112,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -142,86 +134,23 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _drop_transaction_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _drop_transaction_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _drop_transaction_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _drop_transaction_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _drop_transaction_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _drop_transaction_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): """ Drop ETH transaction by ID - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_tx_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -236,44 +165,38 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_drop_transaction_request.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_drop_transaction_request.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -288,84 +211,8 @@ class instances class DropTransaction(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def drop_transaction( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def drop_transaction( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def drop_transaction( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def drop_transaction( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def drop_transaction( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._drop_transaction_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def drop_transaction(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): + return self._drop_transaction_oapg(params, request_options) class ApiForpost(BaseApi): @@ -441,13 +288,13 @@ def post( skip_deserialization: bool = False, ): return self._drop_transaction_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/transactions_tx_id_drop/post.pyi b/fireblocks_client/paths/transactions_tx_id_drop/post.pyi index b10a9ab3..6183151a 100644 --- a/fireblocks_client/paths/transactions_tx_id_drop/post.pyi +++ b/fireblocks_client/paths/transactions_tx_id_drop/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -29,6 +23,7 @@ from fireblocks_client.model.drop_transaction_response import DropTransactionRes from fireblocks_client.model.drop_transaction_request import DropTransactionRequest from fireblocks_client.model.error import Error + # Path params TxIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -57,13 +52,11 @@ request_path_tx_id = api_client.PathParameter( ) # body param SchemaForRequestBodyApplicationJson = DropTransactionRequest - - request_body_drop_transaction_request = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema SchemaFor200ResponseBody = DropTransactionResponse @@ -79,21 +72,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -108,104 +101,41 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _drop_transaction_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _drop_transaction_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _drop_transaction_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _drop_transaction_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _drop_transaction_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _drop_transaction_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): """ Drop ETH transaction by ID - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_tx_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -220,44 +150,38 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_drop_transaction_request.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_drop_transaction_request.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -272,84 +196,8 @@ class BaseApi(api_client.Api): class DropTransaction(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def drop_transaction( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def drop_transaction( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def drop_transaction( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def drop_transaction( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def drop_transaction( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._drop_transaction_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def drop_transaction(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): + return self._drop_transaction_oapg(params, request_options) class ApiForpost(BaseApi): @@ -425,13 +273,13 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._drop_transaction_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/transactions_tx_id_freeze/post.py b/fireblocks_client/paths/transactions_tx_id_freeze/post.py index 3646027e..a2a0cac9 100644 --- a/fireblocks_client/paths/transactions_tx_id_freeze/post.py +++ b/fireblocks_client/paths/transactions_tx_id_freeze/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -57,9 +51,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = FreezeTransactionResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -74,80 +68,43 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, } _all_accept_content_types = ( '*/*', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _freeze_transaction_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _freeze_transaction_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _freeze_transaction_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _freeze_transaction_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _freeze_transaction_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Freeze a transaction - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_tx_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -162,29 +119,24 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -199,56 +151,8 @@ class instances class FreezeTransaction(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def freeze_transaction( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def freeze_transaction( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def freeze_transaction( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def freeze_transaction( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._freeze_transaction_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def freeze_transaction(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._freeze_transaction_oapg(params, request_options) class ApiForpost(BaseApi): @@ -298,11 +202,11 @@ def post( skip_deserialization: bool = False, ): return self._freeze_transaction_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/transactions_tx_id_freeze/post.pyi b/fireblocks_client/paths/transactions_tx_id_freeze/post.pyi index f536838c..ae442b2f 100644 --- a/fireblocks_client/paths/transactions_tx_id_freeze/post.pyi +++ b/fireblocks_client/paths/transactions_tx_id_freeze/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.freeze_transaction_response import FreezeTransactionResponse + # Path params TxIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -67,77 +62,40 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _freeze_transaction_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - @typing.overload - def _freeze_transaction_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _freeze_transaction_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _freeze_transaction_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _freeze_transaction_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Freeze a transaction - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_tx_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -152,29 +110,24 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -189,56 +142,8 @@ class BaseApi(api_client.Api): class FreezeTransaction(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def freeze_transaction( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def freeze_transaction( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def freeze_transaction( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def freeze_transaction( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._freeze_transaction_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def freeze_transaction(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._freeze_transaction_oapg(params, request_options) class ApiForpost(BaseApi): @@ -288,11 +193,11 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._freeze_transaction_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/transactions_tx_id_set_confirmation_threshold/post.py b/fireblocks_client/paths/transactions_tx_id_set_confirmation_threshold/post.py index 7d290c41..25de8b83 100644 --- a/fireblocks_client/paths/transactions_tx_id_set_confirmation_threshold/post.py +++ b/fireblocks_client/paths/transactions_tx_id_set_confirmation_threshold/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -59,19 +53,17 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) # body param SchemaForRequestBodyApplicationJson = SetConfirmationsThresholdRequest - - request_body_set_confirmations_threshold_request = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = SetConfirmationsThresholdResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -86,26 +78,26 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -120,21 +112,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -142,86 +134,23 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _set_confirmation_threshold_for_transaction_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _set_confirmation_threshold_for_transaction_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _set_confirmation_threshold_for_transaction_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _set_confirmation_threshold_for_transaction_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _set_confirmation_threshold_for_transaction_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _set_confirmation_threshold_for_transaction_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): """ Set confirmation threshold by transaction ID - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_tx_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -236,44 +165,38 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_set_confirmations_threshold_request.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_set_confirmations_threshold_request.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -288,84 +211,8 @@ class instances class SetConfirmationThresholdForTransaction(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def set_confirmation_threshold_for_transaction( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def set_confirmation_threshold_for_transaction( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def set_confirmation_threshold_for_transaction( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def set_confirmation_threshold_for_transaction( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def set_confirmation_threshold_for_transaction( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._set_confirmation_threshold_for_transaction_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def set_confirmation_threshold_for_transaction(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): + return self._set_confirmation_threshold_for_transaction_oapg(params, request_options) class ApiForpost(BaseApi): @@ -441,13 +288,13 @@ def post( skip_deserialization: bool = False, ): return self._set_confirmation_threshold_for_transaction_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/transactions_tx_id_set_confirmation_threshold/post.pyi b/fireblocks_client/paths/transactions_tx_id_set_confirmation_threshold/post.pyi index 7ac72c6a..1fbc9c59 100644 --- a/fireblocks_client/paths/transactions_tx_id_set_confirmation_threshold/post.pyi +++ b/fireblocks_client/paths/transactions_tx_id_set_confirmation_threshold/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -29,6 +23,7 @@ from fireblocks_client.model.set_confirmations_threshold_response import SetConf from fireblocks_client.model.error import Error from fireblocks_client.model.set_confirmations_threshold_request import SetConfirmationsThresholdRequest + # Path params TxIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -57,13 +52,11 @@ request_path_tx_id = api_client.PathParameter( ) # body param SchemaForRequestBodyApplicationJson = SetConfirmationsThresholdRequest - - request_body_set_confirmations_threshold_request = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema SchemaFor200ResponseBody = SetConfirmationsThresholdResponse @@ -79,21 +72,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -108,104 +101,41 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _set_confirmation_threshold_for_transaction_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _set_confirmation_threshold_for_transaction_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _set_confirmation_threshold_for_transaction_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _set_confirmation_threshold_for_transaction_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _set_confirmation_threshold_for_transaction_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _set_confirmation_threshold_for_transaction_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): """ Set confirmation threshold by transaction ID - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_tx_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -220,44 +150,38 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_set_confirmations_threshold_request.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_set_confirmations_threshold_request.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -272,84 +196,8 @@ class BaseApi(api_client.Api): class SetConfirmationThresholdForTransaction(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def set_confirmation_threshold_for_transaction( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def set_confirmation_threshold_for_transaction( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def set_confirmation_threshold_for_transaction( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def set_confirmation_threshold_for_transaction( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def set_confirmation_threshold_for_transaction( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._set_confirmation_threshold_for_transaction_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def set_confirmation_threshold_for_transaction(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): + return self._set_confirmation_threshold_for_transaction_oapg(params, request_options) class ApiForpost(BaseApi): @@ -425,13 +273,13 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._set_confirmation_threshold_for_transaction_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/transactions_tx_id_unfreeze/post.py b/fireblocks_client/paths/transactions_tx_id_unfreeze/post.py index eef2e5a6..5bbf51b3 100644 --- a/fireblocks_client/paths/transactions_tx_id_unfreeze/post.py +++ b/fireblocks_client/paths/transactions_tx_id_unfreeze/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -57,9 +51,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = UnfreezeTransactionResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -74,80 +68,43 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, } _all_accept_content_types = ( '*/*', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _unfreeze_transaction_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _unfreeze_transaction_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _unfreeze_transaction_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _unfreeze_transaction_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _unfreeze_transaction_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Unfreeze a transaction - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_tx_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -162,29 +119,24 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -199,56 +151,8 @@ class instances class UnfreezeTransaction(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def unfreeze_transaction( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def unfreeze_transaction( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def unfreeze_transaction( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def unfreeze_transaction( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._unfreeze_transaction_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def unfreeze_transaction(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._unfreeze_transaction_oapg(params, request_options) class ApiForpost(BaseApi): @@ -298,11 +202,11 @@ def post( skip_deserialization: bool = False, ): return self._unfreeze_transaction_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/transactions_tx_id_unfreeze/post.pyi b/fireblocks_client/paths/transactions_tx_id_unfreeze/post.pyi index 5166deae..63c7b6ff 100644 --- a/fireblocks_client/paths/transactions_tx_id_unfreeze/post.pyi +++ b/fireblocks_client/paths/transactions_tx_id_unfreeze/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.unfreeze_transaction_response import UnfreezeTransactionResponse + # Path params TxIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -67,77 +62,40 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _unfreeze_transaction_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - @typing.overload - def _unfreeze_transaction_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _unfreeze_transaction_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _unfreeze_transaction_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _unfreeze_transaction_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Unfreeze a transaction - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_tx_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -152,29 +110,24 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -189,56 +142,8 @@ class BaseApi(api_client.Api): class UnfreezeTransaction(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def unfreeze_transaction( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def unfreeze_transaction( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def unfreeze_transaction( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def unfreeze_transaction( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._unfreeze_transaction_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def unfreeze_transaction(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._unfreeze_transaction_oapg(params, request_options) class ApiForpost(BaseApi): @@ -288,11 +193,11 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._unfreeze_transaction_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/transactions_validate_address_asset_id_address/get.py b/fireblocks_client/paths/transactions_validate_address_asset_id_address/get.py index b617183a..0e6aa562 100644 --- a/fireblocks_client/paths/transactions_validate_address_asset_id_address/get.py +++ b/fireblocks_client/paths/transactions_validate_address_asset_id_address/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -66,9 +60,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = ValidateAddressResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -83,26 +77,26 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -117,21 +111,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -139,62 +133,24 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _validate_address_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _validate_address_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _validate_address_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _validate_address_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _validate_address_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Validate destination address - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_asset_id, + request_path_address, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -210,33 +166,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -251,58 +202,8 @@ class instances class ValidateAddress(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def validate_address( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def validate_address( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def validate_address( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def validate_address( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._validate_address_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def validate_address(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._validate_address_oapg(params, request_options) class ApiForget(BaseApi): @@ -354,11 +255,11 @@ def get( skip_deserialization: bool = False, ): return self._validate_address_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/transactions_validate_address_asset_id_address/get.pyi b/fireblocks_client/paths/transactions_validate_address_asset_id_address/get.pyi index 271ffcbf..7ea12456 100644 --- a/fireblocks_client/paths/transactions_validate_address_asset_id_address/get.pyi +++ b/fireblocks_client/paths/transactions_validate_address_asset_id_address/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.validate_address_response import ValidateAddressResponse from fireblocks_client.model.error import Error + # Path params AssetIdSchema = schemas.StrSchema AddressSchema = schemas.StrSchema @@ -76,21 +71,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -105,80 +100,42 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _validate_address_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _validate_address_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _validate_address_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _validate_address_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _validate_address_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Validate destination address - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_asset_id, + request_path_address, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -194,33 +151,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -235,58 +187,8 @@ class BaseApi(api_client.Api): class ValidateAddress(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def validate_address( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def validate_address( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def validate_address( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def validate_address( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._validate_address_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def validate_address(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._validate_address_oapg(params, request_options) class ApiForget(BaseApi): @@ -338,11 +240,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._validate_address_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/tx_hash_tx_hash_set_confirmation_threshold/post.py b/fireblocks_client/paths/tx_hash_tx_hash_set_confirmation_threshold/post.py index acf423a0..2d1fdfcb 100644 --- a/fireblocks_client/paths/tx_hash_tx_hash_set_confirmation_threshold/post.py +++ b/fireblocks_client/paths/tx_hash_tx_hash_set_confirmation_threshold/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -59,19 +53,17 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) # body param SchemaForRequestBodyApplicationJson = SetConfirmationsThresholdRequest - - request_body_set_confirmations_threshold_request = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = SetConfirmationsThresholdResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -86,26 +78,26 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -120,21 +112,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -142,86 +134,23 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _set_confirmation_threshold_for_transaction_by_hash_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _set_confirmation_threshold_for_transaction_by_hash_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _set_confirmation_threshold_for_transaction_by_hash_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _set_confirmation_threshold_for_transaction_by_hash_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _set_confirmation_threshold_for_transaction_by_hash_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _set_confirmation_threshold_for_transaction_by_hash_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): """ Set confirmation threshold by transaction hash - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_tx_hash, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -236,44 +165,38 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_set_confirmations_threshold_request.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_set_confirmations_threshold_request.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -288,84 +211,8 @@ class instances class SetConfirmationThresholdForTransactionByHash(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def set_confirmation_threshold_for_transaction_by_hash( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def set_confirmation_threshold_for_transaction_by_hash( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def set_confirmation_threshold_for_transaction_by_hash( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def set_confirmation_threshold_for_transaction_by_hash( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def set_confirmation_threshold_for_transaction_by_hash( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._set_confirmation_threshold_for_transaction_by_hash_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def set_confirmation_threshold_for_transaction_by_hash(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): + return self._set_confirmation_threshold_for_transaction_by_hash_oapg(params, request_options) class ApiForpost(BaseApi): @@ -441,13 +288,13 @@ def post( skip_deserialization: bool = False, ): return self._set_confirmation_threshold_for_transaction_by_hash_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/tx_hash_tx_hash_set_confirmation_threshold/post.pyi b/fireblocks_client/paths/tx_hash_tx_hash_set_confirmation_threshold/post.pyi index 938393a8..e11032e8 100644 --- a/fireblocks_client/paths/tx_hash_tx_hash_set_confirmation_threshold/post.pyi +++ b/fireblocks_client/paths/tx_hash_tx_hash_set_confirmation_threshold/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -29,6 +23,7 @@ from fireblocks_client.model.set_confirmations_threshold_response import SetConf from fireblocks_client.model.error import Error from fireblocks_client.model.set_confirmations_threshold_request import SetConfirmationsThresholdRequest + # Path params TxHashSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -57,13 +52,11 @@ request_path_tx_hash = api_client.PathParameter( ) # body param SchemaForRequestBodyApplicationJson = SetConfirmationsThresholdRequest - - request_body_set_confirmations_threshold_request = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema SchemaFor200ResponseBody = SetConfirmationsThresholdResponse @@ -79,21 +72,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -108,104 +101,41 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _set_confirmation_threshold_for_transaction_by_hash_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _set_confirmation_threshold_for_transaction_by_hash_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _set_confirmation_threshold_for_transaction_by_hash_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _set_confirmation_threshold_for_transaction_by_hash_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _set_confirmation_threshold_for_transaction_by_hash_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _set_confirmation_threshold_for_transaction_by_hash_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): """ Set confirmation threshold by transaction hash - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_tx_hash, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -220,44 +150,38 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_set_confirmations_threshold_request.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_set_confirmations_threshold_request.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -272,84 +196,8 @@ class BaseApi(api_client.Api): class SetConfirmationThresholdForTransactionByHash(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def set_confirmation_threshold_for_transaction_by_hash( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def set_confirmation_threshold_for_transaction_by_hash( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def set_confirmation_threshold_for_transaction_by_hash( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def set_confirmation_threshold_for_transaction_by_hash( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def set_confirmation_threshold_for_transaction_by_hash( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._set_confirmation_threshold_for_transaction_by_hash_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def set_confirmation_threshold_for_transaction_by_hash(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): + return self._set_confirmation_threshold_for_transaction_by_hash_oapg(params, request_options) class ApiForpost(BaseApi): @@ -425,13 +273,13 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._set_confirmation_threshold_for_transaction_by_hash_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/users/get.py b/fireblocks_client/paths/users/get.py index 45b6d03b..0640a0ca 100644 --- a/fireblocks_client/paths/users/get.py +++ b/fireblocks_client/paths/users/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -32,9 +26,9 @@ XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = GetUsersResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -49,26 +43,26 @@ class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -83,21 +77,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -105,85 +99,39 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_users_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_users_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_users_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_users_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_users_oapg(self, request_options: RequestOptions = None): """ List users - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -198,53 +146,8 @@ class instances class GetUsers(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_users( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_users( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_users( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_users( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_users_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_users(self , request_options: RequestOptions = None): + return self._get_users_oapg(request_options) class ApiForget(BaseApi): @@ -292,10 +195,10 @@ def get( skip_deserialization: bool = False, ): return self._get_users_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/users/get.pyi b/fireblocks_client/paths/users/get.pyi index a6700a65..e201efd9 100644 --- a/fireblocks_client/paths/users/get.pyi +++ b/fireblocks_client/paths/users/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.get_users_response import GetUsersResponse from fireblocks_client.model.error import Error + XRequestIDSchema = schemas.StrSchema SchemaFor200ResponseBody = GetUsersResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -42,21 +37,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -71,103 +66,57 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_users_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_users_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_users_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_users_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_users_oapg(self, request_options: RequestOptions = None): """ List users - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -182,53 +131,8 @@ class BaseApi(api_client.Api): class GetUsers(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_users( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_users( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_users( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_users( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_users_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_users(self , request_options: RequestOptions = None): + return self._get_users_oapg(request_options) class ApiForget(BaseApi): @@ -276,10 +180,10 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_users_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/users_groups/get.py b/fireblocks_client/paths/users_groups/get.py index ad72dd4b..926a4a68 100644 --- a/fireblocks_client/paths/users_groups/get.py +++ b/fireblocks_client/paths/users_groups/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -32,9 +26,9 @@ XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = UsersGroupsResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -49,26 +43,26 @@ class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -83,21 +77,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -105,85 +99,39 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_user_groups_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_user_groups_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_user_groups_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_user_groups_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_user_groups_oapg(self, request_options: RequestOptions = None): """ List users groups - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -198,53 +146,8 @@ class instances class GetUserGroups(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_user_groups( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_user_groups( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_user_groups( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_user_groups( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_user_groups_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_user_groups(self , request_options: RequestOptions = None): + return self._get_user_groups_oapg(request_options) class ApiForget(BaseApi): @@ -292,10 +195,10 @@ def get( skip_deserialization: bool = False, ): return self._get_user_groups_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/users_groups/get.pyi b/fireblocks_client/paths/users_groups/get.pyi index ea3a308d..8e4535ca 100644 --- a/fireblocks_client/paths/users_groups/get.pyi +++ b/fireblocks_client/paths/users_groups/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.users_groups_response import UsersGroupsResponse from fireblocks_client.model.error import Error + XRequestIDSchema = schemas.StrSchema SchemaFor200ResponseBody = UsersGroupsResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -42,21 +37,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -71,103 +66,57 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_user_groups_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_user_groups_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_user_groups_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_user_groups_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_user_groups_oapg(self, request_options: RequestOptions = None): """ List users groups - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -182,53 +131,8 @@ class BaseApi(api_client.Api): class GetUserGroups(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_user_groups( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_user_groups( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_user_groups( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_user_groups( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_user_groups_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_user_groups(self , request_options: RequestOptions = None): + return self._get_user_groups_oapg(request_options) class ApiForget(BaseApi): @@ -276,10 +180,10 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_user_groups_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/users_groups/post.py b/fireblocks_client/paths/users_groups/post.py index babcccaf..686b3242 100644 --- a/fireblocks_client/paths/users_groups/post.py +++ b/fireblocks_client/paths/users_groups/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -33,20 +27,18 @@ # body param SchemaForRequestBodyApplicationJson = UserGroupCreateRequest - - request_body_user_group_create_request = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor201ResponseBody = CreateUsersGroupResponse ResponseHeadersFor201 = typing_extensions.TypedDict( @@ -61,26 +53,26 @@ class ApiResponseFor201(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor201ResponseBody, - ] + SchemaFor201ResponseBody, + ] headers: ResponseHeadersFor201 _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, content={ - '*/*': api_client.MediaType( - schema=SchemaFor201ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor201ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -95,21 +87,21 @@ class ApiResponseFor201(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '201': _response_for_201, 'default': _response_for_default, @@ -117,121 +109,53 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_user_group_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _create_user_group_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _create_user_group_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_user_group_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _create_user_group_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_user_group_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): """ Create users group - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(user_group_create_request, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_user_group_create_request.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_user_group_create_request.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -246,78 +170,8 @@ class instances class CreateUserGroup(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create_user_group( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def create_user_group( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def create_user_group( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_user_group( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_user_group( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_user_group_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create_user_group(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): + return self._create_user_group_oapg(params, request_options) class ApiForpost(BaseApi): @@ -388,12 +242,12 @@ def post( skip_deserialization: bool = False, ): return self._create_user_group_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/users_groups/post.pyi b/fireblocks_client/paths/users_groups/post.pyi index acb524bf..824e0bff 100644 --- a/fireblocks_client/paths/users_groups/post.pyi +++ b/fireblocks_client/paths/users_groups/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -29,15 +23,14 @@ from fireblocks_client.model.user_group_create_request import UserGroupCreateReq from fireblocks_client.model.create_users_group_response import CreateUsersGroupResponse from fireblocks_client.model.error import Error + # body param SchemaForRequestBodyApplicationJson = UserGroupCreateRequest - - request_body_user_group_create_request = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema @@ -54,21 +47,21 @@ ResponseHeadersFor201 = typing_extensions.TypedDict( class ApiResponseFor201(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor201ResponseBody, - ] + SchemaFor201ResponseBody, + ] headers: ResponseHeadersFor201 _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, content={ - '*/*': api_client.MediaType( - schema=SchemaFor201ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor201ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -83,139 +76,71 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_user_group_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _create_user_group_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _create_user_group_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_user_group_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _create_user_group_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_user_group_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): """ Create users group - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(user_group_create_request, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_user_group_create_request.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_user_group_create_request.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -230,78 +155,8 @@ class BaseApi(api_client.Api): class CreateUserGroup(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create_user_group( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def create_user_group( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def create_user_group( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_user_group( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_user_group( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_user_group_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create_user_group(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,] = None, request_options: RequestOptions = None): + return self._create_user_group_oapg(params, request_options) class ApiForpost(BaseApi): @@ -372,12 +227,12 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._create_user_group_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/users_groups_group_id/delete.py b/fireblocks_client/paths/users_groups_group_id/delete.py index 8c9940fc..885e14b6 100644 --- a/fireblocks_client/paths/users_groups_group_id/delete.py +++ b/fireblocks_client/paths/users_groups_group_id/delete.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -57,9 +51,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor204 = typing_extensions.TypedDict( 'ResponseHeadersFor204', @@ -79,14 +73,14 @@ class ApiResponseFor204(api_client.ApiResponse): _response_for_204 = api_client.OpenApiResponse( response_cls=ApiResponseFor204, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -101,83 +95,44 @@ class ApiResponseFor204(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '204': _response_for_204, 'default': _response_for_default, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _delete_user_group_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _delete_user_group_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _delete_user_group_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _delete_user_group_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _delete_user_group_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Delete users group - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_group_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -192,33 +147,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='delete'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -233,58 +183,8 @@ class instances class DeleteUserGroup(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def delete_user_group( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ApiResponseForDefault, - ]: ... - - @typing.overload - def delete_user_group( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete_user_group( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete_user_group( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_user_group_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def delete_user_group(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._delete_user_group_oapg(params, request_options) class ApiFordelete(BaseApi): @@ -336,11 +236,11 @@ def delete( skip_deserialization: bool = False, ): return self._delete_user_group_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/users_groups_group_id/delete.pyi b/fireblocks_client/paths/users_groups_group_id/delete.pyi index 43e59577..bacc7957 100644 --- a/fireblocks_client/paths/users_groups_group_id/delete.pyi +++ b/fireblocks_client/paths/users_groups_group_id/delete.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error + # Path params GroupIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -72,9 +67,9 @@ class ApiResponseFor204(api_client.ApiResponse): _response_for_204 = api_client.OpenApiResponse( response_cls=ApiResponseFor204, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -89,79 +84,40 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _delete_user_group_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _delete_user_group_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _delete_user_group_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _delete_user_group_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _delete_user_group_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Delete users group - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_group_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -176,33 +132,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='delete'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -217,58 +168,8 @@ class BaseApi(api_client.Api): class DeleteUserGroup(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def delete_user_group( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor204, - ApiResponseForDefault, - ]: ... - - @typing.overload - def delete_user_group( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def delete_user_group( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor204, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def delete_user_group( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._delete_user_group_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def delete_user_group(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._delete_user_group_oapg(params, request_options) class ApiFordelete(BaseApi): @@ -320,11 +221,11 @@ class ApiFordelete(BaseApi): skip_deserialization: bool = False, ): return self._delete_user_group_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/users_groups_group_id/get.py b/fireblocks_client/paths/users_groups_group_id/get.py index 251693ed..6e4b8a5b 100644 --- a/fireblocks_client/paths/users_groups_group_id/get.py +++ b/fireblocks_client/paths/users_groups_group_id/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -58,9 +52,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = UsersGroupResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -75,26 +69,26 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -109,21 +103,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -131,62 +125,23 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_user_group_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_user_group_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_user_group_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_user_group_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_user_group_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Get users group - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_group_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -201,33 +156,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -242,58 +192,8 @@ class instances class GetUserGroup(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_user_group( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_user_group( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_user_group( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_user_group( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_user_group_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_user_group(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_user_group_oapg(params, request_options) class ApiForget(BaseApi): @@ -345,11 +245,11 @@ def get( skip_deserialization: bool = False, ): return self._get_user_group_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/users_groups_group_id/get.pyi b/fireblocks_client/paths/users_groups_group_id/get.pyi index 5808c947..6c0c2d91 100644 --- a/fireblocks_client/paths/users_groups_group_id/get.pyi +++ b/fireblocks_client/paths/users_groups_group_id/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.users_group_response import UsersGroupResponse from fireblocks_client.model.error import Error + # Path params GroupIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -68,21 +63,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -97,80 +92,41 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_user_group_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_user_group_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_user_group_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_user_group_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_user_group_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Get users group - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_group_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -185,33 +141,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -226,58 +177,8 @@ class BaseApi(api_client.Api): class GetUserGroup(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_user_group( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_user_group( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_user_group( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_user_group( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_user_group_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_user_group(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_user_group_oapg(params, request_options) class ApiForget(BaseApi): @@ -329,11 +230,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_user_group_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/users_groups_group_id/put.py b/fireblocks_client/paths/users_groups_group_id/put.py index abf348d5..df270941 100644 --- a/fireblocks_client/paths/users_groups_group_id/put.py +++ b/fireblocks_client/paths/users_groups_group_id/put.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -59,20 +53,18 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) # body param SchemaForRequestBodyApplicationJson = UserGroupUpdateRequest - - request_body_user_group_update_request = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = UserGroupCreateResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -87,26 +79,26 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -121,21 +113,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -143,86 +135,23 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _update_user_group_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _update_user_group_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _update_user_group_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_user_group_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _update_user_group_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _update_user_group_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): """ Update users group - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_group_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -237,46 +166,42 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(user_group_update_request, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_user_group_update_request.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_user_group_update_request.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='put'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -291,84 +216,8 @@ class instances class UpdateUserGroup(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def update_user_group( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def update_user_group( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def update_user_group( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_user_group( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def update_user_group( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_user_group_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def update_user_group(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): + return self._update_user_group_oapg(params, request_options) class ApiForput(BaseApi): @@ -444,13 +293,13 @@ def put( skip_deserialization: bool = False, ): return self._update_user_group_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/users_groups_group_id/put.pyi b/fireblocks_client/paths/users_groups_group_id/put.pyi index 822dc4c0..0e56f4ba 100644 --- a/fireblocks_client/paths/users_groups_group_id/put.pyi +++ b/fireblocks_client/paths/users_groups_group_id/put.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -29,6 +23,7 @@ from fireblocks_client.model.user_group_update_request import UserGroupUpdateReq from fireblocks_client.model.user_group_create_response import UserGroupCreateResponse from fireblocks_client.model.error import Error + # Path params GroupIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -57,13 +52,11 @@ request_path_group_id = api_client.PathParameter( ) # body param SchemaForRequestBodyApplicationJson = UserGroupUpdateRequest - - request_body_user_group_update_request = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema @@ -80,21 +73,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -109,104 +102,41 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _update_user_group_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _update_user_group_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _update_user_group_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_user_group_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _update_user_group_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _update_user_group_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): """ Update users group - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_group_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -221,46 +151,42 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(user_group_update_request, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_user_group_update_request.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_user_group_update_request.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='put'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -275,84 +201,8 @@ class BaseApi(api_client.Api): class UpdateUserGroup(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def update_user_group( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def update_user_group( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def update_user_group( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_user_group( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def update_user_group( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_user_group_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def update_user_group(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,RequestPathParams] = None, request_options: RequestOptions = None): + return self._update_user_group_oapg(params, request_options) class ApiForput(BaseApi): @@ -428,13 +278,13 @@ class ApiForput(BaseApi): skip_deserialization: bool = False, ): return self._update_user_group_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts/get.py b/fireblocks_client/paths/vault_accounts/get.py index 2006b443..59f7da1e 100644 --- a/fireblocks_client/paths/vault_accounts/get.py +++ b/fireblocks_client/paths/vault_accounts/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -82,9 +76,9 @@ class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams) ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) @@ -124,26 +118,26 @@ def __getitem__(self, i: int) -> 'VaultAccount': class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -158,21 +152,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -180,106 +174,61 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_vault_accounts_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_vault_accounts_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_vault_accounts_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_vault_accounts_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_vault_accounts_oapg(self, params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): """ List vault accounts - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["name_prefix"] = params.get("name_prefix") + query_params["name_suffix"] = params.get("name_suffix") + query_params["min_amount_threshold"] = params.get("min_amount_threshold") + query_params["asset_id"] = params.get("asset_id") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + used_path = path.value prefix_separator_iterator = None for parameter in ( - request_query_name_prefix, - request_query_name_suffix, - request_query_min_amount_threshold, - request_query_asset_id, - ): + request_query_name_prefix, + request_query_name_suffix, + request_query_min_amount_threshold, + request_query_asset_id, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -294,58 +243,8 @@ class instances class GetVaultAccounts(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_vault_accounts( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_vault_accounts( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_vault_accounts( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_vault_accounts( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_vault_accounts_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_vault_accounts(self ,params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): + return self._get_vault_accounts_oapg(params, request_options) class ApiForget(BaseApi): @@ -397,11 +296,11 @@ def get( skip_deserialization: bool = False, ): return self._get_vault_accounts_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts/get.pyi b/fireblocks_client/paths/vault_accounts/get.pyi index 920963ab..77a8e112 100644 --- a/fireblocks_client/paths/vault_accounts/get.pyi +++ b/fireblocks_client/paths/vault_accounts/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.vault_account import VaultAccount from fireblocks_client.model.error import Error + # Query params NamePrefixSchema = schemas.StrSchema NameSuffixSchema = schemas.StrSchema @@ -117,21 +112,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -146,124 +141,79 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_vault_accounts_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_vault_accounts_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_vault_accounts_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_vault_accounts_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_vault_accounts_oapg(self, params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): """ List vault accounts - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["name_prefix"] = params.get("name_prefix") + query_params["name_suffix"] = params.get("name_suffix") + query_params["min_amount_threshold"] = params.get("min_amount_threshold") + query_params["asset_id"] = params.get("asset_id") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + used_path = path.value prefix_separator_iterator = None for parameter in ( - request_query_name_prefix, - request_query_name_suffix, - request_query_min_amount_threshold, - request_query_asset_id, - ): + request_query_name_prefix, + request_query_name_suffix, + request_query_min_amount_threshold, + request_query_asset_id, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -278,58 +228,8 @@ class BaseApi(api_client.Api): class GetVaultAccounts(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_vault_accounts( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_vault_accounts( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_vault_accounts( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_vault_accounts( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_vault_accounts_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_vault_accounts(self ,params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): + return self._get_vault_accounts_oapg(params, request_options) class ApiForget(BaseApi): @@ -381,11 +281,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_vault_accounts_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts/post.py b/fireblocks_client/paths/vault_accounts/post.py index bbb29447..487bbb3e 100644 --- a/fireblocks_client/paths/vault_accounts/post.py +++ b/fireblocks_client/paths/vault_accounts/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -112,20 +106,18 @@ def __new__( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = VaultAccount ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -140,26 +132,26 @@ def __new__( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -174,21 +166,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -196,121 +188,53 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _create_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _create_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _create_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_vault_account_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): """ Create a new vault account - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(any_type, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -325,78 +249,8 @@ class instances class CreateVaultAccount(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def create_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def create_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_vault_account_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create_vault_account(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): + return self._create_vault_account_oapg(params, request_options) class ApiForpost(BaseApi): @@ -467,12 +321,12 @@ def post( skip_deserialization: bool = False, ): return self._create_vault_account_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts/post.pyi b/fireblocks_client/paths/vault_accounts/post.pyi index f1059598..85f2f718 100644 --- a/fireblocks_client/paths/vault_accounts/post.pyi +++ b/fireblocks_client/paths/vault_accounts/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.vault_account import VaultAccount from fireblocks_client.model.error import Error + # body param @@ -110,13 +105,11 @@ class SchemaForRequestBodyApplicationJson( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema @@ -133,21 +126,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -162,139 +155,71 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _create_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _create_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _create_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_vault_account_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): """ Create a new vault account - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(any_type, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -309,78 +234,8 @@ class BaseApi(api_client.Api): class CreateVaultAccount(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def create_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def create_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_vault_account_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create_vault_account(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ] = None, request_options: RequestOptions = None): + return self._create_vault_account_oapg(params, request_options) class ApiForpost(BaseApi): @@ -451,12 +306,12 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._create_vault_account_oapg( - body=body, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_paged/get.py b/fireblocks_client/paths/vault_accounts_paged/get.py index 14de7283..b67cb1d7 100644 --- a/fireblocks_client/paths/vault_accounts_paged/get.py +++ b/fireblocks_client/paths/vault_accounts_paged/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -140,9 +134,9 @@ class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams) ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = VaultAccountsPagedResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -157,124 +151,85 @@ class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams) class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, } _all_accept_content_types = ( '*/*', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_paged_vault_accounts_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _get_paged_vault_accounts_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_paged_vault_accounts_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_paged_vault_accounts_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_paged_vault_accounts_oapg(self, params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): """ List vault acounts (Paginated) - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["name_prefix"] = params.get("name_prefix") + query_params["name_suffix"] = params.get("name_suffix") + query_params["min_amount_threshold"] = params.get("min_amount_threshold") + query_params["asset_id"] = params.get("asset_id") + query_params["order_by"] = params.get("order_by") + query_params["before"] = params.get("before") + query_params["after"] = params.get("after") + query_params["limit"] = params.get("limit") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + used_path = path.value prefix_separator_iterator = None for parameter in ( - request_query_name_prefix, - request_query_name_suffix, - request_query_min_amount_threshold, - request_query_asset_id, - request_query_order_by, - request_query_before, - request_query_after, - request_query_limit, - ): + request_query_name_prefix, + request_query_name_suffix, + request_query_min_amount_threshold, + request_query_asset_id, + request_query_order_by, + request_query_before, + request_query_after, + request_query_limit, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -289,56 +244,8 @@ class instances class GetPagedVaultAccounts(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_paged_vault_accounts( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get_paged_vault_accounts( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_paged_vault_accounts( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_paged_vault_accounts( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_paged_vault_accounts_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_paged_vault_accounts(self ,params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): + return self._get_paged_vault_accounts_oapg(params, request_options) class ApiForget(BaseApi): @@ -388,11 +295,11 @@ def get( skip_deserialization: bool = False, ): return self._get_paged_vault_accounts_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_paged/get.pyi b/fireblocks_client/paths/vault_accounts_paged/get.pyi index b357a40b..e6400a3e 100644 --- a/fireblocks_client/paths/vault_accounts_paged/get.pyi +++ b/fireblocks_client/paths/vault_accounts_paged/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.vault_accounts_paged_response import VaultAccountsPagedResponse + # Query params NamePrefixSchema = schemas.StrSchema NameSuffixSchema = schemas.StrSchema @@ -139,121 +134,82 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_paged_vault_accounts_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - @typing.overload - def _get_paged_vault_accounts_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_paged_vault_accounts_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_paged_vault_accounts_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_paged_vault_accounts_oapg(self, params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): """ List vault acounts (Paginated) - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["name_prefix"] = params.get("name_prefix") + query_params["name_suffix"] = params.get("name_suffix") + query_params["min_amount_threshold"] = params.get("min_amount_threshold") + query_params["asset_id"] = params.get("asset_id") + query_params["order_by"] = params.get("order_by") + query_params["before"] = params.get("before") + query_params["after"] = params.get("after") + query_params["limit"] = params.get("limit") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + used_path = path.value prefix_separator_iterator = None for parameter in ( - request_query_name_prefix, - request_query_name_suffix, - request_query_min_amount_threshold, - request_query_asset_id, - request_query_order_by, - request_query_before, - request_query_after, - request_query_limit, - ): + request_query_name_prefix, + request_query_name_suffix, + request_query_min_amount_threshold, + request_query_asset_id, + request_query_order_by, + request_query_before, + request_query_after, + request_query_limit, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -268,56 +224,8 @@ class BaseApi(api_client.Api): class GetPagedVaultAccounts(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_paged_vault_accounts( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get_paged_vault_accounts( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_paged_vault_accounts( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_paged_vault_accounts( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_paged_vault_accounts_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_paged_vault_accounts(self ,params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): + return self._get_paged_vault_accounts_oapg(params, request_options) class ApiForget(BaseApi): @@ -367,11 +275,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_paged_vault_accounts_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id/get.py b/fireblocks_client/paths/vault_accounts_vault_account_id/get.py index eece1c55..7ace02e9 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id/get.py +++ b/fireblocks_client/paths/vault_accounts_vault_account_id/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -58,9 +52,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = VaultAccount ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -75,26 +69,26 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -109,21 +103,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -131,62 +125,23 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_vault_account_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_vault_account_by_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_vault_account_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_vault_account_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_vault_account_by_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Find a vault account by ID - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -201,33 +156,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -242,58 +192,8 @@ class instances class GetVaultAccountById(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_vault_account_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_vault_account_by_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_vault_account_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_vault_account_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_vault_account_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_vault_account_by_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_vault_account_by_id_oapg(params, request_options) class ApiForget(BaseApi): @@ -345,11 +245,11 @@ def get( skip_deserialization: bool = False, ): return self._get_vault_account_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id/get.pyi b/fireblocks_client/paths/vault_accounts_vault_account_id/get.pyi index 04ac4a70..04514fd7 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id/get.pyi +++ b/fireblocks_client/paths/vault_accounts_vault_account_id/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.vault_account import VaultAccount from fireblocks_client.model.error import Error + # Path params VaultAccountIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -68,21 +63,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -97,80 +92,41 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_vault_account_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_vault_account_by_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_vault_account_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_vault_account_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_vault_account_by_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Find a vault account by ID - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -185,33 +141,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -226,58 +177,8 @@ class BaseApi(api_client.Api): class GetVaultAccountById(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_vault_account_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_vault_account_by_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_vault_account_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_vault_account_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_vault_account_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_vault_account_by_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_vault_account_by_id_oapg(params, request_options) class ApiForget(BaseApi): @@ -329,11 +230,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_vault_account_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id/put.py b/fireblocks_client/paths/vault_accounts_vault_account_id/put.py index e5625df9..1362373a 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id/put.py +++ b/fireblocks_client/paths/vault_accounts_vault_account_id/put.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -107,20 +101,18 @@ def __new__( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor201 = typing_extensions.TypedDict( 'ResponseHeadersFor201', @@ -140,14 +132,14 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -162,107 +154,44 @@ class ApiResponseFor201(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '201': _response_for_201, 'default': _response_for_default, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _update_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - @typing.overload - def _update_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _update_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _update_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _update_vault_account_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Rename a vault account - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -277,46 +206,42 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(any_type, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='put'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -331,84 +256,8 @@ class instances class UpdateVaultAccount(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def update_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def update_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def update_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def update_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_vault_account_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def update_vault_account(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._update_vault_account_oapg(params, request_options) class ApiForput(BaseApi): @@ -484,13 +333,13 @@ def put( skip_deserialization: bool = False, ): return self._update_vault_account_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id/put.pyi b/fireblocks_client/paths/vault_accounts_vault_account_id/put.pyi index 76d00db4..c3337b2d 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id/put.pyi +++ b/fireblocks_client/paths/vault_accounts_vault_account_id/put.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error + # Path params VaultAccountIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -105,13 +100,11 @@ class SchemaForRequestBodyApplicationJson( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema @@ -133,9 +126,9 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -150,103 +143,40 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _update_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - @typing.overload - def _update_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _update_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _update_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _update_vault_account_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Rename a vault account - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -261,46 +191,42 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(any_type, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='put'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -315,84 +241,8 @@ class BaseApi(api_client.Api): class UpdateVaultAccount(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def update_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def update_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def update_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def update_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_vault_account_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def update_vault_account(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._update_vault_account_oapg(params, request_options) class ApiForput(BaseApi): @@ -468,13 +318,13 @@ class ApiForput(BaseApi): skip_deserialization: bool = False, ): return self._update_vault_account_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id/get.py b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id/get.py index f59eced1..cbd45915 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id/get.py +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -71,23 +65,23 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, -) + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -102,21 +96,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -124,62 +118,24 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_vault_account_asset_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_vault_account_asset_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_vault_account_asset_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_vault_account_asset_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_vault_account_asset_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Get the asset balance for a vault account - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -195,33 +151,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -236,58 +187,8 @@ class instances class GetVaultAccountAsset(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_vault_account_asset( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_vault_account_asset( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_vault_account_asset( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_vault_account_asset( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_vault_account_asset_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_vault_account_asset(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_vault_account_asset_oapg(params, request_options) class ApiForget(BaseApi): @@ -339,11 +240,11 @@ def get( skip_deserialization: bool = False, ): return self._get_vault_account_asset_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id/get.pyi b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id/get.pyi index 8b6538c3..89983129 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id/get.pyi +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.vault_asset import VaultAsset from fireblocks_client.model.error import Error + # Path params VaultAccountIdSchema = schemas.StrSchema AssetIdSchema = schemas.StrSchema @@ -69,18 +64,18 @@ SchemaFor200ResponseBody = VaultAsset class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: schemas.Unset = schemas.unset _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, -) + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -95,80 +90,42 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_vault_account_asset_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _get_vault_account_asset_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_vault_account_asset_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_vault_account_asset_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_vault_account_asset_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Get the asset balance for a vault account - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -184,33 +141,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -225,58 +177,8 @@ class BaseApi(api_client.Api): class GetVaultAccountAsset(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_vault_account_asset( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_vault_account_asset( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_vault_account_asset( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_vault_account_asset( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_vault_account_asset_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_vault_account_asset(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_vault_account_asset_oapg(params, request_options) class ApiForget(BaseApi): @@ -328,11 +230,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_vault_account_asset_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id/post.py b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id/post.py index ad6c6ef4..643a5e1c 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id/post.py +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -116,19 +110,17 @@ def __new__( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = CreateVaultAssetResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -143,26 +135,26 @@ def __new__( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -177,21 +169,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -199,86 +191,24 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_vault_account_asset_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _create_vault_account_asset_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _create_vault_account_asset_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_vault_account_asset_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _create_vault_account_asset_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_vault_account_asset_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Create a new wallet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -294,44 +224,38 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -346,84 +270,8 @@ class instances class CreateVaultAccountAsset(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create_vault_account_asset( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def create_vault_account_asset( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def create_vault_account_asset( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_vault_account_asset( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_vault_account_asset( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_vault_account_asset_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create_vault_account_asset(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._create_vault_account_asset_oapg(params, request_options) class ApiForpost(BaseApi): @@ -499,13 +347,13 @@ def post( skip_deserialization: bool = False, ): return self._create_vault_account_asset_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id/post.pyi b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id/post.pyi index 12a10034..f29c460f 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id/post.pyi +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.create_vault_asset_response import CreateVaultAssetResponse from fireblocks_client.model.error import Error + # Path params VaultAccountIdSchema = schemas.StrSchema AssetIdSchema = schemas.StrSchema @@ -114,13 +109,11 @@ class SchemaForRequestBodyApplicationJson( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema SchemaFor200ResponseBody = CreateVaultAssetResponse @@ -136,21 +129,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -165,104 +158,42 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_vault_account_asset_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _create_vault_account_asset_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _create_vault_account_asset_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_vault_account_asset_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _create_vault_account_asset_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_vault_account_asset_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Create a new wallet - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -278,44 +209,38 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -330,84 +255,8 @@ class BaseApi(api_client.Api): class CreateVaultAccountAsset(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create_vault_account_asset( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def create_vault_account_asset( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def create_vault_account_asset( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_vault_account_asset( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_vault_account_asset( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_vault_account_asset_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create_vault_account_asset(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._create_vault_account_asset_oapg(params, request_options) class ApiForpost(BaseApi): @@ -483,13 +332,13 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._create_vault_account_asset_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_activate/post.py b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_activate/post.py index c785d454..fbb2ea06 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_activate/post.py +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_activate/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -66,9 +60,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = CreateVaultAssetResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -83,26 +77,26 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -117,21 +111,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -139,62 +133,24 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _activate_asset_for_vault_account_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _activate_asset_for_vault_account_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _activate_asset_for_vault_account_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _activate_asset_for_vault_account_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _activate_asset_for_vault_account_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Activate a wallet in a vault account - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -210,33 +166,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -251,58 +202,8 @@ class instances class ActivateAssetForVaultAccount(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def activate_asset_for_vault_account( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def activate_asset_for_vault_account( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def activate_asset_for_vault_account( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def activate_asset_for_vault_account( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._activate_asset_for_vault_account_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def activate_asset_for_vault_account(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._activate_asset_for_vault_account_oapg(params, request_options) class ApiForpost(BaseApi): @@ -354,11 +255,11 @@ def post( skip_deserialization: bool = False, ): return self._activate_asset_for_vault_account_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_activate/post.pyi b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_activate/post.pyi index 4309d49e..16ca2629 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_activate/post.pyi +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_activate/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.create_vault_asset_response import CreateVaultAssetResponse from fireblocks_client.model.error import Error + # Path params VaultAccountIdSchema = schemas.StrSchema AssetIdSchema = schemas.StrSchema @@ -76,21 +71,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -105,80 +100,42 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _activate_asset_for_vault_account_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _activate_asset_for_vault_account_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _activate_asset_for_vault_account_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _activate_asset_for_vault_account_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _activate_asset_for_vault_account_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Activate a wallet in a vault account - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -194,33 +151,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -235,58 +187,8 @@ class BaseApi(api_client.Api): class ActivateAssetForVaultAccount(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def activate_asset_for_vault_account( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def activate_asset_for_vault_account( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def activate_asset_for_vault_account( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def activate_asset_for_vault_account( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._activate_asset_for_vault_account_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def activate_asset_for_vault_account(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._activate_asset_for_vault_account_oapg(params, request_options) class ApiForpost(BaseApi): @@ -338,11 +240,11 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._activate_asset_for_vault_account_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses/get.py b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses/get.py index fa978e7d..bf744e8c 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses/get.py +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -66,9 +60,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) @@ -108,26 +102,26 @@ def __getitem__(self, i: int) -> 'VaultWalletAddress': class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -142,21 +136,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -164,62 +158,24 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_vault_account_asset_addresses_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_vault_account_asset_addresses_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_vault_account_asset_addresses_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_vault_account_asset_addresses_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_vault_account_asset_addresses_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Get asset addresses - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -235,33 +191,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -276,58 +227,8 @@ class instances class GetVaultAccountAssetAddresses(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_vault_account_asset_addresses( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_vault_account_asset_addresses( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_vault_account_asset_addresses( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_vault_account_asset_addresses( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_vault_account_asset_addresses_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_vault_account_asset_addresses(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_vault_account_asset_addresses_oapg(params, request_options) class ApiForget(BaseApi): @@ -379,11 +280,11 @@ def get( skip_deserialization: bool = False, ): return self._get_vault_account_asset_addresses_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses/get.pyi b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses/get.pyi index a892e91e..ca37128a 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses/get.pyi +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.vault_wallet_address import VaultWalletAddress from fireblocks_client.model.error import Error + # Path params VaultAccountIdSchema = schemas.StrSchema AssetIdSchema = schemas.StrSchema @@ -101,21 +96,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -130,80 +125,42 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_vault_account_asset_addresses_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _get_vault_account_asset_addresses_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_vault_account_asset_addresses_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_vault_account_asset_addresses_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_vault_account_asset_addresses_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Get asset addresses - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -219,33 +176,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -260,58 +212,8 @@ class BaseApi(api_client.Api): class GetVaultAccountAssetAddresses(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_vault_account_asset_addresses( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_vault_account_asset_addresses( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_vault_account_asset_addresses( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_vault_account_asset_addresses( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_vault_account_asset_addresses_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_vault_account_asset_addresses(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_vault_account_asset_addresses_oapg(params, request_options) class ApiForget(BaseApi): @@ -363,11 +265,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_vault_account_asset_addresses_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses/post.py b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses/post.py index 1e0042d5..731e7305 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses/post.py +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -126,19 +120,17 @@ def __new__( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = CreateAddressResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -153,26 +145,26 @@ def __new__( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -187,21 +179,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -209,86 +201,24 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_vault_account_asset_address_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _create_vault_account_asset_address_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _create_vault_account_asset_address_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_vault_account_asset_address_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _create_vault_account_asset_address_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_vault_account_asset_address_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Create new asset deposit address - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -304,44 +234,38 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -356,84 +280,8 @@ class instances class CreateVaultAccountAssetAddress(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create_vault_account_asset_address( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def create_vault_account_asset_address( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def create_vault_account_asset_address( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_vault_account_asset_address( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_vault_account_asset_address( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_vault_account_asset_address_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create_vault_account_asset_address(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._create_vault_account_asset_address_oapg(params, request_options) class ApiForpost(BaseApi): @@ -509,13 +357,13 @@ def post( skip_deserialization: bool = False, ): return self._create_vault_account_asset_address_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses/post.pyi b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses/post.pyi index 0e17f3dc..a96c6290 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses/post.pyi +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.create_address_response import CreateAddressResponse from fireblocks_client.model.error import Error + # Path params VaultAccountIdSchema = schemas.StrSchema AssetIdSchema = schemas.StrSchema @@ -124,13 +119,11 @@ class SchemaForRequestBodyApplicationJson( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema SchemaFor200ResponseBody = CreateAddressResponse @@ -146,21 +139,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -175,104 +168,42 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_vault_account_asset_address_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _create_vault_account_asset_address_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _create_vault_account_asset_address_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_vault_account_asset_address_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _create_vault_account_asset_address_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_vault_account_asset_address_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Create new asset deposit address - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -288,44 +219,38 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -340,84 +265,8 @@ class BaseApi(api_client.Api): class CreateVaultAccountAssetAddress(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create_vault_account_asset_address( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def create_vault_account_asset_address( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def create_vault_account_asset_address( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_vault_account_asset_address( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_vault_account_asset_address( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_vault_account_asset_address_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create_vault_account_asset_address(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._create_vault_account_asset_address_oapg(params, request_options) class ApiForpost(BaseApi): @@ -493,13 +342,13 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._create_vault_account_asset_address_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses_address_id/put.py b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses_address_id/put.py index 69f3ad9a..928aff92 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses_address_id/put.py +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses_address_id/put.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -123,19 +117,17 @@ def __new__( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor201 = typing_extensions.TypedDict( 'ResponseHeadersFor201', @@ -155,14 +147,14 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -177,107 +169,46 @@ class ApiResponseFor201(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '201': _response_for_201, 'default': _response_for_default, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _update_vault_account_asset_address_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _update_vault_account_asset_address_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _update_vault_account_asset_address_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_vault_account_asset_address_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _update_vault_account_asset_address_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _update_vault_account_asset_address_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Update address description - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + request_path_asset_id, + request_path_address_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -294,44 +225,38 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='put'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -346,84 +271,8 @@ class instances class UpdateVaultAccountAssetAddress(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def update_vault_account_asset_address( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def update_vault_account_asset_address( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def update_vault_account_asset_address( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_vault_account_asset_address( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def update_vault_account_asset_address( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_vault_account_asset_address_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def update_vault_account_asset_address(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._update_vault_account_asset_address_oapg(params, request_options) class ApiForput(BaseApi): @@ -499,13 +348,13 @@ def put( skip_deserialization: bool = False, ): return self._update_vault_account_asset_address_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses_address_id/put.pyi b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses_address_id/put.pyi index 07238d14..6c72b41f 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses_address_id/put.pyi +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses_address_id/put.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error + # Path params VaultAccountIdSchema = schemas.StrSchema AssetIdSchema = schemas.StrSchema @@ -121,13 +116,11 @@ class SchemaForRequestBodyApplicationJson( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, ) XRequestIDSchema = schemas.StrSchema ResponseHeadersFor201 = typing_extensions.TypedDict( @@ -148,9 +141,9 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -165,103 +158,42 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _update_vault_account_asset_address_oapg( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _update_vault_account_asset_address_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _update_vault_account_asset_address_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_vault_account_asset_address_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _update_vault_account_asset_address_oapg( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _update_vault_account_asset_address_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Update address description - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + request_path_asset_id, + request_path_address_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -278,44 +210,38 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='put'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -330,84 +256,8 @@ class BaseApi(api_client.Api): class UpdateVaultAccountAssetAddress(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def update_vault_account_asset_address( - self, - content_type: typing_extensions.Literal["application/json"] = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def update_vault_account_asset_address( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def update_vault_account_asset_address( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_vault_account_asset_address( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def update_vault_account_asset_address( - self, - content_type: str = 'application/json', - body: typing.Union[SchemaForRequestBodyApplicationJson, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_vault_account_asset_address_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def update_vault_account_asset_address(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._update_vault_account_asset_address_oapg(params, request_options) class ApiForput(BaseApi): @@ -483,13 +333,13 @@ class ApiForput(BaseApi): skip_deserialization: bool = False, ): return self._update_vault_account_asset_address_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses_address_id_create_legacy/post.py b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses_address_id_create_legacy/post.py index 3a016d92..4f29e435 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses_address_id_create_legacy/post.py +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses_address_id_create_legacy/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -74,9 +68,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = CreateAddressResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -91,26 +85,26 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -125,21 +119,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -147,62 +141,25 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_legacy_address_for_vault_account_asset_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _create_legacy_address_for_vault_account_asset_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_legacy_address_for_vault_account_asset_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _create_legacy_address_for_vault_account_asset_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_legacy_address_for_vault_account_asset_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Convert a segwit address to legacy format - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + request_path_asset_id, + request_path_address_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -219,33 +176,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -260,58 +212,8 @@ class instances class CreateLegacyAddressForVaultAccountAsset(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create_legacy_address_for_vault_account_asset( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def create_legacy_address_for_vault_account_asset( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_legacy_address_for_vault_account_asset( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_legacy_address_for_vault_account_asset( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_legacy_address_for_vault_account_asset_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create_legacy_address_for_vault_account_asset(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._create_legacy_address_for_vault_account_asset_oapg(params, request_options) class ApiForpost(BaseApi): @@ -363,11 +265,11 @@ def post( skip_deserialization: bool = False, ): return self._create_legacy_address_for_vault_account_asset_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses_address_id_create_legacy/post.pyi b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses_address_id_create_legacy/post.pyi index fbc15028..01512b5d 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses_address_id_create_legacy/post.pyi +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses_address_id_create_legacy/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.create_address_response import CreateAddressResponse from fireblocks_client.model.error import Error + # Path params VaultAccountIdSchema = schemas.StrSchema AssetIdSchema = schemas.StrSchema @@ -84,21 +79,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -113,80 +108,43 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _create_legacy_address_for_vault_account_asset_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _create_legacy_address_for_vault_account_asset_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _create_legacy_address_for_vault_account_asset_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _create_legacy_address_for_vault_account_asset_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _create_legacy_address_for_vault_account_asset_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Convert a segwit address to legacy format - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + request_path_asset_id, + request_path_address_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -203,33 +161,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -244,58 +197,8 @@ class BaseApi(api_client.Api): class CreateLegacyAddressForVaultAccountAsset(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def create_legacy_address_for_vault_account_asset( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def create_legacy_address_for_vault_account_asset( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def create_legacy_address_for_vault_account_asset( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def create_legacy_address_for_vault_account_asset( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._create_legacy_address_for_vault_account_asset_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def create_legacy_address_for_vault_account_asset(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._create_legacy_address_for_vault_account_asset_oapg(params, request_options) class ApiForpost(BaseApi): @@ -347,11 +250,11 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._create_legacy_address_for_vault_account_asset_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses_address_id_set_customer_ref_id/post.py b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses_address_id_set_customer_ref_id/post.py index 98137a07..84e8fa3b 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses_address_id_set_customer_ref_id/post.py +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses_address_id_set_customer_ref_id/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -123,20 +117,18 @@ def __new__( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor201 = typing_extensions.TypedDict( 'ResponseHeadersFor201', @@ -156,14 +148,14 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -178,107 +170,46 @@ class ApiResponseFor201(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '201': _response_for_201, 'default': _response_for_default, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _set_customer_ref_id_for_vault_account_asset_address_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _set_customer_ref_id_for_vault_account_asset_address_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _set_customer_ref_id_for_vault_account_asset_address_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _set_customer_ref_id_for_vault_account_asset_address_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _set_customer_ref_id_for_vault_account_asset_address_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _set_customer_ref_id_for_vault_account_asset_address_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Assign AML customer reference ID - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + request_path_asset_id, + request_path_address_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -295,46 +226,42 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(any_type, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -349,84 +276,8 @@ class instances class SetCustomerRefIdForVaultAccountAssetAddress(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def set_customer_ref_id_for_vault_account_asset_address( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def set_customer_ref_id_for_vault_account_asset_address( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def set_customer_ref_id_for_vault_account_asset_address( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def set_customer_ref_id_for_vault_account_asset_address( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def set_customer_ref_id_for_vault_account_asset_address( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._set_customer_ref_id_for_vault_account_asset_address_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def set_customer_ref_id_for_vault_account_asset_address(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._set_customer_ref_id_for_vault_account_asset_address_oapg(params, request_options) class ApiForpost(BaseApi): @@ -502,13 +353,13 @@ def post( skip_deserialization: bool = False, ): return self._set_customer_ref_id_for_vault_account_asset_address_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses_address_id_set_customer_ref_id/post.pyi b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses_address_id_set_customer_ref_id/post.pyi index 5703857c..cc755a56 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses_address_id_set_customer_ref_id/post.pyi +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_addresses_address_id_set_customer_ref_id/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error + # Path params VaultAccountIdSchema = schemas.StrSchema AssetIdSchema = schemas.StrSchema @@ -121,13 +116,11 @@ class SchemaForRequestBodyApplicationJson( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema @@ -149,9 +142,9 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -166,103 +159,42 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _set_customer_ref_id_for_vault_account_asset_address_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _set_customer_ref_id_for_vault_account_asset_address_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _set_customer_ref_id_for_vault_account_asset_address_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _set_customer_ref_id_for_vault_account_asset_address_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _set_customer_ref_id_for_vault_account_asset_address_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _set_customer_ref_id_for_vault_account_asset_address_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Assign AML customer reference ID - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + request_path_asset_id, + request_path_address_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -279,46 +211,42 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(any_type, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -333,84 +261,8 @@ class BaseApi(api_client.Api): class SetCustomerRefIdForVaultAccountAssetAddress(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def set_customer_ref_id_for_vault_account_asset_address( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def set_customer_ref_id_for_vault_account_asset_address( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def set_customer_ref_id_for_vault_account_asset_address( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def set_customer_ref_id_for_vault_account_asset_address( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def set_customer_ref_id_for_vault_account_asset_address( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._set_customer_ref_id_for_vault_account_asset_address_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def set_customer_ref_id_for_vault_account_asset_address(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._set_customer_ref_id_for_vault_account_asset_address_oapg(params, request_options) class ApiForpost(BaseApi): @@ -486,13 +338,13 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._set_customer_ref_id_for_vault_account_asset_address_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_balance/post.py b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_balance/post.py index 34b49011..89e48a5b 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_balance/post.py +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_balance/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -66,19 +60,17 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) # body param SchemaForRequestBody = schemas.DictSchema - - request_body_body = api_client.RequestBody( - content={ - '*/*': api_client.MediaType( - schema=SchemaForRequestBody), - }, +content={ + '*/*': api_client.MediaType( + schema=SchemaForRequestBody), +}, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = VaultAsset ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -93,26 +85,26 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -127,21 +119,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -149,86 +141,24 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _update_vault_account_asset_balance_oapg( - self, - content_type: typing_extensions.Literal["*/*"] = ..., - body: typing.Union[SchemaForRequestBody, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _update_vault_account_asset_balance_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBody, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _update_vault_account_asset_balance_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBody, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_vault_account_asset_balance_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBody, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _update_vault_account_asset_balance_oapg( - self, - content_type: str = '*/*', - body: typing.Union[SchemaForRequestBody, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _update_vault_account_asset_balance_oapg(self, params: typing.Union[SchemaForRequestBody,dict, frozendict.frozendict, RequestPathParams] = None, request_options: RequestOptions = None): """ Refresh asset balance data - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -244,44 +174,38 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_body.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -296,84 +220,8 @@ class instances class UpdateVaultAccountAssetBalance(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def update_vault_account_asset_balance( - self, - content_type: typing_extensions.Literal["*/*"] = ..., - body: typing.Union[SchemaForRequestBody, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def update_vault_account_asset_balance( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBody, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def update_vault_account_asset_balance( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBody, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_vault_account_asset_balance( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBody, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def update_vault_account_asset_balance( - self, - content_type: str = '*/*', - body: typing.Union[SchemaForRequestBody, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_vault_account_asset_balance_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def update_vault_account_asset_balance(self ,params: typing.Union[SchemaForRequestBody,dict, frozendict.frozendict, RequestPathParams] = None, request_options: RequestOptions = None): + return self._update_vault_account_asset_balance_oapg(params, request_options) class ApiForpost(BaseApi): @@ -449,13 +297,13 @@ def post( skip_deserialization: bool = False, ): return self._update_vault_account_asset_balance_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_balance/post.pyi b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_balance/post.pyi index 04689b5d..d3884a95 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_balance/post.pyi +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_balance/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.vault_asset import VaultAsset from fireblocks_client.model.error import Error + # Path params VaultAccountIdSchema = schemas.StrSchema AssetIdSchema = schemas.StrSchema @@ -64,13 +59,11 @@ request_path_asset_id = api_client.PathParameter( ) # body param SchemaForRequestBody = schemas.DictSchema - - request_body_body = api_client.RequestBody( - content={ - '*/*': api_client.MediaType( - schema=SchemaForRequestBody), - }, +content={ + '*/*': api_client.MediaType( + schema=SchemaForRequestBody), +}, ) XRequestIDSchema = schemas.StrSchema SchemaFor200ResponseBody = VaultAsset @@ -86,21 +79,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -115,104 +108,42 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _update_vault_account_asset_balance_oapg( - self, - content_type: typing_extensions.Literal["*/*"] = ..., - body: typing.Union[SchemaForRequestBody, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _update_vault_account_asset_balance_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBody, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _update_vault_account_asset_balance_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBody, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _update_vault_account_asset_balance_oapg( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBody, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _update_vault_account_asset_balance_oapg( - self, - content_type: str = '*/*', - body: typing.Union[SchemaForRequestBody, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _update_vault_account_asset_balance_oapg(self, params: typing.Union[SchemaForRequestBody,dict, frozendict.frozendict, RequestPathParams] = None, request_options: RequestOptions = None): """ Refresh asset balance data - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -228,44 +159,38 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) _fields = None _body = None - if body is not schemas.unset: - serialized_data = request_body_body.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + serialized_data = request_body_body.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -280,84 +205,8 @@ class BaseApi(api_client.Api): class UpdateVaultAccountAssetBalance(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def update_vault_account_asset_balance( - self, - content_type: typing_extensions.Literal["*/*"] = ..., - body: typing.Union[SchemaForRequestBody, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def update_vault_account_asset_balance( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBody, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def update_vault_account_asset_balance( - self, - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - body: typing.Union[SchemaForRequestBody, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def update_vault_account_asset_balance( - self, - content_type: str = ..., - body: typing.Union[SchemaForRequestBody, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def update_vault_account_asset_balance( - self, - content_type: str = '*/*', - body: typing.Union[SchemaForRequestBody, dict, frozendict.frozendict, schemas.Unset] = schemas.unset, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._update_vault_account_asset_balance_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def update_vault_account_asset_balance(self ,params: typing.Union[SchemaForRequestBody,dict, frozendict.frozendict, RequestPathParams] = None, request_options: RequestOptions = None): + return self._update_vault_account_asset_balance_oapg(params, request_options) class ApiForpost(BaseApi): @@ -433,13 +282,13 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._update_vault_account_asset_balance_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_change_address_index_public_key_info/get.py b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_change_address_index_public_key_info/get.py index 03464099..816a4412 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_change_address_index_public_key_info/get.py +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_change_address_index_public_key_info/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -108,9 +102,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = PublicKeyInformation ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -125,26 +119,26 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -159,21 +153,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -181,67 +175,29 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_public_key_info_for_address_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_public_key_info_for_address_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_public_key_info_for_address_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_public_key_info_for_address_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_public_key_info_for_address_oapg(self, params: typing.Union[RequestQueryParams,RequestPathParams] = None, request_options: RequestOptions = None): """ Get the public key for a vault account - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["compressed"] = params.get("compressed") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + path_params = {} + for parameter in ( + request_path_vault_account_id, + request_path_asset_id, + request_path_change, + request_path_address_index, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -262,43 +218,38 @@ class instances prefix_separator_iterator = None for parameter in ( - request_query_compressed, - ): + request_query_compressed, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -313,63 +264,8 @@ class instances class GetPublicKeyInfoForAddress(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_public_key_info_for_address( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_public_key_info_for_address( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_public_key_info_for_address( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_public_key_info_for_address( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_public_key_info_for_address_oapg( - query_params=query_params, - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_public_key_info_for_address(self ,params: typing.Union[RequestQueryParams,RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_public_key_info_for_address_oapg(params, request_options) class ApiForget(BaseApi): @@ -425,12 +321,12 @@ def get( skip_deserialization: bool = False, ): return self._get_public_key_info_for_address_oapg( - query_params=query_params, - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_change_address_index_public_key_info/get.pyi b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_change_address_index_public_key_info/get.pyi index 0c9e2e80..0422e71b 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_change_address_index_public_key_info/get.pyi +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_change_address_index_public_key_info/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.public_key_information import PublicKeyInformation from fireblocks_client.model.error import Error + # Query params CompressedSchema = schemas.BoolSchema RequestRequiredQueryParams = typing_extensions.TypedDict( @@ -118,21 +113,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -147,85 +142,47 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_public_key_info_for_address_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_public_key_info_for_address_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_public_key_info_for_address_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_public_key_info_for_address_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_public_key_info_for_address_oapg(self, params: typing.Union[RequestQueryParams,RequestPathParams] = None, request_options: RequestOptions = None): """ Get the public key for a vault account - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["compressed"] = params.get("compressed") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + path_params = {} + for parameter in ( + request_path_vault_account_id, + request_path_asset_id, + request_path_change, + request_path_address_index, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -246,43 +203,38 @@ class BaseApi(api_client.Api): prefix_separator_iterator = None for parameter in ( - request_query_compressed, - ): + request_query_compressed, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -297,63 +249,8 @@ class BaseApi(api_client.Api): class GetPublicKeyInfoForAddress(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_public_key_info_for_address( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_public_key_info_for_address( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_public_key_info_for_address( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_public_key_info_for_address( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_public_key_info_for_address_oapg( - query_params=query_params, - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_public_key_info_for_address(self ,params: typing.Union[RequestQueryParams,RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_public_key_info_for_address_oapg(params, request_options) class ApiForget(BaseApi): @@ -409,12 +306,12 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_public_key_info_for_address_oapg( - query_params=query_params, - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_max_spendable_amount/get.py b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_max_spendable_amount/get.py index fb676086..c916c379 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_max_spendable_amount/get.py +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_max_spendable_amount/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -91,9 +85,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor200 = typing_extensions.TypedDict( 'ResponseHeadersFor200', @@ -113,14 +107,14 @@ class ApiResponseFor200(api_client.ApiResponse): _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -135,88 +129,48 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_max_spendable_amount_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _get_max_spendable_amount_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_max_spendable_amount_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_max_spendable_amount_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_max_spendable_amount_oapg(self, params: typing.Union[RequestQueryParams,RequestPathParams] = None, request_options: RequestOptions = None): """ Get the maximum spendable amount in a single transaction. - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["manual_signging"] = params.get("manual_signging") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + path_params = {} + for parameter in ( + request_path_vault_account_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -235,43 +189,38 @@ class instances prefix_separator_iterator = None for parameter in ( - request_query_manual_signging, - ): + request_query_manual_signging, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -286,63 +235,8 @@ class instances class GetMaxSpendableAmount(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_max_spendable_amount( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_max_spendable_amount( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_max_spendable_amount( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_max_spendable_amount( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_max_spendable_amount_oapg( - query_params=query_params, - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_max_spendable_amount(self ,params: typing.Union[RequestQueryParams,RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_max_spendable_amount_oapg(params, request_options) class ApiForget(BaseApi): @@ -398,12 +292,12 @@ def get( skip_deserialization: bool = False, ): return self._get_max_spendable_amount_oapg( - query_params=query_params, - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_max_spendable_amount/get.pyi b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_max_spendable_amount/get.pyi index 9416d024..501fc06a 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_max_spendable_amount/get.pyi +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_max_spendable_amount/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error + # Query params ManualSigngingSchema = schemas.BoolSchema RequestRequiredQueryParams = typing_extensions.TypedDict( @@ -106,9 +101,9 @@ class ApiResponseFor200(api_client.ApiResponse): _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -123,84 +118,44 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_max_spendable_amount_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _get_max_spendable_amount_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_max_spendable_amount_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_max_spendable_amount_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_max_spendable_amount_oapg(self, params: typing.Union[RequestQueryParams,RequestPathParams] = None, request_options: RequestOptions = None): """ Get the maximum spendable amount in a single transaction. - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["manual_signging"] = params.get("manual_signging") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + path_params = {} + for parameter in ( + request_path_vault_account_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -219,43 +174,38 @@ class BaseApi(api_client.Api): prefix_separator_iterator = None for parameter in ( - request_query_manual_signging, - ): + request_query_manual_signging, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -270,63 +220,8 @@ class BaseApi(api_client.Api): class GetMaxSpendableAmount(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_max_spendable_amount( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_max_spendable_amount( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_max_spendable_amount( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_max_spendable_amount( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_max_spendable_amount_oapg( - query_params=query_params, - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_max_spendable_amount(self ,params: typing.Union[RequestQueryParams,RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_max_spendable_amount_oapg(params, request_options) class ApiForget(BaseApi): @@ -382,12 +277,12 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_max_spendable_amount_oapg( - query_params=query_params, - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_unspent_inputs/get.py b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_unspent_inputs/get.py index 0dead16a..e765fd1c 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_unspent_inputs/get.py +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_unspent_inputs/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -66,9 +60,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) @@ -108,26 +102,26 @@ def __getitem__(self, i: int) -> 'UnspentInputsResponse': class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -142,21 +136,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -164,62 +158,24 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_vault_account_asset_unspent_inputs_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_vault_account_asset_unspent_inputs_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_vault_account_asset_unspent_inputs_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_vault_account_asset_unspent_inputs_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_vault_account_asset_unspent_inputs_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Get UTXO unspent inputs information - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -235,33 +191,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -276,58 +227,8 @@ class instances class GetVaultAccountAssetUnspentInputs(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_vault_account_asset_unspent_inputs( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_vault_account_asset_unspent_inputs( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_vault_account_asset_unspent_inputs( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_vault_account_asset_unspent_inputs( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_vault_account_asset_unspent_inputs_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_vault_account_asset_unspent_inputs(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_vault_account_asset_unspent_inputs_oapg(params, request_options) class ApiForget(BaseApi): @@ -379,11 +280,11 @@ def get( skip_deserialization: bool = False, ): return self._get_vault_account_asset_unspent_inputs_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_unspent_inputs/get.pyi b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_unspent_inputs/get.pyi index 264e73f9..c97aa3fe 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_unspent_inputs/get.pyi +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_asset_id_unspent_inputs/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.unspent_inputs_response import UnspentInputsResponse from fireblocks_client.model.error import Error + # Path params VaultAccountIdSchema = schemas.StrSchema AssetIdSchema = schemas.StrSchema @@ -101,21 +96,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -130,80 +125,42 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_vault_account_asset_unspent_inputs_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _get_vault_account_asset_unspent_inputs_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_vault_account_asset_unspent_inputs_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_vault_account_asset_unspent_inputs_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_vault_account_asset_unspent_inputs_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Get UTXO unspent inputs information - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -219,33 +176,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -260,58 +212,8 @@ class BaseApi(api_client.Api): class GetVaultAccountAssetUnspentInputs(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_vault_account_asset_unspent_inputs( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_vault_account_asset_unspent_inputs( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_vault_account_asset_unspent_inputs( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_vault_account_asset_unspent_inputs( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_vault_account_asset_unspent_inputs_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_vault_account_asset_unspent_inputs(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_vault_account_asset_unspent_inputs_oapg(params, request_options) class ApiForget(BaseApi): @@ -363,11 +265,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_vault_account_asset_unspent_inputs_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_hide/post.py b/fireblocks_client/paths/vault_accounts_vault_account_id_hide/post.py index 9fc1d4c6..c4abe064 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_hide/post.py +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_hide/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -57,9 +51,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor201 = typing_extensions.TypedDict( 'ResponseHeadersFor201', @@ -79,14 +73,14 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -101,83 +95,44 @@ class ApiResponseFor201(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '201': _response_for_201, 'default': _response_for_default, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _hide_vault_account_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _hide_vault_account_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _hide_vault_account_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _hide_vault_account_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _hide_vault_account_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Hide a vault account in the console - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -192,33 +147,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -233,58 +183,8 @@ class instances class HideVaultAccount(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def hide_vault_account( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def hide_vault_account( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def hide_vault_account( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def hide_vault_account( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._hide_vault_account_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def hide_vault_account(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._hide_vault_account_oapg(params, request_options) class ApiForpost(BaseApi): @@ -336,11 +236,11 @@ def post( skip_deserialization: bool = False, ): return self._hide_vault_account_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_hide/post.pyi b/fireblocks_client/paths/vault_accounts_vault_account_id_hide/post.pyi index 7cee56ee..e7711956 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_hide/post.pyi +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_hide/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error + # Path params VaultAccountIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -72,9 +67,9 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -89,79 +84,40 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _hide_vault_account_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _hide_vault_account_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _hide_vault_account_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _hide_vault_account_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _hide_vault_account_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Hide a vault account in the console - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -176,33 +132,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -217,58 +168,8 @@ class BaseApi(api_client.Api): class HideVaultAccount(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def hide_vault_account( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def hide_vault_account( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def hide_vault_account( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def hide_vault_account( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._hide_vault_account_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def hide_vault_account(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._hide_vault_account_oapg(params, request_options) class ApiForpost(BaseApi): @@ -320,11 +221,11 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._hide_vault_account_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_set_auto_fuel/post.py b/fireblocks_client/paths/vault_accounts_vault_account_id_set_auto_fuel/post.py index 8575e144..4b7b7c33 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_set_auto_fuel/post.py +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_set_auto_fuel/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -107,20 +101,18 @@ def __new__( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor201 = typing_extensions.TypedDict( 'ResponseHeadersFor201', @@ -140,14 +132,14 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -162,107 +154,44 @@ class ApiResponseFor201(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '201': _response_for_201, 'default': _response_for_default, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _set_auto_fuel_for_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - @typing.overload - def _set_auto_fuel_for_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _set_auto_fuel_for_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _set_auto_fuel_for_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _set_auto_fuel_for_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _set_auto_fuel_for_vault_account_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Turn autofueling on or off - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -277,46 +206,42 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(any_type, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -331,84 +256,8 @@ class instances class SetAutoFuelForVaultAccount(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def set_auto_fuel_for_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def set_auto_fuel_for_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def set_auto_fuel_for_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def set_auto_fuel_for_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def set_auto_fuel_for_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._set_auto_fuel_for_vault_account_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def set_auto_fuel_for_vault_account(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._set_auto_fuel_for_vault_account_oapg(params, request_options) class ApiForpost(BaseApi): @@ -484,13 +333,13 @@ def post( skip_deserialization: bool = False, ): return self._set_auto_fuel_for_vault_account_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_set_auto_fuel/post.pyi b/fireblocks_client/paths/vault_accounts_vault_account_id_set_auto_fuel/post.pyi index 793889cb..e04dc00c 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_set_auto_fuel/post.pyi +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_set_auto_fuel/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error + # Path params VaultAccountIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -105,13 +100,11 @@ class SchemaForRequestBodyApplicationJson( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema @@ -133,9 +126,9 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -150,103 +143,40 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _set_auto_fuel_for_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - @typing.overload - def _set_auto_fuel_for_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _set_auto_fuel_for_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _set_auto_fuel_for_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _set_auto_fuel_for_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _set_auto_fuel_for_vault_account_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Turn autofueling on or off - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -261,46 +191,42 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(any_type, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -315,84 +241,8 @@ class BaseApi(api_client.Api): class SetAutoFuelForVaultAccount(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def set_auto_fuel_for_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def set_auto_fuel_for_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def set_auto_fuel_for_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def set_auto_fuel_for_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def set_auto_fuel_for_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._set_auto_fuel_for_vault_account_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def set_auto_fuel_for_vault_account(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._set_auto_fuel_for_vault_account_oapg(params, request_options) class ApiForpost(BaseApi): @@ -468,13 +318,13 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._set_auto_fuel_for_vault_account_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_set_customer_ref_id/post.py b/fireblocks_client/paths/vault_accounts_vault_account_id_set_customer_ref_id/post.py index 02292150..b29eed84 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_set_customer_ref_id/post.py +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_set_customer_ref_id/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -107,20 +101,18 @@ def __new__( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor201 = typing_extensions.TypedDict( 'ResponseHeadersFor201', @@ -140,14 +132,14 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -162,107 +154,44 @@ class ApiResponseFor201(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '201': _response_for_201, 'default': _response_for_default, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _set_customer_ref_id_for_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - @typing.overload - def _set_customer_ref_id_for_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _set_customer_ref_id_for_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _set_customer_ref_id_for_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _set_customer_ref_id_for_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _set_customer_ref_id_for_vault_account_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Set an AML/KYT customer reference ID for a vault account - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -277,46 +206,42 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(any_type, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -331,84 +256,8 @@ class instances class SetCustomerRefIdForVaultAccount(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def set_customer_ref_id_for_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def set_customer_ref_id_for_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def set_customer_ref_id_for_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def set_customer_ref_id_for_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def set_customer_ref_id_for_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._set_customer_ref_id_for_vault_account_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def set_customer_ref_id_for_vault_account(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._set_customer_ref_id_for_vault_account_oapg(params, request_options) class ApiForpost(BaseApi): @@ -484,13 +333,13 @@ def post( skip_deserialization: bool = False, ): return self._set_customer_ref_id_for_vault_account_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_set_customer_ref_id/post.pyi b/fireblocks_client/paths/vault_accounts_vault_account_id_set_customer_ref_id/post.pyi index b869b720..f37eea29 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_set_customer_ref_id/post.pyi +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_set_customer_ref_id/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error + # Path params VaultAccountIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -105,13 +100,11 @@ class SchemaForRequestBodyApplicationJson( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema @@ -133,9 +126,9 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -150,103 +143,40 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _set_customer_ref_id_for_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - @typing.overload - def _set_customer_ref_id_for_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _set_customer_ref_id_for_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _set_customer_ref_id_for_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _set_customer_ref_id_for_vault_account_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _set_customer_ref_id_for_vault_account_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Set an AML/KYT customer reference ID for a vault account - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -261,46 +191,42 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(any_type, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -315,84 +241,8 @@ class BaseApi(api_client.Api): class SetCustomerRefIdForVaultAccount(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def set_customer_ref_id_for_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def set_customer_ref_id_for_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def set_customer_ref_id_for_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def set_customer_ref_id_for_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def set_customer_ref_id_for_vault_account( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._set_customer_ref_id_for_vault_account_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def set_customer_ref_id_for_vault_account(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._set_customer_ref_id_for_vault_account_oapg(params, request_options) class ApiForpost(BaseApi): @@ -468,13 +318,13 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._set_customer_ref_id_for_vault_account_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_unhide/post.py b/fireblocks_client/paths/vault_accounts_vault_account_id_unhide/post.py index 2efde370..554ced6e 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_unhide/post.py +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_unhide/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -57,9 +51,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor201 = typing_extensions.TypedDict( 'ResponseHeadersFor201', @@ -79,14 +73,14 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -101,83 +95,44 @@ class ApiResponseFor201(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '201': _response_for_201, 'default': _response_for_default, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _unhide_vault_account_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _unhide_vault_account_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _unhide_vault_account_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _unhide_vault_account_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _unhide_vault_account_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Unhide a vault account in the console - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -192,33 +147,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -233,58 +183,8 @@ class instances class UnhideVaultAccount(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def unhide_vault_account( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def unhide_vault_account( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def unhide_vault_account( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def unhide_vault_account( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._unhide_vault_account_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def unhide_vault_account(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._unhide_vault_account_oapg(params, request_options) class ApiForpost(BaseApi): @@ -336,11 +236,11 @@ def post( skip_deserialization: bool = False, ): return self._unhide_vault_account_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_accounts_vault_account_id_unhide/post.pyi b/fireblocks_client/paths/vault_accounts_vault_account_id_unhide/post.pyi index 34223cb8..ed65fad1 100644 --- a/fireblocks_client/paths/vault_accounts_vault_account_id_unhide/post.pyi +++ b/fireblocks_client/paths/vault_accounts_vault_account_id_unhide/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error + # Path params VaultAccountIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -72,9 +67,9 @@ class ApiResponseFor201(api_client.ApiResponse): _response_for_201 = api_client.OpenApiResponse( response_cls=ApiResponseFor201, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -89,79 +84,40 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _unhide_vault_account_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _unhide_vault_account_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _unhide_vault_account_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _unhide_vault_account_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _unhide_vault_account_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Unhide a vault account in the console - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_vault_account_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -176,33 +132,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -217,58 +168,8 @@ class BaseApi(api_client.Api): class UnhideVaultAccount(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def unhide_vault_account( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - ]: ... - - @typing.overload - def unhide_vault_account( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def unhide_vault_account( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor201, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def unhide_vault_account( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._unhide_vault_account_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def unhide_vault_account(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._unhide_vault_account_oapg(params, request_options) class ApiForpost(BaseApi): @@ -320,11 +221,11 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._unhide_vault_account_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_asset_wallets/get.py b/fireblocks_client/paths/vault_asset_wallets/get.py index 9ba596fd..63420791 100644 --- a/fireblocks_client/paths/vault_asset_wallets/get.py +++ b/fireblocks_client/paths/vault_asset_wallets/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -98,9 +92,9 @@ class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams) ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = PaginatedAssetWalletResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -115,121 +109,79 @@ class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams) class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, } _all_accept_content_types = ( '*/*', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_asset_wallets_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def _get_asset_wallets_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_asset_wallets_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_asset_wallets_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_asset_wallets_oapg(self, params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): """ List asset wallets (Paginated) - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["total_amount_larger_than"] = params.get("total_amount_larger_than") + query_params["asset_id"] = params.get("asset_id") + query_params["before"] = params.get("before") + query_params["after"] = params.get("after") + query_params["limit"] = params.get("limit") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + used_path = path.value prefix_separator_iterator = None for parameter in ( - request_query_total_amount_larger_than, - request_query_asset_id, - request_query_before, - request_query_after, - request_query_limit, - ): + request_query_total_amount_larger_than, + request_query_asset_id, + request_query_before, + request_query_after, + request_query_limit, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -244,56 +196,8 @@ class instances class GetAssetWallets(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_asset_wallets( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get_asset_wallets( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_asset_wallets( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_asset_wallets( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_asset_wallets_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_asset_wallets(self ,params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): + return self._get_asset_wallets_oapg(params, request_options) class ApiForget(BaseApi): @@ -343,11 +247,11 @@ def get( skip_deserialization: bool = False, ): return self._get_asset_wallets_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_asset_wallets/get.pyi b/fireblocks_client/paths/vault_asset_wallets/get.pyi index 6012e71e..6c18fb79 100644 --- a/fireblocks_client/paths/vault_asset_wallets/get.pyi +++ b/fireblocks_client/paths/vault_asset_wallets/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.paginated_asset_wallet_response import PaginatedAssetWalletResponse + # Query params TotalAmountLargerThanSchema = schemas.NumberSchema AssetIdSchema = schemas.StrSchema @@ -104,118 +99,76 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_asset_wallets_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - @typing.overload - def _get_asset_wallets_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_asset_wallets_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_asset_wallets_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_asset_wallets_oapg(self, params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): """ List asset wallets (Paginated) - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["total_amount_larger_than"] = params.get("total_amount_larger_than") + query_params["asset_id"] = params.get("asset_id") + query_params["before"] = params.get("before") + query_params["after"] = params.get("after") + query_params["limit"] = params.get("limit") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + used_path = path.value prefix_separator_iterator = None for parameter in ( - request_query_total_amount_larger_than, - request_query_asset_id, - request_query_before, - request_query_after, - request_query_limit, - ): + request_query_total_amount_larger_than, + request_query_asset_id, + request_query_before, + request_query_after, + request_query_limit, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -230,56 +183,8 @@ class BaseApi(api_client.Api): class GetAssetWallets(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_asset_wallets( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ]: ... - - @typing.overload - def get_asset_wallets( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_asset_wallets( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_asset_wallets( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_asset_wallets_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_asset_wallets(self ,params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): + return self._get_asset_wallets_oapg(params, request_options) class ApiForget(BaseApi): @@ -329,11 +234,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_asset_wallets_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_assets/get.py b/fireblocks_client/paths/vault_assets/get.py index a9c87c98..cb233126 100644 --- a/fireblocks_client/paths/vault_assets/get.py +++ b/fireblocks_client/paths/vault_assets/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -66,9 +60,9 @@ class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams) ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) @@ -108,26 +102,26 @@ def __getitem__(self, i: int) -> 'VaultAsset': class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -142,21 +136,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -164,104 +158,57 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_vault_assets_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_vault_assets_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_vault_assets_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_vault_assets_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_vault_assets_oapg(self, params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): """ Get asset balance for chosen assets - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["account_name_prefix"] = params.get("account_name_prefix") + query_params["account_name_suffix"] = params.get("account_name_suffix") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + used_path = path.value prefix_separator_iterator = None for parameter in ( - request_query_account_name_prefix, - request_query_account_name_suffix, - ): + request_query_account_name_prefix, + request_query_account_name_suffix, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -276,58 +223,8 @@ class instances class GetVaultAssets(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_vault_assets( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_vault_assets( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_vault_assets( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_vault_assets( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_vault_assets_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_vault_assets(self ,params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): + return self._get_vault_assets_oapg(params, request_options) class ApiForget(BaseApi): @@ -379,11 +276,11 @@ def get( skip_deserialization: bool = False, ): return self._get_vault_assets_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_assets/get.pyi b/fireblocks_client/paths/vault_assets/get.pyi index ce412457..471835f5 100644 --- a/fireblocks_client/paths/vault_assets/get.pyi +++ b/fireblocks_client/paths/vault_assets/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.vault_asset import VaultAsset from fireblocks_client.model.error import Error + # Query params AccountNamePrefixSchema = schemas.StrSchema AccountNameSuffixSchema = schemas.StrSchema @@ -101,21 +96,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -130,122 +125,75 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_vault_assets_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_vault_assets_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_vault_assets_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_vault_assets_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_vault_assets_oapg(self, params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): """ Get asset balance for chosen assets - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["account_name_prefix"] = params.get("account_name_prefix") + query_params["account_name_suffix"] = params.get("account_name_suffix") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + used_path = path.value prefix_separator_iterator = None for parameter in ( - request_query_account_name_prefix, - request_query_account_name_suffix, - ): + request_query_account_name_prefix, + request_query_account_name_suffix, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -260,58 +208,8 @@ class BaseApi(api_client.Api): class GetVaultAssets(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_vault_assets( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_vault_assets( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_vault_assets( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_vault_assets( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_vault_assets_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_vault_assets(self ,params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): + return self._get_vault_assets_oapg(params, request_options) class ApiForget(BaseApi): @@ -363,11 +261,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_vault_assets_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_assets_asset_id/get.py b/fireblocks_client/paths/vault_assets_asset_id/get.py index 0c3e392c..918fd6c2 100644 --- a/fireblocks_client/paths/vault_assets_asset_id/get.py +++ b/fireblocks_client/paths/vault_assets_asset_id/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -58,9 +52,9 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = VaultAsset ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -75,26 +69,26 @@ class RequestPathParams(RequestRequiredPathParams, RequestOptionalPathParams): class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -109,21 +103,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -131,62 +125,23 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_vault_asset_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_vault_asset_by_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_vault_asset_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_vault_asset_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_vault_asset_by_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Get vault balance by asset - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -201,33 +156,28 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -242,58 +192,8 @@ class instances class GetVaultAssetById(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_vault_asset_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_vault_asset_by_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_vault_asset_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_vault_asset_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_vault_asset_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_vault_asset_by_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_vault_asset_by_id_oapg(params, request_options) class ApiForget(BaseApi): @@ -345,11 +245,11 @@ def get( skip_deserialization: bool = False, ): return self._get_vault_asset_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_assets_asset_id/get.pyi b/fireblocks_client/paths/vault_assets_asset_id/get.pyi index 7e32ea27..55f461ba 100644 --- a/fireblocks_client/paths/vault_assets_asset_id/get.pyi +++ b/fireblocks_client/paths/vault_assets_asset_id/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.vault_asset import VaultAsset from fireblocks_client.model.error import Error + # Path params AssetIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -68,21 +63,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -97,80 +92,41 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_vault_asset_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_vault_asset_by_id_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - @typing.overload - def _get_vault_asset_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _get_vault_asset_by_id_oapg( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_vault_asset_by_id_oapg(self, params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): """ Get vault balance by asset - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_asset_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -185,33 +141,28 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -226,58 +177,8 @@ class BaseApi(api_client.Api): class GetVaultAssetById(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_vault_asset_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_vault_asset_by_id( - self, - skip_deserialization: typing_extensions.Literal[True], - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_vault_asset_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_vault_asset_by_id( - self, - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_vault_asset_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_vault_asset_by_id(self ,params: typing.Union[RequestPathParams] = None, request_options: RequestOptions = None): + return self._get_vault_asset_by_id_oapg(params, request_options) class ApiForget(BaseApi): @@ -329,11 +230,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_vault_asset_by_id_oapg( - path_params=path_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + path_params=path_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_public_key_info_/get.py b/fireblocks_client/paths/vault_public_key_info_/get.py index 68938ff3..e168ec3a 100644 --- a/fireblocks_client/paths/vault_public_key_info_/get.py +++ b/fireblocks_client/paths/vault_public_key_info_/get.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -76,9 +70,9 @@ class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams) ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = PublicKeyInformation ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -93,26 +87,26 @@ class RequestQueryParams(RequestRequiredQueryParams, RequestOptionalQueryParams) class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -127,21 +121,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -149,105 +143,59 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_public_key_info_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_public_key_info_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_public_key_info_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_public_key_info_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_public_key_info_oapg(self, params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): """ Get the public key information - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["derivation_path"] = params.get("derivation_path") + query_params["algorithm"] = params.get("algorithm") + query_params["compressed"] = params.get("compressed") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + used_path = path.value prefix_separator_iterator = None for parameter in ( - request_query_derivation_path, - request_query_algorithm, - request_query_compressed, - ): + request_query_derivation_path, + request_query_algorithm, + request_query_compressed, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -262,58 +210,8 @@ class instances class GetPublicKeyInfo(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_public_key_info( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_public_key_info( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_public_key_info( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_public_key_info( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_public_key_info_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_public_key_info(self ,params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): + return self._get_public_key_info_oapg(params, request_options) class ApiForget(BaseApi): @@ -365,11 +263,11 @@ def get( skip_deserialization: bool = False, ): return self._get_public_key_info_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/vault_public_key_info_/get.pyi b/fireblocks_client/paths/vault_public_key_info_/get.pyi index 448ef9e9..0c5465c1 100644 --- a/fireblocks_client/paths/vault_public_key_info_/get.pyi +++ b/fireblocks_client/paths/vault_public_key_info_/get.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.public_key_information import PublicKeyInformation from fireblocks_client.model.error import Error + # Query params DerivationPathSchema = schemas.StrSchema AlgorithmSchema = schemas.StrSchema @@ -86,21 +81,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -115,123 +110,77 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _get_public_key_info_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _get_public_key_info_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _get_public_key_info_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _get_public_key_info_oapg( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _get_public_key_info_oapg(self, params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): """ Get the public key information - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + query_params = {} + query_params["derivation_path"] = params.get("derivation_path") + query_params["algorithm"] = params.get("algorithm") + query_params["compressed"] = params.get("compressed") self._verify_typed_dict_inputs_oapg(RequestQueryParams, query_params) + used_path = path.value prefix_separator_iterator = None for parameter in ( - request_query_derivation_path, - request_query_algorithm, - request_query_compressed, - ): + request_query_derivation_path, + request_query_algorithm, + request_query_compressed, + ): parameter_data = query_params.get(parameter.name, schemas.unset) if parameter_data is schemas.unset: continue if prefix_separator_iterator is None: prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) for serialized_value in serialized_data.values(): used_path += serialized_value - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='get'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -246,58 +195,8 @@ class BaseApi(api_client.Api): class GetPublicKeyInfo(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def get_public_key_info( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def get_public_key_info( - self, - skip_deserialization: typing_extensions.Literal[True], - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def get_public_key_info( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def get_public_key_info( - self, - query_params: RequestQueryParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._get_public_key_info_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def get_public_key_info(self ,params: typing.Union[RequestQueryParams,] = None, request_options: RequestOptions = None): + return self._get_public_key_info_oapg(params, request_options) class ApiForget(BaseApi): @@ -349,11 +248,11 @@ class ApiForget(BaseApi): skip_deserialization: bool = False, ): return self._get_public_key_info_oapg( - query_params=query_params, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + query_params=query_params, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/webhooks_resend/post.py b/fireblocks_client/paths/webhooks_resend/post.py index f78580c9..4055175b 100644 --- a/fireblocks_client/paths/webhooks_resend/post.py +++ b/fireblocks_client/paths/webhooks_resend/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -32,9 +26,9 @@ XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor200ResponseBody = ResendWebhooksResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -49,26 +43,26 @@ class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -83,21 +77,21 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, @@ -105,85 +99,39 @@ class ApiResponseForDefault(api_client.ApiResponse): _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _resend_webhooks_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _resend_webhooks_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _resend_webhooks_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _resend_webhooks_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _resend_webhooks_oapg(self, request_options: RequestOptions = None): """ Resend failed webhooks - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -198,53 +146,8 @@ class instances class ResendWebhooks(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def resend_webhooks( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def resend_webhooks( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def resend_webhooks( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def resend_webhooks( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._resend_webhooks_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def resend_webhooks(self , request_options: RequestOptions = None): + return self._resend_webhooks_oapg(request_options) class ApiForpost(BaseApi): @@ -292,10 +195,10 @@ def post( skip_deserialization: bool = False, ): return self._resend_webhooks_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/webhooks_resend/post.pyi b/fireblocks_client/paths/webhooks_resend/post.pyi index 1b8e9013..8506d658 100644 --- a/fireblocks_client/paths/webhooks_resend/post.pyi +++ b/fireblocks_client/paths/webhooks_resend/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -28,6 +22,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error from fireblocks_client.model.resend_webhooks_response import ResendWebhooksResponse + XRequestIDSchema = schemas.StrSchema SchemaFor200ResponseBody = ResendWebhooksResponse ResponseHeadersFor200 = typing_extensions.TypedDict( @@ -42,21 +37,21 @@ ResponseHeadersFor200 = typing_extensions.TypedDict( class ApiResponseFor200(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor200ResponseBody, - ] + SchemaFor200ResponseBody, + ] headers: ResponseHeadersFor200 _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, content={ - '*/*': api_client.MediaType( - schema=SchemaFor200ResponseBody), + '*/*': api_client.MediaType( + schema=SchemaFor200ResponseBody), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -71,103 +66,57 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( '*/*', 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _resend_webhooks_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def _resend_webhooks_oapg( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _resend_webhooks_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - def _resend_webhooks_oapg( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _resend_webhooks_oapg(self, request_options: RequestOptions = None): """ Resend failed webhooks - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ - used_path = path.value + used_path = path.value _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -182,53 +131,8 @@ class BaseApi(api_client.Api): class ResendWebhooks(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def resend_webhooks( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def resend_webhooks( - self, - skip_deserialization: typing_extensions.Literal[True], - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def resend_webhooks( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def resend_webhooks( - self, - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._resend_webhooks_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def resend_webhooks(self , request_options: RequestOptions = None): + return self._resend_webhooks_oapg(request_options) class ApiForpost(BaseApi): @@ -276,10 +180,10 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._resend_webhooks_oapg( - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/webhooks_resend_tx_id/post.py b/fireblocks_client/paths/webhooks_resend_tx_id/post.py index 23099ab7..035667aa 100644 --- a/fireblocks_client/paths/webhooks_resend_tx_id/post.py +++ b/fireblocks_client/paths/webhooks_resend_tx_id/post.py @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -117,20 +111,18 @@ def __new__( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) ResponseHeadersFor200 = typing_extensions.TypedDict( 'ResponseHeadersFor200', @@ -150,14 +142,14 @@ class ApiResponseFor200(api_client.ApiResponse): _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema x_request_id_parameter = api_client.HeaderParameter( - name="X-Request-ID", +name="X-Request-ID", style=api_client.ParameterStyle.SIMPLE, - schema=XRequestIDSchema, + schema=XRequestIDSchema, ) SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -172,107 +164,44 @@ class ApiResponseFor200(api_client.ApiResponse): class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _status_code_to_response = { '200': _response_for_200, 'default': _response_for_default, } _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _resend_webhooks_for_transaction_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _resend_webhooks_for_transaction_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _resend_webhooks_for_transaction_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _resend_webhooks_for_transaction_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _resend_webhooks_for_transaction_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _resend_webhooks_for_transaction_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Resend failed webhooks for a transaction by ID - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_tx_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -287,46 +216,42 @@ class instances for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(any_type, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -341,84 +266,8 @@ class instances class ResendWebhooksForTransaction(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def resend_webhooks_for_transaction( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def resend_webhooks_for_transaction( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def resend_webhooks_for_transaction( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def resend_webhooks_for_transaction( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def resend_webhooks_for_transaction( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._resend_webhooks_for_transaction_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def resend_webhooks_for_transaction(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._resend_webhooks_for_transaction_oapg(params, request_options) class ApiForpost(BaseApi): @@ -494,13 +343,13 @@ def post( skip_deserialization: bool = False, ): return self._resend_webhooks_for_transaction_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/fireblocks_client/paths/webhooks_resend_tx_id/post.pyi b/fireblocks_client/paths/webhooks_resend_tx_id/post.pyi index 3ad956f7..5c7d2471 100644 --- a/fireblocks_client/paths/webhooks_resend_tx_id/post.pyi +++ b/fireblocks_client/paths/webhooks_resend_tx_id/post.pyi @@ -1,13 +1,7 @@ # coding: utf-8 - -""" - - - Generated by: https://openapi-generator.tech -""" - from dataclasses import dataclass import typing_extensions +from fireblocks_client.model.request_options import RequestOptions import urllib3 from urllib3._collections import HTTPHeaderDict @@ -27,6 +21,7 @@ from fireblocks_client import schemas # noqa: F401 from fireblocks_client.model.error import Error + # Path params TxIdSchema = schemas.StrSchema RequestRequiredPathParams = typing_extensions.TypedDict( @@ -115,13 +110,11 @@ class SchemaForRequestBodyApplicationJson( _configuration=_configuration, **kwargs, ) - - request_body_any_type = api_client.RequestBody( - content={ - 'application/json': api_client.MediaType( - schema=SchemaForRequestBodyApplicationJson), - }, +content={ + 'application/json': api_client.MediaType( + schema=SchemaForRequestBodyApplicationJson), +}, required=True, ) XRequestIDSchema = schemas.StrSchema @@ -143,9 +136,9 @@ class ApiResponseFor200(api_client.ApiResponse): _response_for_200 = api_client.OpenApiResponse( response_cls=ApiResponseFor200, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) XRequestIDSchema = schemas.StrSchema SchemaFor0ResponseBodyApplicationJson = Error ResponseHeadersFor0 = typing_extensions.TypedDict( @@ -160,103 +153,40 @@ ResponseHeadersFor0 = typing_extensions.TypedDict( class ApiResponseForDefault(api_client.ApiResponse): response: urllib3.HTTPResponse body: typing.Union[ - SchemaFor0ResponseBodyApplicationJson, - ] + SchemaFor0ResponseBodyApplicationJson, + ] headers: ResponseHeadersFor0 _response_for_default = api_client.OpenApiResponse( response_cls=ApiResponseForDefault, content={ - 'application/json': api_client.MediaType( - schema=SchemaFor0ResponseBodyApplicationJson), + 'application/json': api_client.MediaType( + schema=SchemaFor0ResponseBodyApplicationJson), }, headers=[ - x_request_id_parameter, - ] -) + x_request_id_parameter, + ] + ) _all_accept_content_types = ( 'application/json', -) + ) class BaseApi(api_client.Api): - @typing.overload - def _resend_webhooks_for_transaction_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - @typing.overload - def _resend_webhooks_for_transaction_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def _resend_webhooks_for_transaction_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def _resend_webhooks_for_transaction_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def _resend_webhooks_for_transaction_oapg( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): + def _resend_webhooks_for_transaction_oapg(self, params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): """ Resend failed webhooks for a transaction by ID - :param skip_deserialization: If true then api_response.response will be set but - api_response.body and api_response.headers will not be deserialized into schema - class instances """ + path_params = {} + for parameter in ( + request_path_tx_id, + ): + path_params[parameter.name] = params.get(parameter.name,None) + self._verify_typed_dict_inputs_oapg(RequestPathParams, path_params) + used_path = path.value _path_params = {} @@ -271,46 +201,42 @@ class BaseApi(api_client.Api): for k, v in _path_params.items(): used_path = used_path.replace('{%s}' % k, v) - _headers = HTTPHeaderDict() - # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) + body = params.get(any_type, schemas.unset) if body is schemas.unset: raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') + 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None - serialized_data = request_body_any_type.serialize(body, content_type) - _headers.add('Content-Type', content_type) + serialized_data = request_body_any_type.serialize(params, "application/json") + _headers.add('Content-Type', "application/json") if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] + idempotency_key = request_options.get("idempotency_key") + if idempotency_key: + _headers.add("Idempotency-Key", idempotency_key) + response = self.api_client.call_api( resource_path=used_path, method='post'.upper(), headers=_headers, fields=_fields, body=_body, - stream=stream, - timeout=timeout, + timeout=10000, ) - if skip_deserialization: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + response_for_status = _status_code_to_response.get(str(response.status)) + if response_for_status: + api_response = response_for_status.deserialize(response, self.api_client.configuration) else: - response_for_status = _status_code_to_response.get(str(response.status)) - if response_for_status: - api_response = response_for_status.deserialize(response, self.api_client.configuration) + default_response = _status_code_to_response.get('default') + if default_response: + api_response = default_response.deserialize(response, self.api_client.configuration) else: - default_response = _status_code_to_response.get('default') - if default_response: - api_response = default_response.deserialize(response, self.api_client.configuration) - else: - api_response = api_client.ApiResponseWithoutDeserialization(response=response) + api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException( @@ -325,84 +251,8 @@ class BaseApi(api_client.Api): class ResendWebhooksForTransaction(BaseApi): # this class is used by api classes that refer to endpoints with operationId fn names - @typing.overload - def resend_webhooks_for_transaction( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: typing_extensions.Literal["application/json"] = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - @typing.overload - def resend_webhooks_for_transaction( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: typing_extensions.Literal[False] = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - ]: ... - - - @typing.overload - def resend_webhooks_for_transaction( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - skip_deserialization: typing_extensions.Literal[True], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - ) -> api_client.ApiResponseWithoutDeserialization: ... - - @typing.overload - def resend_webhooks_for_transaction( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = ..., - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = ..., - ) -> typing.Union[ - ApiResponseFor200, - ApiResponseForDefault, - api_client.ApiResponseWithoutDeserialization, - ]: ... - - def resend_webhooks_for_transaction( - self, - body: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ], - content_type: str = 'application/json', - path_params: RequestPathParams = frozendict.frozendict(), - accept_content_types: typing.Tuple[str] = _all_accept_content_types, - stream: bool = False, - timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, - skip_deserialization: bool = False, - ): - return self._resend_webhooks_for_transaction_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + def resend_webhooks_for_transaction(self ,params: typing.Union[SchemaForRequestBodyApplicationJson,dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, RequestPathParams] = None, request_options: RequestOptions = None): + return self._resend_webhooks_for_transaction_oapg(params, request_options) class ApiForpost(BaseApi): @@ -478,13 +328,13 @@ class ApiForpost(BaseApi): skip_deserialization: bool = False, ): return self._resend_webhooks_for_transaction_oapg( - body=body, - path_params=path_params, - content_type=content_type, - accept_content_types=accept_content_types, - stream=stream, - timeout=timeout, - skip_deserialization=skip_deserialization - ) + body=body, + path_params=path_params, + content_type=content_type, + accept_content_types=accept_content_types, + stream=stream, + timeout=timeout, + skip_deserialization=skip_deserialization + ) diff --git a/setup.py b/setup.py index 054ffcec..71e5e8d0 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ "certifi >= 14.5.14", "frozendict ~= 2.3.4", "python-dateutil ~= 2.7.0", - "setuptools >= 21.0.1", + "setuptools >= 21.0.0", "typing_extensions ~= 4.3.0", "urllib3 ~= 2.0.0", "aenum >= 3.1.11", @@ -40,7 +40,7 @@ setup( name=NAME, - version="1.0.1", + version="1.0.0", description="Fireblocks Auto Generated SDK", author="Fireblocks", author_email="support@fireblocks.com", diff --git a/test/test_models/test_ncw.py b/test/test_models/test_ncw.py new file mode 100644 index 00000000..2ac37801 --- /dev/null +++ b/test/test_models/test_ncw.py @@ -0,0 +1,26 @@ +# coding: utf-8 + +""" + Fireblocks API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: 1.6.2 + Contact: support@fireblocks.com + Generated by: https://openapi-generator.tech +""" + +import unittest + +import fireblocks_client +from fireblocks_client.model.ncw import Ncw +from fireblocks_client import configuration + + +class TestNcw(unittest.TestCase): + """Ncw unit test stubs""" + _configuration = configuration.Configuration() + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_models/test_request_options.py b/test/test_models/test_request_options.py new file mode 100644 index 00000000..00766fae --- /dev/null +++ b/test/test_models/test_request_options.py @@ -0,0 +1,26 @@ +# coding: utf-8 + +""" + Fireblocks API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: 1.6.2 + Contact: support@fireblocks.com + Generated by: https://openapi-generator.tech +""" + +import unittest + +import fireblocks_client +from fireblocks_client.model.request_options import RequestOptions +from fireblocks_client import configuration + + +class TestRequestOptions(unittest.TestCase): + """RequestOptions unit test stubs""" + _configuration = configuration.Configuration() + + +if __name__ == '__main__': + unittest.main()