1use {
10 super::{Error, configuration},
11 crate::{
12 apis::{ContentType, ResponseContent},
13 models,
14 },
15 async_trait::async_trait,
16 reqwest,
17 serde::{Deserialize, Serialize, de::Error as _},
18 std::sync::Arc,
19};
20
21#[async_trait]
22pub trait VaultsApi: Send + Sync {
23 async fn activate_asset_for_vault_account(
30 &self,
31 params: ActivateAssetForVaultAccountParams,
32 ) -> Result<models::CreateVaultAssetResponse, Error<ActivateAssetForVaultAccountError>>;
33
34 async fn attach_or_detach_tags_from_vault_accounts(
41 &self,
42 params: AttachOrDetachTagsFromVaultAccountsParams,
43 ) -> Result<
44 models::VaultAccountsTagAttachmentOperationsResponse,
45 Error<AttachOrDetachTagsFromVaultAccountsError>,
46 >;
47
48 async fn attach_tags_to_vault_accounts(
54 &self,
55 params: AttachTagsToVaultAccountsParams,
56 ) -> Result<(), Error<AttachTagsToVaultAccountsError>>;
57
58 async fn create_legacy_address(
64 &self,
65 params: CreateLegacyAddressParams,
66 ) -> Result<models::CreateAddressResponse, Error<CreateLegacyAddressError>>;
67
68 async fn create_multiple_accounts(
78 &self,
79 params: CreateMultipleAccountsParams,
80 ) -> Result<models::JobCreated, Error<CreateMultipleAccountsError>>;
81
82 async fn create_multiple_deposit_addresses(
94 &self,
95 params: CreateMultipleDepositAddressesParams,
96 ) -> Result<models::JobCreated, Error<CreateMultipleDepositAddressesError>>;
97
98 async fn create_vault_account(
102 &self,
103 params: CreateVaultAccountParams,
104 ) -> Result<models::VaultAccount, Error<CreateVaultAccountError>>;
105
106 async fn create_vault_account_asset(
110 &self,
111 params: CreateVaultAccountAssetParams,
112 ) -> Result<models::CreateVaultAssetResponse, Error<CreateVaultAccountAssetError>>;
113
114 async fn create_vault_account_asset_address(
121 &self,
122 params: CreateVaultAccountAssetAddressParams,
123 ) -> Result<models::CreateAddressResponse, Error<CreateVaultAccountAssetAddressError>>;
124
125 async fn detach_tags_from_vault_accounts(
131 &self,
132 params: DetachTagsFromVaultAccountsParams,
133 ) -> Result<(), Error<DetachTagsFromVaultAccountsError>>;
134
135 async fn get_asset_wallets(
142 &self,
143 params: GetAssetWalletsParams,
144 ) -> Result<models::PaginatedAssetWalletResponse, Error<GetAssetWalletsError>>;
145
146 async fn get_create_multiple_deposit_addresses_job_status(
152 &self,
153 params: GetCreateMultipleDepositAddressesJobStatusParams,
154 ) -> Result<
155 models::CreateMultipleDepositAddressesJobStatus,
156 Error<GetCreateMultipleDepositAddressesJobStatusError>,
157 >;
158
159 async fn get_create_multiple_vault_accounts_job_status(
165 &self,
166 params: GetCreateMultipleVaultAccountsJobStatusParams,
167 ) -> Result<
168 models::CreateMultipleVaultAccountsJobStatus,
169 Error<GetCreateMultipleVaultAccountsJobStatusError>,
170 >;
171
172 async fn get_max_spendable_amount(
179 &self,
180 params: GetMaxSpendableAmountParams,
181 ) -> Result<models::GetMaxSpendableAmountResponse, Error<GetMaxSpendableAmountError>>;
182
183 async fn get_paged_vault_accounts(
189 &self,
190 params: GetPagedVaultAccountsParams,
191 ) -> Result<models::VaultAccountsPagedResponse, Error<GetPagedVaultAccountsError>>;
192
193 async fn get_public_key_info(
198 &self,
199 params: GetPublicKeyInfoParams,
200 ) -> Result<models::PublicKeyInformation, Error<GetPublicKeyInfoError>>;
201
202 async fn get_public_key_info_for_address(
208 &self,
209 params: GetPublicKeyInfoForAddressParams,
210 ) -> Result<models::PublicKeyInformation, Error<GetPublicKeyInfoForAddressError>>;
211
212 async fn get_unspent_inputs(
218 &self,
219 params: GetUnspentInputsParams,
220 ) -> Result<Vec<models::UnspentInputsResponse>, Error<GetUnspentInputsError>>;
221
222 async fn get_vault_account(
227 &self,
228 params: GetVaultAccountParams,
229 ) -> Result<models::VaultAccount, Error<GetVaultAccountError>>;
230
231 async fn get_vault_account_asset(
237 &self,
238 params: GetVaultAccountAssetParams,
239 ) -> Result<models::VaultAsset, Error<GetVaultAccountAssetError>>;
240
241 async fn get_vault_account_asset_addresses(
255 &self,
256 params: GetVaultAccountAssetAddressesParams,
257 ) -> Result<Vec<models::VaultWalletAddress>, Error<GetVaultAccountAssetAddressesError>>;
258
259 async fn get_vault_account_asset_addresses_paginated(
265 &self,
266 params: GetVaultAccountAssetAddressesPaginatedParams,
267 ) -> Result<models::PaginatedAddressResponse, Error<GetVaultAccountAssetAddressesPaginatedError>>;
268
269 async fn get_vault_assets(
275 &self,
276 params: GetVaultAssetsParams,
277 ) -> Result<Vec<models::VaultAsset>, Error<GetVaultAssetsError>>;
278
279 async fn get_vault_balance_by_asset(
285 &self,
286 params: GetVaultBalanceByAssetParams,
287 ) -> Result<models::VaultAsset, Error<GetVaultBalanceByAssetError>>;
288
289 async fn hide_vault_account(
293 &self,
294 params: HideVaultAccountParams,
295 ) -> Result<models::VaultActionStatus, Error<HideVaultAccountError>>;
296
297 async fn set_customer_ref_id_for_address(
303 &self,
304 params: SetCustomerRefIdForAddressParams,
305 ) -> Result<models::VaultActionStatus, Error<SetCustomerRefIdForAddressError>>;
306
307 async fn set_vault_account_auto_fuel(
311 &self,
312 params: SetVaultAccountAutoFuelParams,
313 ) -> Result<models::VaultActionStatus, Error<SetVaultAccountAutoFuelError>>;
314
315 async fn set_vault_account_customer_ref_id(
319 &self,
320 params: SetVaultAccountCustomerRefIdParams,
321 ) -> Result<models::VaultActionStatus, Error<SetVaultAccountCustomerRefIdError>>;
322
323 async fn unhide_vault_account(
328 &self,
329 params: UnhideVaultAccountParams,
330 ) -> Result<models::VaultActionStatus, Error<UnhideVaultAccountError>>;
331
332 async fn update_vault_account(
337 &self,
338 params: UpdateVaultAccountParams,
339 ) -> Result<models::RenameVaultAccountResponse, Error<UpdateVaultAccountError>>;
340
341 async fn update_vault_account_asset_address(
347 &self,
348 params: UpdateVaultAccountAssetAddressParams,
349 ) -> Result<models::VaultActionStatus, Error<UpdateVaultAccountAssetAddressError>>;
350
351 async fn update_vault_account_asset_balance(
358 &self,
359 params: UpdateVaultAccountAssetBalanceParams,
360 ) -> Result<models::VaultAsset, Error<UpdateVaultAccountAssetBalanceError>>;
361}
362
363pub struct VaultsApiClient {
364 configuration: Arc<configuration::Configuration>,
365}
366
367impl VaultsApiClient {
368 pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
369 Self { configuration }
370 }
371}
372
373#[derive(Clone, Debug)]
376#[cfg_attr(feature = "bon", derive(::bon::Builder))]
377pub struct ActivateAssetForVaultAccountParams {
378 pub vault_account_id: String,
380 pub asset_id: String,
382 pub idempotency_key: Option<String>,
387}
388
389#[derive(Clone, Debug)]
392#[cfg_attr(feature = "bon", derive(::bon::Builder))]
393pub struct AttachOrDetachTagsFromVaultAccountsParams {
394 pub vault_accounts_tag_attachment_operations_request:
395 models::VaultAccountsTagAttachmentOperationsRequest,
396 pub idempotency_key: Option<String>,
401}
402
403#[derive(Clone, Debug)]
406#[cfg_attr(feature = "bon", derive(::bon::Builder))]
407pub struct AttachTagsToVaultAccountsParams {
408 pub vault_accounts_tag_attachments_request: models::VaultAccountsTagAttachmentsRequest,
409 pub idempotency_key: Option<String>,
414}
415
416#[derive(Clone, Debug)]
419#[cfg_attr(feature = "bon", derive(::bon::Builder))]
420pub struct CreateLegacyAddressParams {
421 pub vault_account_id: String,
423 pub asset_id: String,
425 pub address_id: String,
427 pub idempotency_key: Option<String>,
432}
433
434#[derive(Clone, Debug)]
437#[cfg_attr(feature = "bon", derive(::bon::Builder))]
438pub struct CreateMultipleAccountsParams {
439 pub create_multiple_accounts_request: models::CreateMultipleAccountsRequest,
440 pub idempotency_key: Option<String>,
445}
446
447#[derive(Clone, Debug)]
450#[cfg_attr(feature = "bon", derive(::bon::Builder))]
451pub struct CreateMultipleDepositAddressesParams {
452 pub create_multiple_deposit_addresses_request: models::CreateMultipleDepositAddressesRequest,
453 pub idempotency_key: Option<String>,
458}
459
460#[derive(Clone, Debug)]
463#[cfg_attr(feature = "bon", derive(::bon::Builder))]
464pub struct CreateVaultAccountParams {
465 pub create_vault_account_request: models::CreateVaultAccountRequest,
466 pub idempotency_key: Option<String>,
471}
472
473#[derive(Clone, Debug)]
476#[cfg_attr(feature = "bon", derive(::bon::Builder))]
477pub struct CreateVaultAccountAssetParams {
478 pub vault_account_id: String,
481 pub asset_id: String,
483 pub idempotency_key: Option<String>,
488 pub create_assets_request: Option<models::CreateAssetsRequest>,
489}
490
491#[derive(Clone, Debug)]
494#[cfg_attr(feature = "bon", derive(::bon::Builder))]
495pub struct CreateVaultAccountAssetAddressParams {
496 pub vault_account_id: String,
498 pub asset_id: String,
500 pub idempotency_key: Option<String>,
505 pub create_address_request: Option<models::CreateAddressRequest>,
506}
507
508#[derive(Clone, Debug)]
511#[cfg_attr(feature = "bon", derive(::bon::Builder))]
512pub struct DetachTagsFromVaultAccountsParams {
513 pub vault_accounts_tag_attachments_request: models::VaultAccountsTagAttachmentsRequest,
514 pub idempotency_key: Option<String>,
519}
520
521#[derive(Clone, Debug)]
523#[cfg_attr(feature = "bon", derive(::bon::Builder))]
524pub struct GetAssetWalletsParams {
525 pub total_amount_larger_than: Option<f64>,
528 pub asset_id: Option<String>,
530 pub order_by: Option<String>,
531 pub before: Option<String>,
534 pub after: Option<String>,
537 pub limit: Option<f64>,
540}
541
542#[derive(Clone, Debug)]
545#[cfg_attr(feature = "bon", derive(::bon::Builder))]
546pub struct GetCreateMultipleDepositAddressesJobStatusParams {
547 pub job_id: String,
549}
550
551#[derive(Clone, Debug)]
554#[cfg_attr(feature = "bon", derive(::bon::Builder))]
555pub struct GetCreateMultipleVaultAccountsJobStatusParams {
556 pub job_id: String,
558}
559
560#[derive(Clone, Debug)]
563#[cfg_attr(feature = "bon", derive(::bon::Builder))]
564pub struct GetMaxSpendableAmountParams {
565 pub vault_account_id: String,
567 pub asset_id: String,
569 pub manual_signing: Option<bool>,
573}
574
575#[derive(Clone, Debug)]
578#[cfg_attr(feature = "bon", derive(::bon::Builder))]
579pub struct GetPagedVaultAccountsParams {
580 pub name_prefix: Option<String>,
581 pub name_suffix: Option<String>,
582 pub min_amount_threshold: Option<f64>,
586 pub asset_id: Option<String>,
587 pub order_by: Option<String>,
588 pub before: Option<String>,
589 pub after: Option<String>,
590 pub limit: Option<f64>,
591 pub tag_ids: Option<Vec<uuid::Uuid>>,
593}
594
595#[derive(Clone, Debug)]
598#[cfg_attr(feature = "bon", derive(::bon::Builder))]
599pub struct GetPublicKeyInfoParams {
600 pub derivation_path: Vec<i32>,
603 pub algorithm: String,
604 pub compressed: Option<bool>,
605}
606
607#[derive(Clone, Debug)]
610#[cfg_attr(feature = "bon", derive(::bon::Builder))]
611pub struct GetPublicKeyInfoForAddressParams {
612 pub vault_account_id: String,
613 pub asset_id: String,
614 pub change: f64,
616 pub address_index: f64,
618 pub compressed: Option<bool>,
620}
621
622#[derive(Clone, Debug)]
625#[cfg_attr(feature = "bon", derive(::bon::Builder))]
626pub struct GetUnspentInputsParams {
627 pub vault_account_id: String,
629 pub asset_id: String,
631}
632
633#[derive(Clone, Debug)]
635#[cfg_attr(feature = "bon", derive(::bon::Builder))]
636pub struct GetVaultAccountParams {
637 pub vault_account_id: String,
639}
640
641#[derive(Clone, Debug)]
644#[cfg_attr(feature = "bon", derive(::bon::Builder))]
645pub struct GetVaultAccountAssetParams {
646 pub vault_account_id: String,
648 pub asset_id: String,
650}
651
652#[derive(Clone, Debug)]
655#[cfg_attr(feature = "bon", derive(::bon::Builder))]
656pub struct GetVaultAccountAssetAddressesParams {
657 pub vault_account_id: String,
659 pub asset_id: String,
661}
662
663#[derive(Clone, Debug)]
666#[cfg_attr(feature = "bon", derive(::bon::Builder))]
667pub struct GetVaultAccountAssetAddressesPaginatedParams {
668 pub vault_account_id: String,
670 pub asset_id: String,
672 pub limit: Option<f64>,
674 pub before: Option<String>,
676 pub after: Option<String>,
678}
679
680#[derive(Clone, Debug)]
682#[cfg_attr(feature = "bon", derive(::bon::Builder))]
683pub struct GetVaultAssetsParams {
684 pub account_name_prefix: Option<String>,
685 pub account_name_suffix: Option<String>,
686}
687
688#[derive(Clone, Debug)]
691#[cfg_attr(feature = "bon", derive(::bon::Builder))]
692pub struct GetVaultBalanceByAssetParams {
693 pub asset_id: String,
694}
695
696#[derive(Clone, Debug)]
699#[cfg_attr(feature = "bon", derive(::bon::Builder))]
700pub struct HideVaultAccountParams {
701 pub vault_account_id: String,
703 pub idempotency_key: Option<String>,
708}
709
710#[derive(Clone, Debug)]
713#[cfg_attr(feature = "bon", derive(::bon::Builder))]
714pub struct SetCustomerRefIdForAddressParams {
715 pub vault_account_id: String,
717 pub asset_id: String,
719 pub address_id: String,
722 pub set_customer_ref_id_for_address_request: models::SetCustomerRefIdForAddressRequest,
723 pub idempotency_key: Option<String>,
728}
729
730#[derive(Clone, Debug)]
733#[cfg_attr(feature = "bon", derive(::bon::Builder))]
734pub struct SetVaultAccountAutoFuelParams {
735 pub vault_account_id: String,
737 pub set_auto_fuel_request: models::SetAutoFuelRequest,
738 pub idempotency_key: Option<String>,
743}
744
745#[derive(Clone, Debug)]
748#[cfg_attr(feature = "bon", derive(::bon::Builder))]
749pub struct SetVaultAccountCustomerRefIdParams {
750 pub vault_account_id: String,
752 pub set_customer_ref_id_request: models::SetCustomerRefIdRequest,
753 pub idempotency_key: Option<String>,
758}
759
760#[derive(Clone, Debug)]
763#[cfg_attr(feature = "bon", derive(::bon::Builder))]
764pub struct UnhideVaultAccountParams {
765 pub vault_account_id: String,
767 pub idempotency_key: Option<String>,
772}
773
774#[derive(Clone, Debug)]
777#[cfg_attr(feature = "bon", derive(::bon::Builder))]
778pub struct UpdateVaultAccountParams {
779 pub vault_account_id: String,
781 pub update_vault_account_request: models::UpdateVaultAccountRequest,
782 pub idempotency_key: Option<String>,
787}
788
789#[derive(Clone, Debug)]
792#[cfg_attr(feature = "bon", derive(::bon::Builder))]
793pub struct UpdateVaultAccountAssetAddressParams {
794 pub vault_account_id: String,
796 pub asset_id: String,
798 pub address_id: String,
801 pub idempotency_key: Option<String>,
806 pub update_vault_account_asset_address_request:
807 Option<models::UpdateVaultAccountAssetAddressRequest>,
808}
809
810#[derive(Clone, Debug)]
813#[cfg_attr(feature = "bon", derive(::bon::Builder))]
814pub struct UpdateVaultAccountAssetBalanceParams {
815 pub vault_account_id: String,
817 pub asset_id: String,
819 pub idempotency_key: Option<String>,
824}
825
826#[async_trait]
827impl VaultsApi for VaultsApiClient {
828 async fn activate_asset_for_vault_account(
833 &self,
834 params: ActivateAssetForVaultAccountParams,
835 ) -> Result<models::CreateVaultAssetResponse, Error<ActivateAssetForVaultAccountError>> {
836 let ActivateAssetForVaultAccountParams {
837 vault_account_id,
838 asset_id,
839 idempotency_key,
840 } = params;
841
842 let local_var_configuration = &self.configuration;
843
844 let local_var_client = &local_var_configuration.client;
845
846 let local_var_uri_str = format!(
847 "{}/vault/accounts/{vaultAccountId}/{assetId}/activate",
848 local_var_configuration.base_path,
849 vaultAccountId = crate::apis::urlencode(vault_account_id),
850 assetId = crate::apis::urlencode(asset_id)
851 );
852 let mut local_var_req_builder =
853 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
854
855 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
856 local_var_req_builder = local_var_req_builder
857 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
858 }
859 if let Some(local_var_param_value) = idempotency_key {
860 local_var_req_builder =
861 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
862 }
863
864 let local_var_req = local_var_req_builder.build()?;
865 let local_var_resp = local_var_client.execute(local_var_req).await?;
866
867 let local_var_status = local_var_resp.status();
868 let local_var_content_type = local_var_resp
869 .headers()
870 .get("content-type")
871 .and_then(|v| v.to_str().ok())
872 .unwrap_or("application/octet-stream");
873 let local_var_content_type = super::ContentType::from(local_var_content_type);
874 let local_var_content = local_var_resp.text().await?;
875
876 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
877 match local_var_content_type {
878 ContentType::Json => {
879 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
880 }
881 ContentType::Text => {
882 return Err(Error::from(serde_json::Error::custom(
883 "Received `text/plain` content type response that cannot be converted to \
884 `models::CreateVaultAssetResponse`",
885 )));
886 }
887 ContentType::Unsupported(local_var_unknown_type) => {
888 return Err(Error::from(serde_json::Error::custom(format!(
889 "Received `{local_var_unknown_type}` content type response that cannot be \
890 converted to `models::CreateVaultAssetResponse`"
891 ))));
892 }
893 }
894 } else {
895 let local_var_entity: Option<ActivateAssetForVaultAccountError> =
896 serde_json::from_str(&local_var_content).ok();
897 let local_var_error = ResponseContent {
898 status: local_var_status,
899 content: local_var_content,
900 entity: local_var_entity,
901 };
902 Err(Error::ResponseError(local_var_error))
903 }
904 }
905
906 async fn attach_or_detach_tags_from_vault_accounts(
911 &self,
912 params: AttachOrDetachTagsFromVaultAccountsParams,
913 ) -> Result<
914 models::VaultAccountsTagAttachmentOperationsResponse,
915 Error<AttachOrDetachTagsFromVaultAccountsError>,
916 > {
917 let AttachOrDetachTagsFromVaultAccountsParams {
918 vault_accounts_tag_attachment_operations_request,
919 idempotency_key,
920 } = params;
921
922 let local_var_configuration = &self.configuration;
923
924 let local_var_client = &local_var_configuration.client;
925
926 let local_var_uri_str = format!(
927 "{}/vault/accounts/attached_tags",
928 local_var_configuration.base_path
929 );
930 let mut local_var_req_builder =
931 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
932
933 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
934 local_var_req_builder = local_var_req_builder
935 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
936 }
937 if let Some(local_var_param_value) = idempotency_key {
938 local_var_req_builder =
939 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
940 }
941 local_var_req_builder =
942 local_var_req_builder.json(&vault_accounts_tag_attachment_operations_request);
943
944 let local_var_req = local_var_req_builder.build()?;
945 let local_var_resp = local_var_client.execute(local_var_req).await?;
946
947 let local_var_status = local_var_resp.status();
948 let local_var_content_type = local_var_resp
949 .headers()
950 .get("content-type")
951 .and_then(|v| v.to_str().ok())
952 .unwrap_or("application/octet-stream");
953 let local_var_content_type = super::ContentType::from(local_var_content_type);
954 let local_var_content = local_var_resp.text().await?;
955
956 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
957 match local_var_content_type {
958 ContentType::Json => {
959 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
960 }
961 ContentType::Text => {
962 return Err(Error::from(serde_json::Error::custom(
963 "Received `text/plain` content type response that cannot be converted to \
964 `models::VaultAccountsTagAttachmentOperationsResponse`",
965 )));
966 }
967 ContentType::Unsupported(local_var_unknown_type) => {
968 return Err(Error::from(serde_json::Error::custom(format!(
969 "Received `{local_var_unknown_type}` content type response that cannot be \
970 converted to `models::VaultAccountsTagAttachmentOperationsResponse`"
971 ))));
972 }
973 }
974 } else {
975 let local_var_entity: Option<AttachOrDetachTagsFromVaultAccountsError> =
976 serde_json::from_str(&local_var_content).ok();
977 let local_var_error = ResponseContent {
978 status: local_var_status,
979 content: local_var_content,
980 entity: local_var_entity,
981 };
982 Err(Error::ResponseError(local_var_error))
983 }
984 }
985
986 async fn attach_tags_to_vault_accounts(
990 &self,
991 params: AttachTagsToVaultAccountsParams,
992 ) -> Result<(), Error<AttachTagsToVaultAccountsError>> {
993 let AttachTagsToVaultAccountsParams {
994 vault_accounts_tag_attachments_request,
995 idempotency_key,
996 } = params;
997
998 let local_var_configuration = &self.configuration;
999
1000 let local_var_client = &local_var_configuration.client;
1001
1002 let local_var_uri_str = format!(
1003 "{}/vault/accounts/attached/tags/attach",
1004 local_var_configuration.base_path
1005 );
1006 let mut local_var_req_builder =
1007 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1008
1009 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1010 local_var_req_builder = local_var_req_builder
1011 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1012 }
1013 if let Some(local_var_param_value) = idempotency_key {
1014 local_var_req_builder =
1015 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
1016 }
1017 local_var_req_builder = local_var_req_builder.json(&vault_accounts_tag_attachments_request);
1018
1019 let local_var_req = local_var_req_builder.build()?;
1020 let local_var_resp = local_var_client.execute(local_var_req).await?;
1021
1022 let local_var_status = local_var_resp.status();
1023 let local_var_content = local_var_resp.text().await?;
1024
1025 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1026 Ok(())
1027 } else {
1028 let local_var_entity: Option<AttachTagsToVaultAccountsError> =
1029 serde_json::from_str(&local_var_content).ok();
1030 let local_var_error = ResponseContent {
1031 status: local_var_status,
1032 content: local_var_content,
1033 entity: local_var_entity,
1034 };
1035 Err(Error::ResponseError(local_var_error))
1036 }
1037 }
1038
1039 async fn create_legacy_address(
1042 &self,
1043 params: CreateLegacyAddressParams,
1044 ) -> Result<models::CreateAddressResponse, Error<CreateLegacyAddressError>> {
1045 let CreateLegacyAddressParams {
1046 vault_account_id,
1047 asset_id,
1048 address_id,
1049 idempotency_key,
1050 } = params;
1051
1052 let local_var_configuration = &self.configuration;
1053
1054 let local_var_client = &local_var_configuration.client;
1055
1056 let local_var_uri_str = format!(
1057 "{}/vault/accounts/{vaultAccountId}/{assetId}/addresses/{addressId}/create_legacy",
1058 local_var_configuration.base_path,
1059 vaultAccountId = crate::apis::urlencode(vault_account_id),
1060 assetId = crate::apis::urlencode(asset_id),
1061 addressId = crate::apis::urlencode(address_id)
1062 );
1063 let mut local_var_req_builder =
1064 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1065
1066 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1067 local_var_req_builder = local_var_req_builder
1068 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1069 }
1070 if let Some(local_var_param_value) = idempotency_key {
1071 local_var_req_builder =
1072 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
1073 }
1074
1075 let local_var_req = local_var_req_builder.build()?;
1076 let local_var_resp = local_var_client.execute(local_var_req).await?;
1077
1078 let local_var_status = local_var_resp.status();
1079 let local_var_content_type = local_var_resp
1080 .headers()
1081 .get("content-type")
1082 .and_then(|v| v.to_str().ok())
1083 .unwrap_or("application/octet-stream");
1084 let local_var_content_type = super::ContentType::from(local_var_content_type);
1085 let local_var_content = local_var_resp.text().await?;
1086
1087 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1088 match local_var_content_type {
1089 ContentType::Json => {
1090 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1091 }
1092 ContentType::Text => {
1093 return Err(Error::from(serde_json::Error::custom(
1094 "Received `text/plain` content type response that cannot be converted to \
1095 `models::CreateAddressResponse`",
1096 )));
1097 }
1098 ContentType::Unsupported(local_var_unknown_type) => {
1099 return Err(Error::from(serde_json::Error::custom(format!(
1100 "Received `{local_var_unknown_type}` content type response that cannot be \
1101 converted to `models::CreateAddressResponse`"
1102 ))));
1103 }
1104 }
1105 } else {
1106 let local_var_entity: Option<CreateLegacyAddressError> =
1107 serde_json::from_str(&local_var_content).ok();
1108 let local_var_error = ResponseContent {
1109 status: local_var_status,
1110 content: local_var_content,
1111 entity: local_var_entity,
1112 };
1113 Err(Error::ResponseError(local_var_error))
1114 }
1115 }
1116
1117 async fn create_multiple_accounts(
1125 &self,
1126 params: CreateMultipleAccountsParams,
1127 ) -> Result<models::JobCreated, Error<CreateMultipleAccountsError>> {
1128 let CreateMultipleAccountsParams {
1129 create_multiple_accounts_request,
1130 idempotency_key,
1131 } = params;
1132
1133 let local_var_configuration = &self.configuration;
1134
1135 let local_var_client = &local_var_configuration.client;
1136
1137 let local_var_uri_str =
1138 format!("{}/vault/accounts/bulk/", local_var_configuration.base_path);
1139 let mut local_var_req_builder =
1140 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1141
1142 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1143 local_var_req_builder = local_var_req_builder
1144 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1145 }
1146 if let Some(local_var_param_value) = idempotency_key {
1147 local_var_req_builder =
1148 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
1149 }
1150 local_var_req_builder = local_var_req_builder.json(&create_multiple_accounts_request);
1151
1152 let local_var_req = local_var_req_builder.build()?;
1153 let local_var_resp = local_var_client.execute(local_var_req).await?;
1154
1155 let local_var_status = local_var_resp.status();
1156 let local_var_content_type = local_var_resp
1157 .headers()
1158 .get("content-type")
1159 .and_then(|v| v.to_str().ok())
1160 .unwrap_or("application/octet-stream");
1161 let local_var_content_type = super::ContentType::from(local_var_content_type);
1162 let local_var_content = local_var_resp.text().await?;
1163
1164 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1165 match local_var_content_type {
1166 ContentType::Json => {
1167 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1168 }
1169 ContentType::Text => {
1170 return Err(Error::from(serde_json::Error::custom(
1171 "Received `text/plain` content type response that cannot be converted to \
1172 `models::JobCreated`",
1173 )));
1174 }
1175 ContentType::Unsupported(local_var_unknown_type) => {
1176 return Err(Error::from(serde_json::Error::custom(format!(
1177 "Received `{local_var_unknown_type}` content type response that cannot be \
1178 converted to `models::JobCreated`"
1179 ))));
1180 }
1181 }
1182 } else {
1183 let local_var_entity: Option<CreateMultipleAccountsError> =
1184 serde_json::from_str(&local_var_content).ok();
1185 let local_var_error = ResponseContent {
1186 status: local_var_status,
1187 content: local_var_content,
1188 entity: local_var_entity,
1189 };
1190 Err(Error::ResponseError(local_var_error))
1191 }
1192 }
1193
1194 async fn create_multiple_deposit_addresses(
1204 &self,
1205 params: CreateMultipleDepositAddressesParams,
1206 ) -> Result<models::JobCreated, Error<CreateMultipleDepositAddressesError>> {
1207 let CreateMultipleDepositAddressesParams {
1208 create_multiple_deposit_addresses_request,
1209 idempotency_key,
1210 } = params;
1211
1212 let local_var_configuration = &self.configuration;
1213
1214 let local_var_client = &local_var_configuration.client;
1215
1216 let local_var_uri_str = format!(
1217 "{}/vault/accounts/addresses/bulk",
1218 local_var_configuration.base_path
1219 );
1220 let mut local_var_req_builder =
1221 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1222
1223 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1224 local_var_req_builder = local_var_req_builder
1225 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1226 }
1227 if let Some(local_var_param_value) = idempotency_key {
1228 local_var_req_builder =
1229 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
1230 }
1231 local_var_req_builder =
1232 local_var_req_builder.json(&create_multiple_deposit_addresses_request);
1233
1234 let local_var_req = local_var_req_builder.build()?;
1235 let local_var_resp = local_var_client.execute(local_var_req).await?;
1236
1237 let local_var_status = local_var_resp.status();
1238 let local_var_content_type = local_var_resp
1239 .headers()
1240 .get("content-type")
1241 .and_then(|v| v.to_str().ok())
1242 .unwrap_or("application/octet-stream");
1243 let local_var_content_type = super::ContentType::from(local_var_content_type);
1244 let local_var_content = local_var_resp.text().await?;
1245
1246 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1247 match local_var_content_type {
1248 ContentType::Json => {
1249 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1250 }
1251 ContentType::Text => {
1252 return Err(Error::from(serde_json::Error::custom(
1253 "Received `text/plain` content type response that cannot be converted to \
1254 `models::JobCreated`",
1255 )));
1256 }
1257 ContentType::Unsupported(local_var_unknown_type) => {
1258 return Err(Error::from(serde_json::Error::custom(format!(
1259 "Received `{local_var_unknown_type}` content type response that cannot be \
1260 converted to `models::JobCreated`"
1261 ))));
1262 }
1263 }
1264 } else {
1265 let local_var_entity: Option<CreateMultipleDepositAddressesError> =
1266 serde_json::from_str(&local_var_content).ok();
1267 let local_var_error = ResponseContent {
1268 status: local_var_status,
1269 content: local_var_content,
1270 entity: local_var_entity,
1271 };
1272 Err(Error::ResponseError(local_var_error))
1273 }
1274 }
1275
1276 async fn create_vault_account(
1278 &self,
1279 params: CreateVaultAccountParams,
1280 ) -> Result<models::VaultAccount, Error<CreateVaultAccountError>> {
1281 let CreateVaultAccountParams {
1282 create_vault_account_request,
1283 idempotency_key,
1284 } = params;
1285
1286 let local_var_configuration = &self.configuration;
1287
1288 let local_var_client = &local_var_configuration.client;
1289
1290 let local_var_uri_str = format!("{}/vault/accounts", local_var_configuration.base_path);
1291 let mut local_var_req_builder =
1292 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1293
1294 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1295 local_var_req_builder = local_var_req_builder
1296 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1297 }
1298 if let Some(local_var_param_value) = idempotency_key {
1299 local_var_req_builder =
1300 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
1301 }
1302 local_var_req_builder = local_var_req_builder.json(&create_vault_account_request);
1303
1304 let local_var_req = local_var_req_builder.build()?;
1305 let local_var_resp = local_var_client.execute(local_var_req).await?;
1306
1307 let local_var_status = local_var_resp.status();
1308 let local_var_content_type = local_var_resp
1309 .headers()
1310 .get("content-type")
1311 .and_then(|v| v.to_str().ok())
1312 .unwrap_or("application/octet-stream");
1313 let local_var_content_type = super::ContentType::from(local_var_content_type);
1314 let local_var_content = local_var_resp.text().await?;
1315
1316 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1317 match local_var_content_type {
1318 ContentType::Json => {
1319 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1320 }
1321 ContentType::Text => {
1322 return Err(Error::from(serde_json::Error::custom(
1323 "Received `text/plain` content type response that cannot be converted to \
1324 `models::VaultAccount`",
1325 )));
1326 }
1327 ContentType::Unsupported(local_var_unknown_type) => {
1328 return Err(Error::from(serde_json::Error::custom(format!(
1329 "Received `{local_var_unknown_type}` content type response that cannot be \
1330 converted to `models::VaultAccount`"
1331 ))));
1332 }
1333 }
1334 } else {
1335 let local_var_entity: Option<CreateVaultAccountError> =
1336 serde_json::from_str(&local_var_content).ok();
1337 let local_var_error = ResponseContent {
1338 status: local_var_status,
1339 content: local_var_content,
1340 entity: local_var_entity,
1341 };
1342 Err(Error::ResponseError(local_var_error))
1343 }
1344 }
1345
1346 async fn create_vault_account_asset(
1348 &self,
1349 params: CreateVaultAccountAssetParams,
1350 ) -> Result<models::CreateVaultAssetResponse, Error<CreateVaultAccountAssetError>> {
1351 let CreateVaultAccountAssetParams {
1352 vault_account_id,
1353 asset_id,
1354 idempotency_key,
1355 create_assets_request,
1356 } = params;
1357
1358 let local_var_configuration = &self.configuration;
1359
1360 let local_var_client = &local_var_configuration.client;
1361
1362 let local_var_uri_str = format!(
1363 "{}/vault/accounts/{vaultAccountId}/{assetId}",
1364 local_var_configuration.base_path,
1365 vaultAccountId = crate::apis::urlencode(vault_account_id),
1366 assetId = crate::apis::urlencode(asset_id)
1367 );
1368 let mut local_var_req_builder =
1369 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1370
1371 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1372 local_var_req_builder = local_var_req_builder
1373 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1374 }
1375 if let Some(local_var_param_value) = idempotency_key {
1376 local_var_req_builder =
1377 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
1378 }
1379 local_var_req_builder = local_var_req_builder.json(&create_assets_request);
1380
1381 let local_var_req = local_var_req_builder.build()?;
1382 let local_var_resp = local_var_client.execute(local_var_req).await?;
1383
1384 let local_var_status = local_var_resp.status();
1385 let local_var_content_type = local_var_resp
1386 .headers()
1387 .get("content-type")
1388 .and_then(|v| v.to_str().ok())
1389 .unwrap_or("application/octet-stream");
1390 let local_var_content_type = super::ContentType::from(local_var_content_type);
1391 let local_var_content = local_var_resp.text().await?;
1392
1393 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1394 match local_var_content_type {
1395 ContentType::Json => {
1396 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1397 }
1398 ContentType::Text => {
1399 return Err(Error::from(serde_json::Error::custom(
1400 "Received `text/plain` content type response that cannot be converted to \
1401 `models::CreateVaultAssetResponse`",
1402 )));
1403 }
1404 ContentType::Unsupported(local_var_unknown_type) => {
1405 return Err(Error::from(serde_json::Error::custom(format!(
1406 "Received `{local_var_unknown_type}` content type response that cannot be \
1407 converted to `models::CreateVaultAssetResponse`"
1408 ))));
1409 }
1410 }
1411 } else {
1412 let local_var_entity: Option<CreateVaultAccountAssetError> =
1413 serde_json::from_str(&local_var_content).ok();
1414 let local_var_error = ResponseContent {
1415 status: local_var_status,
1416 content: local_var_content,
1417 entity: local_var_entity,
1418 };
1419 Err(Error::ResponseError(local_var_error))
1420 }
1421 }
1422
1423 async fn create_vault_account_asset_address(
1428 &self,
1429 params: CreateVaultAccountAssetAddressParams,
1430 ) -> Result<models::CreateAddressResponse, Error<CreateVaultAccountAssetAddressError>> {
1431 let CreateVaultAccountAssetAddressParams {
1432 vault_account_id,
1433 asset_id,
1434 idempotency_key,
1435 create_address_request,
1436 } = params;
1437
1438 let local_var_configuration = &self.configuration;
1439
1440 let local_var_client = &local_var_configuration.client;
1441
1442 let local_var_uri_str = format!(
1443 "{}/vault/accounts/{vaultAccountId}/{assetId}/addresses",
1444 local_var_configuration.base_path,
1445 vaultAccountId = crate::apis::urlencode(vault_account_id),
1446 assetId = crate::apis::urlencode(asset_id)
1447 );
1448 let mut local_var_req_builder =
1449 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1450
1451 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1452 local_var_req_builder = local_var_req_builder
1453 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1454 }
1455 if let Some(local_var_param_value) = idempotency_key {
1456 local_var_req_builder =
1457 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
1458 }
1459 local_var_req_builder = local_var_req_builder.json(&create_address_request);
1460
1461 let local_var_req = local_var_req_builder.build()?;
1462 let local_var_resp = local_var_client.execute(local_var_req).await?;
1463
1464 let local_var_status = local_var_resp.status();
1465 let local_var_content_type = local_var_resp
1466 .headers()
1467 .get("content-type")
1468 .and_then(|v| v.to_str().ok())
1469 .unwrap_or("application/octet-stream");
1470 let local_var_content_type = super::ContentType::from(local_var_content_type);
1471 let local_var_content = local_var_resp.text().await?;
1472
1473 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1474 match local_var_content_type {
1475 ContentType::Json => {
1476 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1477 }
1478 ContentType::Text => {
1479 return Err(Error::from(serde_json::Error::custom(
1480 "Received `text/plain` content type response that cannot be converted to \
1481 `models::CreateAddressResponse`",
1482 )));
1483 }
1484 ContentType::Unsupported(local_var_unknown_type) => {
1485 return Err(Error::from(serde_json::Error::custom(format!(
1486 "Received `{local_var_unknown_type}` content type response that cannot be \
1487 converted to `models::CreateAddressResponse`"
1488 ))));
1489 }
1490 }
1491 } else {
1492 let local_var_entity: Option<CreateVaultAccountAssetAddressError> =
1493 serde_json::from_str(&local_var_content).ok();
1494 let local_var_error = ResponseContent {
1495 status: local_var_status,
1496 content: local_var_content,
1497 entity: local_var_entity,
1498 };
1499 Err(Error::ResponseError(local_var_error))
1500 }
1501 }
1502
1503 async fn detach_tags_from_vault_accounts(
1507 &self,
1508 params: DetachTagsFromVaultAccountsParams,
1509 ) -> Result<(), Error<DetachTagsFromVaultAccountsError>> {
1510 let DetachTagsFromVaultAccountsParams {
1511 vault_accounts_tag_attachments_request,
1512 idempotency_key,
1513 } = params;
1514
1515 let local_var_configuration = &self.configuration;
1516
1517 let local_var_client = &local_var_configuration.client;
1518
1519 let local_var_uri_str = format!(
1520 "{}/vault/accounts/attached/tags/detached",
1521 local_var_configuration.base_path
1522 );
1523 let mut local_var_req_builder =
1524 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1525
1526 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1527 local_var_req_builder = local_var_req_builder
1528 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1529 }
1530 if let Some(local_var_param_value) = idempotency_key {
1531 local_var_req_builder =
1532 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
1533 }
1534 local_var_req_builder = local_var_req_builder.json(&vault_accounts_tag_attachments_request);
1535
1536 let local_var_req = local_var_req_builder.build()?;
1537 let local_var_resp = local_var_client.execute(local_var_req).await?;
1538
1539 let local_var_status = local_var_resp.status();
1540 let local_var_content = local_var_resp.text().await?;
1541
1542 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1543 Ok(())
1544 } else {
1545 let local_var_entity: Option<DetachTagsFromVaultAccountsError> =
1546 serde_json::from_str(&local_var_content).ok();
1547 let local_var_error = ResponseContent {
1548 status: local_var_status,
1549 content: local_var_content,
1550 entity: local_var_entity,
1551 };
1552 Err(Error::ResponseError(local_var_error))
1553 }
1554 }
1555
1556 async fn get_asset_wallets(
1561 &self,
1562 params: GetAssetWalletsParams,
1563 ) -> Result<models::PaginatedAssetWalletResponse, Error<GetAssetWalletsError>> {
1564 let GetAssetWalletsParams {
1565 total_amount_larger_than,
1566 asset_id,
1567 order_by,
1568 before,
1569 after,
1570 limit,
1571 } = params;
1572
1573 let local_var_configuration = &self.configuration;
1574
1575 let local_var_client = &local_var_configuration.client;
1576
1577 let local_var_uri_str =
1578 format!("{}/vault/asset_wallets", local_var_configuration.base_path);
1579 let mut local_var_req_builder =
1580 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1581
1582 if let Some(ref param_value) = total_amount_larger_than {
1583 local_var_req_builder =
1584 local_var_req_builder.query(&[("totalAmountLargerThan", ¶m_value.to_string())]);
1585 }
1586 if let Some(ref param_value) = asset_id {
1587 local_var_req_builder =
1588 local_var_req_builder.query(&[("assetId", ¶m_value.to_string())]);
1589 }
1590 if let Some(ref param_value) = order_by {
1591 local_var_req_builder =
1592 local_var_req_builder.query(&[("orderBy", ¶m_value.to_string())]);
1593 }
1594 if let Some(ref param_value) = before {
1595 local_var_req_builder =
1596 local_var_req_builder.query(&[("before", ¶m_value.to_string())]);
1597 }
1598 if let Some(ref param_value) = after {
1599 local_var_req_builder =
1600 local_var_req_builder.query(&[("after", ¶m_value.to_string())]);
1601 }
1602 if let Some(ref param_value) = limit {
1603 local_var_req_builder =
1604 local_var_req_builder.query(&[("limit", ¶m_value.to_string())]);
1605 }
1606 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1607 local_var_req_builder = local_var_req_builder
1608 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1609 }
1610
1611 let local_var_req = local_var_req_builder.build()?;
1612 let local_var_resp = local_var_client.execute(local_var_req).await?;
1613
1614 let local_var_status = local_var_resp.status();
1615 let local_var_content_type = local_var_resp
1616 .headers()
1617 .get("content-type")
1618 .and_then(|v| v.to_str().ok())
1619 .unwrap_or("application/octet-stream");
1620 let local_var_content_type = super::ContentType::from(local_var_content_type);
1621 let local_var_content = local_var_resp.text().await?;
1622
1623 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1624 match local_var_content_type {
1625 ContentType::Json => {
1626 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1627 }
1628 ContentType::Text => {
1629 return Err(Error::from(serde_json::Error::custom(
1630 "Received `text/plain` content type response that cannot be converted to \
1631 `models::PaginatedAssetWalletResponse`",
1632 )));
1633 }
1634 ContentType::Unsupported(local_var_unknown_type) => {
1635 return Err(Error::from(serde_json::Error::custom(format!(
1636 "Received `{local_var_unknown_type}` content type response that cannot be \
1637 converted to `models::PaginatedAssetWalletResponse`"
1638 ))));
1639 }
1640 }
1641 } else {
1642 let local_var_entity: Option<GetAssetWalletsError> =
1643 serde_json::from_str(&local_var_content).ok();
1644 let local_var_error = ResponseContent {
1645 status: local_var_status,
1646 content: local_var_content,
1647 entity: local_var_entity,
1648 };
1649 Err(Error::ResponseError(local_var_error))
1650 }
1651 }
1652
1653 async fn get_create_multiple_deposit_addresses_job_status(
1657 &self,
1658 params: GetCreateMultipleDepositAddressesJobStatusParams,
1659 ) -> Result<
1660 models::CreateMultipleDepositAddressesJobStatus,
1661 Error<GetCreateMultipleDepositAddressesJobStatusError>,
1662 > {
1663 let GetCreateMultipleDepositAddressesJobStatusParams { job_id } = params;
1664
1665 let local_var_configuration = &self.configuration;
1666
1667 let local_var_client = &local_var_configuration.client;
1668
1669 let local_var_uri_str = format!(
1670 "{}/vault/accounts/addresses/bulk/{jobId}",
1671 local_var_configuration.base_path,
1672 jobId = crate::apis::urlencode(job_id)
1673 );
1674 let mut local_var_req_builder =
1675 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1676
1677 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1678 local_var_req_builder = local_var_req_builder
1679 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1680 }
1681
1682 let local_var_req = local_var_req_builder.build()?;
1683 let local_var_resp = local_var_client.execute(local_var_req).await?;
1684
1685 let local_var_status = local_var_resp.status();
1686 let local_var_content_type = local_var_resp
1687 .headers()
1688 .get("content-type")
1689 .and_then(|v| v.to_str().ok())
1690 .unwrap_or("application/octet-stream");
1691 let local_var_content_type = super::ContentType::from(local_var_content_type);
1692 let local_var_content = local_var_resp.text().await?;
1693
1694 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1695 match local_var_content_type {
1696 ContentType::Json => {
1697 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1698 }
1699 ContentType::Text => {
1700 return Err(Error::from(serde_json::Error::custom(
1701 "Received `text/plain` content type response that cannot be converted to \
1702 `models::CreateMultipleDepositAddressesJobStatus`",
1703 )));
1704 }
1705 ContentType::Unsupported(local_var_unknown_type) => {
1706 return Err(Error::from(serde_json::Error::custom(format!(
1707 "Received `{local_var_unknown_type}` content type response that cannot be \
1708 converted to `models::CreateMultipleDepositAddressesJobStatus`"
1709 ))));
1710 }
1711 }
1712 } else {
1713 let local_var_entity: Option<GetCreateMultipleDepositAddressesJobStatusError> =
1714 serde_json::from_str(&local_var_content).ok();
1715 let local_var_error = ResponseContent {
1716 status: local_var_status,
1717 content: local_var_content,
1718 entity: local_var_entity,
1719 };
1720 Err(Error::ResponseError(local_var_error))
1721 }
1722 }
1723
1724 async fn get_create_multiple_vault_accounts_job_status(
1728 &self,
1729 params: GetCreateMultipleVaultAccountsJobStatusParams,
1730 ) -> Result<
1731 models::CreateMultipleVaultAccountsJobStatus,
1732 Error<GetCreateMultipleVaultAccountsJobStatusError>,
1733 > {
1734 let GetCreateMultipleVaultAccountsJobStatusParams { job_id } = params;
1735
1736 let local_var_configuration = &self.configuration;
1737
1738 let local_var_client = &local_var_configuration.client;
1739
1740 let local_var_uri_str = format!(
1741 "{}/vault/accounts/bulk/{jobId}",
1742 local_var_configuration.base_path,
1743 jobId = crate::apis::urlencode(job_id)
1744 );
1745 let mut local_var_req_builder =
1746 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1747
1748 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1749 local_var_req_builder = local_var_req_builder
1750 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1751 }
1752
1753 let local_var_req = local_var_req_builder.build()?;
1754 let local_var_resp = local_var_client.execute(local_var_req).await?;
1755
1756 let local_var_status = local_var_resp.status();
1757 let local_var_content_type = local_var_resp
1758 .headers()
1759 .get("content-type")
1760 .and_then(|v| v.to_str().ok())
1761 .unwrap_or("application/octet-stream");
1762 let local_var_content_type = super::ContentType::from(local_var_content_type);
1763 let local_var_content = local_var_resp.text().await?;
1764
1765 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1766 match local_var_content_type {
1767 ContentType::Json => {
1768 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1769 }
1770 ContentType::Text => {
1771 return Err(Error::from(serde_json::Error::custom(
1772 "Received `text/plain` content type response that cannot be converted to \
1773 `models::CreateMultipleVaultAccountsJobStatus`",
1774 )));
1775 }
1776 ContentType::Unsupported(local_var_unknown_type) => {
1777 return Err(Error::from(serde_json::Error::custom(format!(
1778 "Received `{local_var_unknown_type}` content type response that cannot be \
1779 converted to `models::CreateMultipleVaultAccountsJobStatus`"
1780 ))));
1781 }
1782 }
1783 } else {
1784 let local_var_entity: Option<GetCreateMultipleVaultAccountsJobStatusError> =
1785 serde_json::from_str(&local_var_content).ok();
1786 let local_var_error = ResponseContent {
1787 status: local_var_status,
1788 content: local_var_content,
1789 entity: local_var_entity,
1790 };
1791 Err(Error::ResponseError(local_var_error))
1792 }
1793 }
1794
1795 async fn get_max_spendable_amount(
1800 &self,
1801 params: GetMaxSpendableAmountParams,
1802 ) -> Result<models::GetMaxSpendableAmountResponse, Error<GetMaxSpendableAmountError>> {
1803 let GetMaxSpendableAmountParams {
1804 vault_account_id,
1805 asset_id,
1806 manual_signing,
1807 } = params;
1808
1809 let local_var_configuration = &self.configuration;
1810
1811 let local_var_client = &local_var_configuration.client;
1812
1813 let local_var_uri_str = format!(
1814 "{}/vault/accounts/{vaultAccountId}/{assetId}/max_spendable_amount",
1815 local_var_configuration.base_path,
1816 vaultAccountId = crate::apis::urlencode(vault_account_id),
1817 assetId = crate::apis::urlencode(asset_id)
1818 );
1819 let mut local_var_req_builder =
1820 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1821
1822 if let Some(ref param_value) = manual_signing {
1823 local_var_req_builder =
1824 local_var_req_builder.query(&[("manualSigning", ¶m_value.to_string())]);
1825 }
1826 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1827 local_var_req_builder = local_var_req_builder
1828 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1829 }
1830
1831 let local_var_req = local_var_req_builder.build()?;
1832 let local_var_resp = local_var_client.execute(local_var_req).await?;
1833
1834 let local_var_status = local_var_resp.status();
1835 let local_var_content_type = local_var_resp
1836 .headers()
1837 .get("content-type")
1838 .and_then(|v| v.to_str().ok())
1839 .unwrap_or("application/octet-stream");
1840 let local_var_content_type = super::ContentType::from(local_var_content_type);
1841 let local_var_content = local_var_resp.text().await?;
1842
1843 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1844 match local_var_content_type {
1845 ContentType::Json => {
1846 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1847 }
1848 ContentType::Text => {
1849 return Err(Error::from(serde_json::Error::custom(
1850 "Received `text/plain` content type response that cannot be converted to \
1851 `models::GetMaxSpendableAmountResponse`",
1852 )));
1853 }
1854 ContentType::Unsupported(local_var_unknown_type) => {
1855 return Err(Error::from(serde_json::Error::custom(format!(
1856 "Received `{local_var_unknown_type}` content type response that cannot be \
1857 converted to `models::GetMaxSpendableAmountResponse`"
1858 ))));
1859 }
1860 }
1861 } else {
1862 let local_var_entity: Option<GetMaxSpendableAmountError> =
1863 serde_json::from_str(&local_var_content).ok();
1864 let local_var_error = ResponseContent {
1865 status: local_var_status,
1866 content: local_var_content,
1867 entity: local_var_entity,
1868 };
1869 Err(Error::ResponseError(local_var_error))
1870 }
1871 }
1872
1873 async fn get_paged_vault_accounts(
1877 &self,
1878 params: GetPagedVaultAccountsParams,
1879 ) -> Result<models::VaultAccountsPagedResponse, Error<GetPagedVaultAccountsError>> {
1880 let GetPagedVaultAccountsParams {
1881 name_prefix,
1882 name_suffix,
1883 min_amount_threshold,
1884 asset_id,
1885 order_by,
1886 before,
1887 after,
1888 limit,
1889 tag_ids,
1890 } = params;
1891
1892 let local_var_configuration = &self.configuration;
1893
1894 let local_var_client = &local_var_configuration.client;
1895
1896 let local_var_uri_str =
1897 format!("{}/vault/accounts_paged", local_var_configuration.base_path);
1898 let mut local_var_req_builder =
1899 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1900
1901 if let Some(ref param_value) = name_prefix {
1902 local_var_req_builder =
1903 local_var_req_builder.query(&[("namePrefix", ¶m_value.to_string())]);
1904 }
1905 if let Some(ref param_value) = name_suffix {
1906 local_var_req_builder =
1907 local_var_req_builder.query(&[("nameSuffix", ¶m_value.to_string())]);
1908 }
1909 if let Some(ref param_value) = min_amount_threshold {
1910 local_var_req_builder =
1911 local_var_req_builder.query(&[("minAmountThreshold", ¶m_value.to_string())]);
1912 }
1913 if let Some(ref param_value) = asset_id {
1914 local_var_req_builder =
1915 local_var_req_builder.query(&[("assetId", ¶m_value.to_string())]);
1916 }
1917 if let Some(ref param_value) = order_by {
1918 local_var_req_builder =
1919 local_var_req_builder.query(&[("orderBy", ¶m_value.to_string())]);
1920 }
1921 if let Some(ref param_value) = before {
1922 local_var_req_builder =
1923 local_var_req_builder.query(&[("before", ¶m_value.to_string())]);
1924 }
1925 if let Some(ref param_value) = after {
1926 local_var_req_builder =
1927 local_var_req_builder.query(&[("after", ¶m_value.to_string())]);
1928 }
1929 if let Some(ref param_value) = limit {
1930 local_var_req_builder =
1931 local_var_req_builder.query(&[("limit", ¶m_value.to_string())]);
1932 }
1933 if let Some(ref param_value) = tag_ids {
1934 local_var_req_builder = match "multi" {
1935 "multi" => local_var_req_builder.query(
1936 ¶m_value
1937 .into_iter()
1938 .map(|p| ("tagIds".to_owned(), p.to_string()))
1939 .collect::<Vec<(std::string::String, std::string::String)>>(),
1940 ),
1941 _ => local_var_req_builder.query(&[(
1942 "tagIds",
1943 ¶m_value
1944 .into_iter()
1945 .map(|p| p.to_string())
1946 .collect::<Vec<String>>()
1947 .join(",")
1948 .to_string(),
1949 )]),
1950 };
1951 }
1952 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1953 local_var_req_builder = local_var_req_builder
1954 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1955 }
1956
1957 let local_var_req = local_var_req_builder.build()?;
1958 let local_var_resp = local_var_client.execute(local_var_req).await?;
1959
1960 let local_var_status = local_var_resp.status();
1961 let local_var_content_type = local_var_resp
1962 .headers()
1963 .get("content-type")
1964 .and_then(|v| v.to_str().ok())
1965 .unwrap_or("application/octet-stream");
1966 let local_var_content_type = super::ContentType::from(local_var_content_type);
1967 let local_var_content = local_var_resp.text().await?;
1968
1969 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1970 match local_var_content_type {
1971 ContentType::Json => {
1972 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1973 }
1974 ContentType::Text => {
1975 return Err(Error::from(serde_json::Error::custom(
1976 "Received `text/plain` content type response that cannot be converted to \
1977 `models::VaultAccountsPagedResponse`",
1978 )));
1979 }
1980 ContentType::Unsupported(local_var_unknown_type) => {
1981 return Err(Error::from(serde_json::Error::custom(format!(
1982 "Received `{local_var_unknown_type}` content type response that cannot be \
1983 converted to `models::VaultAccountsPagedResponse`"
1984 ))));
1985 }
1986 }
1987 } else {
1988 let local_var_entity: Option<GetPagedVaultAccountsError> =
1989 serde_json::from_str(&local_var_content).ok();
1990 let local_var_error = ResponseContent {
1991 status: local_var_status,
1992 content: local_var_content,
1993 entity: local_var_entity,
1994 };
1995 Err(Error::ResponseError(local_var_error))
1996 }
1997 }
1998
1999 async fn get_public_key_info(
2002 &self,
2003 params: GetPublicKeyInfoParams,
2004 ) -> Result<models::PublicKeyInformation, Error<GetPublicKeyInfoError>> {
2005 let GetPublicKeyInfoParams {
2006 derivation_path,
2007 algorithm,
2008 compressed,
2009 } = params;
2010
2011 let local_var_configuration = &self.configuration;
2012
2013 let local_var_client = &local_var_configuration.client;
2014
2015 let local_var_uri_str = format!(
2016 "{}/vault/public_key_info",
2017 local_var_configuration.base_path
2018 );
2019 let mut local_var_req_builder =
2020 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2021
2022 local_var_req_builder = match "multi" {
2023 "multi" => local_var_req_builder.query(
2024 &derivation_path
2025 .into_iter()
2026 .map(|p| ("derivationPath".to_owned(), p.to_string()))
2027 .collect::<Vec<(std::string::String, std::string::String)>>(),
2028 ),
2029 _ => local_var_req_builder.query(&[(
2030 "derivationPath",
2031 &derivation_path
2032 .into_iter()
2033 .map(|p| p.to_string())
2034 .collect::<Vec<String>>()
2035 .join(",")
2036 .to_string(),
2037 )]),
2038 };
2039 local_var_req_builder =
2040 local_var_req_builder.query(&[("algorithm", &algorithm.to_string())]);
2041 if let Some(ref param_value) = compressed {
2042 local_var_req_builder =
2043 local_var_req_builder.query(&[("compressed", ¶m_value.to_string())]);
2044 }
2045 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2046 local_var_req_builder = local_var_req_builder
2047 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2048 }
2049
2050 let local_var_req = local_var_req_builder.build()?;
2051 let local_var_resp = local_var_client.execute(local_var_req).await?;
2052
2053 let local_var_status = local_var_resp.status();
2054 let local_var_content_type = local_var_resp
2055 .headers()
2056 .get("content-type")
2057 .and_then(|v| v.to_str().ok())
2058 .unwrap_or("application/octet-stream");
2059 let local_var_content_type = super::ContentType::from(local_var_content_type);
2060 let local_var_content = local_var_resp.text().await?;
2061
2062 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2063 match local_var_content_type {
2064 ContentType::Json => {
2065 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
2066 }
2067 ContentType::Text => {
2068 return Err(Error::from(serde_json::Error::custom(
2069 "Received `text/plain` content type response that cannot be converted to \
2070 `models::PublicKeyInformation`",
2071 )));
2072 }
2073 ContentType::Unsupported(local_var_unknown_type) => {
2074 return Err(Error::from(serde_json::Error::custom(format!(
2075 "Received `{local_var_unknown_type}` content type response that cannot be \
2076 converted to `models::PublicKeyInformation`"
2077 ))));
2078 }
2079 }
2080 } else {
2081 let local_var_entity: Option<GetPublicKeyInfoError> =
2082 serde_json::from_str(&local_var_content).ok();
2083 let local_var_error = ResponseContent {
2084 status: local_var_status,
2085 content: local_var_content,
2086 entity: local_var_entity,
2087 };
2088 Err(Error::ResponseError(local_var_error))
2089 }
2090 }
2091
2092 async fn get_public_key_info_for_address(
2095 &self,
2096 params: GetPublicKeyInfoForAddressParams,
2097 ) -> Result<models::PublicKeyInformation, Error<GetPublicKeyInfoForAddressError>> {
2098 let GetPublicKeyInfoForAddressParams {
2099 vault_account_id,
2100 asset_id,
2101 change,
2102 address_index,
2103 compressed,
2104 } = params;
2105
2106 let local_var_configuration = &self.configuration;
2107
2108 let local_var_client = &local_var_configuration.client;
2109
2110 let local_var_uri_str = format!(
2111 "{}/vault/accounts/{vaultAccountId}/{assetId}/{change}/{addressIndex}/public_key_info",
2112 local_var_configuration.base_path,
2113 vaultAccountId = crate::apis::urlencode(vault_account_id),
2114 assetId = crate::apis::urlencode(asset_id),
2115 change = change,
2116 addressIndex = address_index
2117 );
2118 let mut local_var_req_builder =
2119 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2120
2121 if let Some(ref param_value) = compressed {
2122 local_var_req_builder =
2123 local_var_req_builder.query(&[("compressed", ¶m_value.to_string())]);
2124 }
2125 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2126 local_var_req_builder = local_var_req_builder
2127 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2128 }
2129
2130 let local_var_req = local_var_req_builder.build()?;
2131 let local_var_resp = local_var_client.execute(local_var_req).await?;
2132
2133 let local_var_status = local_var_resp.status();
2134 let local_var_content_type = local_var_resp
2135 .headers()
2136 .get("content-type")
2137 .and_then(|v| v.to_str().ok())
2138 .unwrap_or("application/octet-stream");
2139 let local_var_content_type = super::ContentType::from(local_var_content_type);
2140 let local_var_content = local_var_resp.text().await?;
2141
2142 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2143 match local_var_content_type {
2144 ContentType::Json => {
2145 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
2146 }
2147 ContentType::Text => {
2148 return Err(Error::from(serde_json::Error::custom(
2149 "Received `text/plain` content type response that cannot be converted to \
2150 `models::PublicKeyInformation`",
2151 )));
2152 }
2153 ContentType::Unsupported(local_var_unknown_type) => {
2154 return Err(Error::from(serde_json::Error::custom(format!(
2155 "Received `{local_var_unknown_type}` content type response that cannot be \
2156 converted to `models::PublicKeyInformation`"
2157 ))));
2158 }
2159 }
2160 } else {
2161 let local_var_entity: Option<GetPublicKeyInfoForAddressError> =
2162 serde_json::from_str(&local_var_content).ok();
2163 let local_var_error = ResponseContent {
2164 status: local_var_status,
2165 content: local_var_content,
2166 entity: local_var_entity,
2167 };
2168 Err(Error::ResponseError(local_var_error))
2169 }
2170 }
2171
2172 async fn get_unspent_inputs(
2176 &self,
2177 params: GetUnspentInputsParams,
2178 ) -> Result<Vec<models::UnspentInputsResponse>, Error<GetUnspentInputsError>> {
2179 let GetUnspentInputsParams {
2180 vault_account_id,
2181 asset_id,
2182 } = params;
2183
2184 let local_var_configuration = &self.configuration;
2185
2186 let local_var_client = &local_var_configuration.client;
2187
2188 let local_var_uri_str = format!(
2189 "{}/vault/accounts/{vaultAccountId}/{assetId}/unspent_inputs",
2190 local_var_configuration.base_path,
2191 vaultAccountId = crate::apis::urlencode(vault_account_id),
2192 assetId = crate::apis::urlencode(asset_id)
2193 );
2194 let mut local_var_req_builder =
2195 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2196
2197 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2198 local_var_req_builder = local_var_req_builder
2199 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2200 }
2201
2202 let local_var_req = local_var_req_builder.build()?;
2203 let local_var_resp = local_var_client.execute(local_var_req).await?;
2204
2205 let local_var_status = local_var_resp.status();
2206 let local_var_content_type = local_var_resp
2207 .headers()
2208 .get("content-type")
2209 .and_then(|v| v.to_str().ok())
2210 .unwrap_or("application/octet-stream");
2211 let local_var_content_type = super::ContentType::from(local_var_content_type);
2212 let local_var_content = local_var_resp.text().await?;
2213
2214 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2215 match local_var_content_type {
2216 ContentType::Json => {
2217 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
2218 }
2219 ContentType::Text => {
2220 return Err(Error::from(serde_json::Error::custom(
2221 "Received `text/plain` content type response that cannot be converted to \
2222 `Vec<models::UnspentInputsResponse>`",
2223 )));
2224 }
2225 ContentType::Unsupported(local_var_unknown_type) => {
2226 return Err(Error::from(serde_json::Error::custom(format!(
2227 "Received `{local_var_unknown_type}` content type response that cannot be \
2228 converted to `Vec<models::UnspentInputsResponse>`"
2229 ))));
2230 }
2231 }
2232 } else {
2233 let local_var_entity: Option<GetUnspentInputsError> =
2234 serde_json::from_str(&local_var_content).ok();
2235 let local_var_error = ResponseContent {
2236 status: local_var_status,
2237 content: local_var_content,
2238 entity: local_var_entity,
2239 };
2240 Err(Error::ResponseError(local_var_error))
2241 }
2242 }
2243
2244 async fn get_vault_account(
2247 &self,
2248 params: GetVaultAccountParams,
2249 ) -> Result<models::VaultAccount, Error<GetVaultAccountError>> {
2250 let GetVaultAccountParams { vault_account_id } = params;
2251
2252 let local_var_configuration = &self.configuration;
2253
2254 let local_var_client = &local_var_configuration.client;
2255
2256 let local_var_uri_str = format!(
2257 "{}/vault/accounts/{vaultAccountId}",
2258 local_var_configuration.base_path,
2259 vaultAccountId = crate::apis::urlencode(vault_account_id)
2260 );
2261 let mut local_var_req_builder =
2262 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2263
2264 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2265 local_var_req_builder = local_var_req_builder
2266 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2267 }
2268
2269 let local_var_req = local_var_req_builder.build()?;
2270 let local_var_resp = local_var_client.execute(local_var_req).await?;
2271
2272 let local_var_status = local_var_resp.status();
2273 let local_var_content_type = local_var_resp
2274 .headers()
2275 .get("content-type")
2276 .and_then(|v| v.to_str().ok())
2277 .unwrap_or("application/octet-stream");
2278 let local_var_content_type = super::ContentType::from(local_var_content_type);
2279 let local_var_content = local_var_resp.text().await?;
2280
2281 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2282 match local_var_content_type {
2283 ContentType::Json => {
2284 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
2285 }
2286 ContentType::Text => {
2287 return Err(Error::from(serde_json::Error::custom(
2288 "Received `text/plain` content type response that cannot be converted to \
2289 `models::VaultAccount`",
2290 )));
2291 }
2292 ContentType::Unsupported(local_var_unknown_type) => {
2293 return Err(Error::from(serde_json::Error::custom(format!(
2294 "Received `{local_var_unknown_type}` content type response that cannot be \
2295 converted to `models::VaultAccount`"
2296 ))));
2297 }
2298 }
2299 } else {
2300 let local_var_entity: Option<GetVaultAccountError> =
2301 serde_json::from_str(&local_var_content).ok();
2302 let local_var_error = ResponseContent {
2303 status: local_var_status,
2304 content: local_var_content,
2305 entity: local_var_entity,
2306 };
2307 Err(Error::ResponseError(local_var_error))
2308 }
2309 }
2310
2311 async fn get_vault_account_asset(
2315 &self,
2316 params: GetVaultAccountAssetParams,
2317 ) -> Result<models::VaultAsset, Error<GetVaultAccountAssetError>> {
2318 let GetVaultAccountAssetParams {
2319 vault_account_id,
2320 asset_id,
2321 } = params;
2322
2323 let local_var_configuration = &self.configuration;
2324
2325 let local_var_client = &local_var_configuration.client;
2326
2327 let local_var_uri_str = format!(
2328 "{}/vault/accounts/{vaultAccountId}/{assetId}",
2329 local_var_configuration.base_path,
2330 vaultAccountId = crate::apis::urlencode(vault_account_id),
2331 assetId = crate::apis::urlencode(asset_id)
2332 );
2333 let mut local_var_req_builder =
2334 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2335
2336 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2337 local_var_req_builder = local_var_req_builder
2338 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2339 }
2340
2341 let local_var_req = local_var_req_builder.build()?;
2342 let local_var_resp = local_var_client.execute(local_var_req).await?;
2343
2344 let local_var_status = local_var_resp.status();
2345 let local_var_content_type = local_var_resp
2346 .headers()
2347 .get("content-type")
2348 .and_then(|v| v.to_str().ok())
2349 .unwrap_or("application/octet-stream");
2350 let local_var_content_type = super::ContentType::from(local_var_content_type);
2351 let local_var_content = local_var_resp.text().await?;
2352
2353 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2354 match local_var_content_type {
2355 ContentType::Json => {
2356 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
2357 }
2358 ContentType::Text => {
2359 return Err(Error::from(serde_json::Error::custom(
2360 "Received `text/plain` content type response that cannot be converted to \
2361 `models::VaultAsset`",
2362 )));
2363 }
2364 ContentType::Unsupported(local_var_unknown_type) => {
2365 return Err(Error::from(serde_json::Error::custom(format!(
2366 "Received `{local_var_unknown_type}` content type response that cannot be \
2367 converted to `models::VaultAsset`"
2368 ))));
2369 }
2370 }
2371 } else {
2372 let local_var_entity: Option<GetVaultAccountAssetError> =
2373 serde_json::from_str(&local_var_content).ok();
2374 let local_var_error = ResponseContent {
2375 status: local_var_status,
2376 content: local_var_content,
2377 entity: local_var_entity,
2378 };
2379 Err(Error::ResponseError(local_var_error))
2380 }
2381 }
2382
2383 async fn get_vault_account_asset_addresses(
2395 &self,
2396 params: GetVaultAccountAssetAddressesParams,
2397 ) -> Result<Vec<models::VaultWalletAddress>, Error<GetVaultAccountAssetAddressesError>> {
2398 let GetVaultAccountAssetAddressesParams {
2399 vault_account_id,
2400 asset_id,
2401 } = params;
2402
2403 let local_var_configuration = &self.configuration;
2404
2405 let local_var_client = &local_var_configuration.client;
2406
2407 let local_var_uri_str = format!(
2408 "{}/vault/accounts/{vaultAccountId}/{assetId}/addresses",
2409 local_var_configuration.base_path,
2410 vaultAccountId = crate::apis::urlencode(vault_account_id),
2411 assetId = crate::apis::urlencode(asset_id)
2412 );
2413 let mut local_var_req_builder =
2414 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2415
2416 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2417 local_var_req_builder = local_var_req_builder
2418 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2419 }
2420
2421 let local_var_req = local_var_req_builder.build()?;
2422 let local_var_resp = local_var_client.execute(local_var_req).await?;
2423
2424 let local_var_status = local_var_resp.status();
2425 let local_var_content_type = local_var_resp
2426 .headers()
2427 .get("content-type")
2428 .and_then(|v| v.to_str().ok())
2429 .unwrap_or("application/octet-stream");
2430 let local_var_content_type = super::ContentType::from(local_var_content_type);
2431 let local_var_content = local_var_resp.text().await?;
2432
2433 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2434 match local_var_content_type {
2435 ContentType::Json => {
2436 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
2437 }
2438 ContentType::Text => {
2439 return Err(Error::from(serde_json::Error::custom(
2440 "Received `text/plain` content type response that cannot be converted to \
2441 `Vec<models::VaultWalletAddress>`",
2442 )));
2443 }
2444 ContentType::Unsupported(local_var_unknown_type) => {
2445 return Err(Error::from(serde_json::Error::custom(format!(
2446 "Received `{local_var_unknown_type}` content type response that cannot be \
2447 converted to `Vec<models::VaultWalletAddress>`"
2448 ))));
2449 }
2450 }
2451 } else {
2452 let local_var_entity: Option<GetVaultAccountAssetAddressesError> =
2453 serde_json::from_str(&local_var_content).ok();
2454 let local_var_error = ResponseContent {
2455 status: local_var_status,
2456 content: local_var_content,
2457 entity: local_var_entity,
2458 };
2459 Err(Error::ResponseError(local_var_error))
2460 }
2461 }
2462
2463 async fn get_vault_account_asset_addresses_paginated(
2467 &self,
2468 params: GetVaultAccountAssetAddressesPaginatedParams,
2469 ) -> Result<models::PaginatedAddressResponse, Error<GetVaultAccountAssetAddressesPaginatedError>>
2470 {
2471 let GetVaultAccountAssetAddressesPaginatedParams {
2472 vault_account_id,
2473 asset_id,
2474 limit,
2475 before,
2476 after,
2477 } = params;
2478
2479 let local_var_configuration = &self.configuration;
2480
2481 let local_var_client = &local_var_configuration.client;
2482
2483 let local_var_uri_str = format!(
2484 "{}/vault/accounts/{vaultAccountId}/{assetId}/addresses_paginated",
2485 local_var_configuration.base_path,
2486 vaultAccountId = crate::apis::urlencode(vault_account_id),
2487 assetId = crate::apis::urlencode(asset_id)
2488 );
2489 let mut local_var_req_builder =
2490 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2491
2492 if let Some(ref param_value) = limit {
2493 local_var_req_builder =
2494 local_var_req_builder.query(&[("limit", ¶m_value.to_string())]);
2495 }
2496 if let Some(ref param_value) = before {
2497 local_var_req_builder =
2498 local_var_req_builder.query(&[("before", ¶m_value.to_string())]);
2499 }
2500 if let Some(ref param_value) = after {
2501 local_var_req_builder =
2502 local_var_req_builder.query(&[("after", ¶m_value.to_string())]);
2503 }
2504 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2505 local_var_req_builder = local_var_req_builder
2506 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2507 }
2508
2509 let local_var_req = local_var_req_builder.build()?;
2510 let local_var_resp = local_var_client.execute(local_var_req).await?;
2511
2512 let local_var_status = local_var_resp.status();
2513 let local_var_content_type = local_var_resp
2514 .headers()
2515 .get("content-type")
2516 .and_then(|v| v.to_str().ok())
2517 .unwrap_or("application/octet-stream");
2518 let local_var_content_type = super::ContentType::from(local_var_content_type);
2519 let local_var_content = local_var_resp.text().await?;
2520
2521 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2522 match local_var_content_type {
2523 ContentType::Json => {
2524 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
2525 }
2526 ContentType::Text => {
2527 return Err(Error::from(serde_json::Error::custom(
2528 "Received `text/plain` content type response that cannot be converted to \
2529 `models::PaginatedAddressResponse`",
2530 )));
2531 }
2532 ContentType::Unsupported(local_var_unknown_type) => {
2533 return Err(Error::from(serde_json::Error::custom(format!(
2534 "Received `{local_var_unknown_type}` content type response that cannot be \
2535 converted to `models::PaginatedAddressResponse`"
2536 ))));
2537 }
2538 }
2539 } else {
2540 let local_var_entity: Option<GetVaultAccountAssetAddressesPaginatedError> =
2541 serde_json::from_str(&local_var_content).ok();
2542 let local_var_error = ResponseContent {
2543 status: local_var_status,
2544 content: local_var_content,
2545 entity: local_var_entity,
2546 };
2547 Err(Error::ResponseError(local_var_error))
2548 }
2549 }
2550
2551 async fn get_vault_assets(
2555 &self,
2556 params: GetVaultAssetsParams,
2557 ) -> Result<Vec<models::VaultAsset>, Error<GetVaultAssetsError>> {
2558 let GetVaultAssetsParams {
2559 account_name_prefix,
2560 account_name_suffix,
2561 } = params;
2562
2563 let local_var_configuration = &self.configuration;
2564
2565 let local_var_client = &local_var_configuration.client;
2566
2567 let local_var_uri_str = format!("{}/vault/assets", local_var_configuration.base_path);
2568 let mut local_var_req_builder =
2569 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2570
2571 if let Some(ref param_value) = account_name_prefix {
2572 local_var_req_builder =
2573 local_var_req_builder.query(&[("accountNamePrefix", ¶m_value.to_string())]);
2574 }
2575 if let Some(ref param_value) = account_name_suffix {
2576 local_var_req_builder =
2577 local_var_req_builder.query(&[("accountNameSuffix", ¶m_value.to_string())]);
2578 }
2579 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2580 local_var_req_builder = local_var_req_builder
2581 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2582 }
2583
2584 let local_var_req = local_var_req_builder.build()?;
2585 let local_var_resp = local_var_client.execute(local_var_req).await?;
2586
2587 let local_var_status = local_var_resp.status();
2588 let local_var_content_type = local_var_resp
2589 .headers()
2590 .get("content-type")
2591 .and_then(|v| v.to_str().ok())
2592 .unwrap_or("application/octet-stream");
2593 let local_var_content_type = super::ContentType::from(local_var_content_type);
2594 let local_var_content = local_var_resp.text().await?;
2595
2596 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2597 match local_var_content_type {
2598 ContentType::Json => {
2599 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
2600 }
2601 ContentType::Text => {
2602 return Err(Error::from(serde_json::Error::custom(
2603 "Received `text/plain` content type response that cannot be converted to \
2604 `Vec<models::VaultAsset>`",
2605 )));
2606 }
2607 ContentType::Unsupported(local_var_unknown_type) => {
2608 return Err(Error::from(serde_json::Error::custom(format!(
2609 "Received `{local_var_unknown_type}` content type response that cannot be \
2610 converted to `Vec<models::VaultAsset>`"
2611 ))));
2612 }
2613 }
2614 } else {
2615 let local_var_entity: Option<GetVaultAssetsError> =
2616 serde_json::from_str(&local_var_content).ok();
2617 let local_var_error = ResponseContent {
2618 status: local_var_status,
2619 content: local_var_content,
2620 entity: local_var_entity,
2621 };
2622 Err(Error::ResponseError(local_var_error))
2623 }
2624 }
2625
2626 async fn get_vault_balance_by_asset(
2630 &self,
2631 params: GetVaultBalanceByAssetParams,
2632 ) -> Result<models::VaultAsset, Error<GetVaultBalanceByAssetError>> {
2633 let GetVaultBalanceByAssetParams { asset_id } = params;
2634
2635 let local_var_configuration = &self.configuration;
2636
2637 let local_var_client = &local_var_configuration.client;
2638
2639 let local_var_uri_str = format!(
2640 "{}/vault/assets/{assetId}",
2641 local_var_configuration.base_path,
2642 assetId = crate::apis::urlencode(asset_id)
2643 );
2644 let mut local_var_req_builder =
2645 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2646
2647 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2648 local_var_req_builder = local_var_req_builder
2649 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2650 }
2651
2652 let local_var_req = local_var_req_builder.build()?;
2653 let local_var_resp = local_var_client.execute(local_var_req).await?;
2654
2655 let local_var_status = local_var_resp.status();
2656 let local_var_content_type = local_var_resp
2657 .headers()
2658 .get("content-type")
2659 .and_then(|v| v.to_str().ok())
2660 .unwrap_or("application/octet-stream");
2661 let local_var_content_type = super::ContentType::from(local_var_content_type);
2662 let local_var_content = local_var_resp.text().await?;
2663
2664 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2665 match local_var_content_type {
2666 ContentType::Json => {
2667 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
2668 }
2669 ContentType::Text => {
2670 return Err(Error::from(serde_json::Error::custom(
2671 "Received `text/plain` content type response that cannot be converted to \
2672 `models::VaultAsset`",
2673 )));
2674 }
2675 ContentType::Unsupported(local_var_unknown_type) => {
2676 return Err(Error::from(serde_json::Error::custom(format!(
2677 "Received `{local_var_unknown_type}` content type response that cannot be \
2678 converted to `models::VaultAsset`"
2679 ))));
2680 }
2681 }
2682 } else {
2683 let local_var_entity: Option<GetVaultBalanceByAssetError> =
2684 serde_json::from_str(&local_var_content).ok();
2685 let local_var_error = ResponseContent {
2686 status: local_var_status,
2687 content: local_var_content,
2688 entity: local_var_entity,
2689 };
2690 Err(Error::ResponseError(local_var_error))
2691 }
2692 }
2693
2694 async fn hide_vault_account(
2696 &self,
2697 params: HideVaultAccountParams,
2698 ) -> Result<models::VaultActionStatus, Error<HideVaultAccountError>> {
2699 let HideVaultAccountParams {
2700 vault_account_id,
2701 idempotency_key,
2702 } = params;
2703
2704 let local_var_configuration = &self.configuration;
2705
2706 let local_var_client = &local_var_configuration.client;
2707
2708 let local_var_uri_str = format!(
2709 "{}/vault/accounts/{vaultAccountId}/hide",
2710 local_var_configuration.base_path,
2711 vaultAccountId = crate::apis::urlencode(vault_account_id)
2712 );
2713 let mut local_var_req_builder =
2714 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2715
2716 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2717 local_var_req_builder = local_var_req_builder
2718 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2719 }
2720 if let Some(local_var_param_value) = idempotency_key {
2721 local_var_req_builder =
2722 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
2723 }
2724
2725 let local_var_req = local_var_req_builder.build()?;
2726 let local_var_resp = local_var_client.execute(local_var_req).await?;
2727
2728 let local_var_status = local_var_resp.status();
2729 let local_var_content_type = local_var_resp
2730 .headers()
2731 .get("content-type")
2732 .and_then(|v| v.to_str().ok())
2733 .unwrap_or("application/octet-stream");
2734 let local_var_content_type = super::ContentType::from(local_var_content_type);
2735 let local_var_content = local_var_resp.text().await?;
2736
2737 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2738 match local_var_content_type {
2739 ContentType::Json => {
2740 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
2741 }
2742 ContentType::Text => {
2743 return Err(Error::from(serde_json::Error::custom(
2744 "Received `text/plain` content type response that cannot be converted to \
2745 `models::VaultActionStatus`",
2746 )));
2747 }
2748 ContentType::Unsupported(local_var_unknown_type) => {
2749 return Err(Error::from(serde_json::Error::custom(format!(
2750 "Received `{local_var_unknown_type}` content type response that cannot be \
2751 converted to `models::VaultActionStatus`"
2752 ))));
2753 }
2754 }
2755 } else {
2756 let local_var_entity: Option<HideVaultAccountError> =
2757 serde_json::from_str(&local_var_content).ok();
2758 let local_var_error = ResponseContent {
2759 status: local_var_status,
2760 content: local_var_content,
2761 entity: local_var_entity,
2762 };
2763 Err(Error::ResponseError(local_var_error))
2764 }
2765 }
2766
2767 async fn set_customer_ref_id_for_address(
2770 &self,
2771 params: SetCustomerRefIdForAddressParams,
2772 ) -> Result<models::VaultActionStatus, Error<SetCustomerRefIdForAddressError>> {
2773 let SetCustomerRefIdForAddressParams {
2774 vault_account_id,
2775 asset_id,
2776 address_id,
2777 set_customer_ref_id_for_address_request,
2778 idempotency_key,
2779 } = params;
2780
2781 let local_var_configuration = &self.configuration;
2782
2783 let local_var_client = &local_var_configuration.client;
2784
2785 let local_var_uri_str = format!(
2786 "{}/vault/accounts/{vaultAccountId}/{assetId}/addresses/{addressId}/\
2787 set_customer_ref_id",
2788 local_var_configuration.base_path,
2789 vaultAccountId = crate::apis::urlencode(vault_account_id),
2790 assetId = crate::apis::urlencode(asset_id),
2791 addressId = crate::apis::urlencode(address_id)
2792 );
2793 let mut local_var_req_builder =
2794 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2795
2796 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2797 local_var_req_builder = local_var_req_builder
2798 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2799 }
2800 if let Some(local_var_param_value) = idempotency_key {
2801 local_var_req_builder =
2802 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
2803 }
2804 local_var_req_builder =
2805 local_var_req_builder.json(&set_customer_ref_id_for_address_request);
2806
2807 let local_var_req = local_var_req_builder.build()?;
2808 let local_var_resp = local_var_client.execute(local_var_req).await?;
2809
2810 let local_var_status = local_var_resp.status();
2811 let local_var_content_type = local_var_resp
2812 .headers()
2813 .get("content-type")
2814 .and_then(|v| v.to_str().ok())
2815 .unwrap_or("application/octet-stream");
2816 let local_var_content_type = super::ContentType::from(local_var_content_type);
2817 let local_var_content = local_var_resp.text().await?;
2818
2819 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2820 match local_var_content_type {
2821 ContentType::Json => {
2822 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
2823 }
2824 ContentType::Text => {
2825 return Err(Error::from(serde_json::Error::custom(
2826 "Received `text/plain` content type response that cannot be converted to \
2827 `models::VaultActionStatus`",
2828 )));
2829 }
2830 ContentType::Unsupported(local_var_unknown_type) => {
2831 return Err(Error::from(serde_json::Error::custom(format!(
2832 "Received `{local_var_unknown_type}` content type response that cannot be \
2833 converted to `models::VaultActionStatus`"
2834 ))));
2835 }
2836 }
2837 } else {
2838 let local_var_entity: Option<SetCustomerRefIdForAddressError> =
2839 serde_json::from_str(&local_var_content).ok();
2840 let local_var_error = ResponseContent {
2841 status: local_var_status,
2842 content: local_var_content,
2843 entity: local_var_entity,
2844 };
2845 Err(Error::ResponseError(local_var_error))
2846 }
2847 }
2848
2849 async fn set_vault_account_auto_fuel(
2851 &self,
2852 params: SetVaultAccountAutoFuelParams,
2853 ) -> Result<models::VaultActionStatus, Error<SetVaultAccountAutoFuelError>> {
2854 let SetVaultAccountAutoFuelParams {
2855 vault_account_id,
2856 set_auto_fuel_request,
2857 idempotency_key,
2858 } = params;
2859
2860 let local_var_configuration = &self.configuration;
2861
2862 let local_var_client = &local_var_configuration.client;
2863
2864 let local_var_uri_str = format!(
2865 "{}/vault/accounts/{vaultAccountId}/set_auto_fuel",
2866 local_var_configuration.base_path,
2867 vaultAccountId = crate::apis::urlencode(vault_account_id)
2868 );
2869 let mut local_var_req_builder =
2870 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2871
2872 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2873 local_var_req_builder = local_var_req_builder
2874 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2875 }
2876 if let Some(local_var_param_value) = idempotency_key {
2877 local_var_req_builder =
2878 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
2879 }
2880 local_var_req_builder = local_var_req_builder.json(&set_auto_fuel_request);
2881
2882 let local_var_req = local_var_req_builder.build()?;
2883 let local_var_resp = local_var_client.execute(local_var_req).await?;
2884
2885 let local_var_status = local_var_resp.status();
2886 let local_var_content_type = local_var_resp
2887 .headers()
2888 .get("content-type")
2889 .and_then(|v| v.to_str().ok())
2890 .unwrap_or("application/octet-stream");
2891 let local_var_content_type = super::ContentType::from(local_var_content_type);
2892 let local_var_content = local_var_resp.text().await?;
2893
2894 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2895 match local_var_content_type {
2896 ContentType::Json => {
2897 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
2898 }
2899 ContentType::Text => {
2900 return Err(Error::from(serde_json::Error::custom(
2901 "Received `text/plain` content type response that cannot be converted to \
2902 `models::VaultActionStatus`",
2903 )));
2904 }
2905 ContentType::Unsupported(local_var_unknown_type) => {
2906 return Err(Error::from(serde_json::Error::custom(format!(
2907 "Received `{local_var_unknown_type}` content type response that cannot be \
2908 converted to `models::VaultActionStatus`"
2909 ))));
2910 }
2911 }
2912 } else {
2913 let local_var_entity: Option<SetVaultAccountAutoFuelError> =
2914 serde_json::from_str(&local_var_content).ok();
2915 let local_var_error = ResponseContent {
2916 status: local_var_status,
2917 content: local_var_content,
2918 entity: local_var_entity,
2919 };
2920 Err(Error::ResponseError(local_var_error))
2921 }
2922 }
2923
2924 async fn set_vault_account_customer_ref_id(
2926 &self,
2927 params: SetVaultAccountCustomerRefIdParams,
2928 ) -> Result<models::VaultActionStatus, Error<SetVaultAccountCustomerRefIdError>> {
2929 let SetVaultAccountCustomerRefIdParams {
2930 vault_account_id,
2931 set_customer_ref_id_request,
2932 idempotency_key,
2933 } = params;
2934
2935 let local_var_configuration = &self.configuration;
2936
2937 let local_var_client = &local_var_configuration.client;
2938
2939 let local_var_uri_str = format!(
2940 "{}/vault/accounts/{vaultAccountId}/set_customer_ref_id",
2941 local_var_configuration.base_path,
2942 vaultAccountId = crate::apis::urlencode(vault_account_id)
2943 );
2944 let mut local_var_req_builder =
2945 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2946
2947 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2948 local_var_req_builder = local_var_req_builder
2949 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2950 }
2951 if let Some(local_var_param_value) = idempotency_key {
2952 local_var_req_builder =
2953 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
2954 }
2955 local_var_req_builder = local_var_req_builder.json(&set_customer_ref_id_request);
2956
2957 let local_var_req = local_var_req_builder.build()?;
2958 let local_var_resp = local_var_client.execute(local_var_req).await?;
2959
2960 let local_var_status = local_var_resp.status();
2961 let local_var_content_type = local_var_resp
2962 .headers()
2963 .get("content-type")
2964 .and_then(|v| v.to_str().ok())
2965 .unwrap_or("application/octet-stream");
2966 let local_var_content_type = super::ContentType::from(local_var_content_type);
2967 let local_var_content = local_var_resp.text().await?;
2968
2969 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2970 match local_var_content_type {
2971 ContentType::Json => {
2972 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
2973 }
2974 ContentType::Text => {
2975 return Err(Error::from(serde_json::Error::custom(
2976 "Received `text/plain` content type response that cannot be converted to \
2977 `models::VaultActionStatus`",
2978 )));
2979 }
2980 ContentType::Unsupported(local_var_unknown_type) => {
2981 return Err(Error::from(serde_json::Error::custom(format!(
2982 "Received `{local_var_unknown_type}` content type response that cannot be \
2983 converted to `models::VaultActionStatus`"
2984 ))));
2985 }
2986 }
2987 } else {
2988 let local_var_entity: Option<SetVaultAccountCustomerRefIdError> =
2989 serde_json::from_str(&local_var_content).ok();
2990 let local_var_error = ResponseContent {
2991 status: local_var_status,
2992 content: local_var_content,
2993 entity: local_var_entity,
2994 };
2995 Err(Error::ResponseError(local_var_error))
2996 }
2997 }
2998
2999 async fn unhide_vault_account(
3002 &self,
3003 params: UnhideVaultAccountParams,
3004 ) -> Result<models::VaultActionStatus, Error<UnhideVaultAccountError>> {
3005 let UnhideVaultAccountParams {
3006 vault_account_id,
3007 idempotency_key,
3008 } = params;
3009
3010 let local_var_configuration = &self.configuration;
3011
3012 let local_var_client = &local_var_configuration.client;
3013
3014 let local_var_uri_str = format!(
3015 "{}/vault/accounts/{vaultAccountId}/unhide",
3016 local_var_configuration.base_path,
3017 vaultAccountId = crate::apis::urlencode(vault_account_id)
3018 );
3019 let mut local_var_req_builder =
3020 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
3021
3022 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3023 local_var_req_builder = local_var_req_builder
3024 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3025 }
3026 if let Some(local_var_param_value) = idempotency_key {
3027 local_var_req_builder =
3028 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
3029 }
3030
3031 let local_var_req = local_var_req_builder.build()?;
3032 let local_var_resp = local_var_client.execute(local_var_req).await?;
3033
3034 let local_var_status = local_var_resp.status();
3035 let local_var_content_type = local_var_resp
3036 .headers()
3037 .get("content-type")
3038 .and_then(|v| v.to_str().ok())
3039 .unwrap_or("application/octet-stream");
3040 let local_var_content_type = super::ContentType::from(local_var_content_type);
3041 let local_var_content = local_var_resp.text().await?;
3042
3043 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3044 match local_var_content_type {
3045 ContentType::Json => {
3046 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
3047 }
3048 ContentType::Text => {
3049 return Err(Error::from(serde_json::Error::custom(
3050 "Received `text/plain` content type response that cannot be converted to \
3051 `models::VaultActionStatus`",
3052 )));
3053 }
3054 ContentType::Unsupported(local_var_unknown_type) => {
3055 return Err(Error::from(serde_json::Error::custom(format!(
3056 "Received `{local_var_unknown_type}` content type response that cannot be \
3057 converted to `models::VaultActionStatus`"
3058 ))));
3059 }
3060 }
3061 } else {
3062 let local_var_entity: Option<UnhideVaultAccountError> =
3063 serde_json::from_str(&local_var_content).ok();
3064 let local_var_error = ResponseContent {
3065 status: local_var_status,
3066 content: local_var_content,
3067 entity: local_var_entity,
3068 };
3069 Err(Error::ResponseError(local_var_error))
3070 }
3071 }
3072
3073 async fn update_vault_account(
3076 &self,
3077 params: UpdateVaultAccountParams,
3078 ) -> Result<models::RenameVaultAccountResponse, Error<UpdateVaultAccountError>> {
3079 let UpdateVaultAccountParams {
3080 vault_account_id,
3081 update_vault_account_request,
3082 idempotency_key,
3083 } = params;
3084
3085 let local_var_configuration = &self.configuration;
3086
3087 let local_var_client = &local_var_configuration.client;
3088
3089 let local_var_uri_str = format!(
3090 "{}/vault/accounts/{vaultAccountId}",
3091 local_var_configuration.base_path,
3092 vaultAccountId = crate::apis::urlencode(vault_account_id)
3093 );
3094 let mut local_var_req_builder =
3095 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
3096
3097 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3098 local_var_req_builder = local_var_req_builder
3099 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3100 }
3101 if let Some(local_var_param_value) = idempotency_key {
3102 local_var_req_builder =
3103 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
3104 }
3105 local_var_req_builder = local_var_req_builder.json(&update_vault_account_request);
3106
3107 let local_var_req = local_var_req_builder.build()?;
3108 let local_var_resp = local_var_client.execute(local_var_req).await?;
3109
3110 let local_var_status = local_var_resp.status();
3111 let local_var_content_type = local_var_resp
3112 .headers()
3113 .get("content-type")
3114 .and_then(|v| v.to_str().ok())
3115 .unwrap_or("application/octet-stream");
3116 let local_var_content_type = super::ContentType::from(local_var_content_type);
3117 let local_var_content = local_var_resp.text().await?;
3118
3119 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3120 match local_var_content_type {
3121 ContentType::Json => {
3122 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
3123 }
3124 ContentType::Text => {
3125 return Err(Error::from(serde_json::Error::custom(
3126 "Received `text/plain` content type response that cannot be converted to \
3127 `models::RenameVaultAccountResponse`",
3128 )));
3129 }
3130 ContentType::Unsupported(local_var_unknown_type) => {
3131 return Err(Error::from(serde_json::Error::custom(format!(
3132 "Received `{local_var_unknown_type}` content type response that cannot be \
3133 converted to `models::RenameVaultAccountResponse`"
3134 ))));
3135 }
3136 }
3137 } else {
3138 let local_var_entity: Option<UpdateVaultAccountError> =
3139 serde_json::from_str(&local_var_content).ok();
3140 let local_var_error = ResponseContent {
3141 status: local_var_status,
3142 content: local_var_content,
3143 entity: local_var_entity,
3144 };
3145 Err(Error::ResponseError(local_var_error))
3146 }
3147 }
3148
3149 async fn update_vault_account_asset_address(
3153 &self,
3154 params: UpdateVaultAccountAssetAddressParams,
3155 ) -> Result<models::VaultActionStatus, Error<UpdateVaultAccountAssetAddressError>> {
3156 let UpdateVaultAccountAssetAddressParams {
3157 vault_account_id,
3158 asset_id,
3159 address_id,
3160 idempotency_key,
3161 update_vault_account_asset_address_request,
3162 } = params;
3163
3164 let local_var_configuration = &self.configuration;
3165
3166 let local_var_client = &local_var_configuration.client;
3167
3168 let local_var_uri_str = format!(
3169 "{}/vault/accounts/{vaultAccountId}/{assetId}/addresses/{addressId}",
3170 local_var_configuration.base_path,
3171 vaultAccountId = crate::apis::urlencode(vault_account_id),
3172 assetId = crate::apis::urlencode(asset_id),
3173 addressId = crate::apis::urlencode(address_id)
3174 );
3175 let mut local_var_req_builder =
3176 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
3177
3178 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3179 local_var_req_builder = local_var_req_builder
3180 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3181 }
3182 if let Some(local_var_param_value) = idempotency_key {
3183 local_var_req_builder =
3184 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
3185 }
3186 local_var_req_builder =
3187 local_var_req_builder.json(&update_vault_account_asset_address_request);
3188
3189 let local_var_req = local_var_req_builder.build()?;
3190 let local_var_resp = local_var_client.execute(local_var_req).await?;
3191
3192 let local_var_status = local_var_resp.status();
3193 let local_var_content_type = local_var_resp
3194 .headers()
3195 .get("content-type")
3196 .and_then(|v| v.to_str().ok())
3197 .unwrap_or("application/octet-stream");
3198 let local_var_content_type = super::ContentType::from(local_var_content_type);
3199 let local_var_content = local_var_resp.text().await?;
3200
3201 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3202 match local_var_content_type {
3203 ContentType::Json => {
3204 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
3205 }
3206 ContentType::Text => {
3207 return Err(Error::from(serde_json::Error::custom(
3208 "Received `text/plain` content type response that cannot be converted to \
3209 `models::VaultActionStatus`",
3210 )));
3211 }
3212 ContentType::Unsupported(local_var_unknown_type) => {
3213 return Err(Error::from(serde_json::Error::custom(format!(
3214 "Received `{local_var_unknown_type}` content type response that cannot be \
3215 converted to `models::VaultActionStatus`"
3216 ))));
3217 }
3218 }
3219 } else {
3220 let local_var_entity: Option<UpdateVaultAccountAssetAddressError> =
3221 serde_json::from_str(&local_var_content).ok();
3222 let local_var_error = ResponseContent {
3223 status: local_var_status,
3224 content: local_var_content,
3225 entity: local_var_entity,
3226 };
3227 Err(Error::ResponseError(local_var_error))
3228 }
3229 }
3230
3231 async fn update_vault_account_asset_balance(
3236 &self,
3237 params: UpdateVaultAccountAssetBalanceParams,
3238 ) -> Result<models::VaultAsset, Error<UpdateVaultAccountAssetBalanceError>> {
3239 let UpdateVaultAccountAssetBalanceParams {
3240 vault_account_id,
3241 asset_id,
3242 idempotency_key,
3243 } = params;
3244
3245 let local_var_configuration = &self.configuration;
3246
3247 let local_var_client = &local_var_configuration.client;
3248
3249 let local_var_uri_str = format!(
3250 "{}/vault/accounts/{vaultAccountId}/{assetId}/balance",
3251 local_var_configuration.base_path,
3252 vaultAccountId = crate::apis::urlencode(vault_account_id),
3253 assetId = crate::apis::urlencode(asset_id)
3254 );
3255 let mut local_var_req_builder =
3256 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
3257
3258 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3259 local_var_req_builder = local_var_req_builder
3260 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3261 }
3262 if let Some(local_var_param_value) = idempotency_key {
3263 local_var_req_builder =
3264 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
3265 }
3266
3267 let local_var_req = local_var_req_builder.build()?;
3268 let local_var_resp = local_var_client.execute(local_var_req).await?;
3269
3270 let local_var_status = local_var_resp.status();
3271 let local_var_content_type = local_var_resp
3272 .headers()
3273 .get("content-type")
3274 .and_then(|v| v.to_str().ok())
3275 .unwrap_or("application/octet-stream");
3276 let local_var_content_type = super::ContentType::from(local_var_content_type);
3277 let local_var_content = local_var_resp.text().await?;
3278
3279 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3280 match local_var_content_type {
3281 ContentType::Json => {
3282 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
3283 }
3284 ContentType::Text => {
3285 return Err(Error::from(serde_json::Error::custom(
3286 "Received `text/plain` content type response that cannot be converted to \
3287 `models::VaultAsset`",
3288 )));
3289 }
3290 ContentType::Unsupported(local_var_unknown_type) => {
3291 return Err(Error::from(serde_json::Error::custom(format!(
3292 "Received `{local_var_unknown_type}` content type response that cannot be \
3293 converted to `models::VaultAsset`"
3294 ))));
3295 }
3296 }
3297 } else {
3298 let local_var_entity: Option<UpdateVaultAccountAssetBalanceError> =
3299 serde_json::from_str(&local_var_content).ok();
3300 let local_var_error = ResponseContent {
3301 status: local_var_status,
3302 content: local_var_content,
3303 entity: local_var_entity,
3304 };
3305 Err(Error::ResponseError(local_var_error))
3306 }
3307 }
3308}
3309
3310#[derive(Debug, Clone, Serialize, Deserialize)]
3313#[serde(untagged)]
3314pub enum ActivateAssetForVaultAccountError {
3315 DefaultResponse(models::ErrorSchema),
3316 UnknownValue(serde_json::Value),
3317}
3318
3319#[derive(Debug, Clone, Serialize, Deserialize)]
3322#[serde(untagged)]
3323pub enum AttachOrDetachTagsFromVaultAccountsError {
3324 Status400(models::ErrorSchema),
3325 Status404(models::ErrorSchema),
3326 UnknownValue(serde_json::Value),
3327}
3328
3329#[derive(Debug, Clone, Serialize, Deserialize)]
3332#[serde(untagged)]
3333pub enum AttachTagsToVaultAccountsError {
3334 UnknownValue(serde_json::Value),
3335}
3336
3337#[derive(Debug, Clone, Serialize, Deserialize)]
3339#[serde(untagged)]
3340pub enum CreateLegacyAddressError {
3341 DefaultResponse(models::ErrorSchema),
3342 UnknownValue(serde_json::Value),
3343}
3344
3345#[derive(Debug, Clone, Serialize, Deserialize)]
3347#[serde(untagged)]
3348pub enum CreateMultipleAccountsError {
3349 DefaultResponse(models::ErrorSchema),
3350 UnknownValue(serde_json::Value),
3351}
3352
3353#[derive(Debug, Clone, Serialize, Deserialize)]
3356#[serde(untagged)]
3357pub enum CreateMultipleDepositAddressesError {
3358 DefaultResponse(models::ErrorSchema),
3359 UnknownValue(serde_json::Value),
3360}
3361
3362#[derive(Debug, Clone, Serialize, Deserialize)]
3364#[serde(untagged)]
3365pub enum CreateVaultAccountError {
3366 DefaultResponse(models::ErrorSchema),
3367 UnknownValue(serde_json::Value),
3368}
3369
3370#[derive(Debug, Clone, Serialize, Deserialize)]
3372#[serde(untagged)]
3373pub enum CreateVaultAccountAssetError {
3374 DefaultResponse(models::ErrorSchema),
3375 UnknownValue(serde_json::Value),
3376}
3377
3378#[derive(Debug, Clone, Serialize, Deserialize)]
3381#[serde(untagged)]
3382pub enum CreateVaultAccountAssetAddressError {
3383 DefaultResponse(models::ErrorSchema),
3384 UnknownValue(serde_json::Value),
3385}
3386
3387#[derive(Debug, Clone, Serialize, Deserialize)]
3390#[serde(untagged)]
3391pub enum DetachTagsFromVaultAccountsError {
3392 UnknownValue(serde_json::Value),
3393}
3394
3395#[derive(Debug, Clone, Serialize, Deserialize)]
3397#[serde(untagged)]
3398pub enum GetAssetWalletsError {
3399 UnknownValue(serde_json::Value),
3400}
3401
3402#[derive(Debug, Clone, Serialize, Deserialize)]
3405#[serde(untagged)]
3406pub enum GetCreateMultipleDepositAddressesJobStatusError {
3407 DefaultResponse(models::ErrorSchema),
3408 UnknownValue(serde_json::Value),
3409}
3410
3411#[derive(Debug, Clone, Serialize, Deserialize)]
3414#[serde(untagged)]
3415pub enum GetCreateMultipleVaultAccountsJobStatusError {
3416 DefaultResponse(models::ErrorSchema),
3417 UnknownValue(serde_json::Value),
3418}
3419
3420#[derive(Debug, Clone, Serialize, Deserialize)]
3422#[serde(untagged)]
3423pub enum GetMaxSpendableAmountError {
3424 DefaultResponse(models::ErrorSchema),
3425 UnknownValue(serde_json::Value),
3426}
3427
3428#[derive(Debug, Clone, Serialize, Deserialize)]
3430#[serde(untagged)]
3431pub enum GetPagedVaultAccountsError {
3432 UnknownValue(serde_json::Value),
3433}
3434
3435#[derive(Debug, Clone, Serialize, Deserialize)]
3437#[serde(untagged)]
3438pub enum GetPublicKeyInfoError {
3439 DefaultResponse(models::ErrorSchema),
3440 UnknownValue(serde_json::Value),
3441}
3442
3443#[derive(Debug, Clone, Serialize, Deserialize)]
3446#[serde(untagged)]
3447pub enum GetPublicKeyInfoForAddressError {
3448 DefaultResponse(models::ErrorSchema),
3449 UnknownValue(serde_json::Value),
3450}
3451
3452#[derive(Debug, Clone, Serialize, Deserialize)]
3454#[serde(untagged)]
3455pub enum GetUnspentInputsError {
3456 DefaultResponse(models::ErrorSchema),
3457 UnknownValue(serde_json::Value),
3458}
3459
3460#[derive(Debug, Clone, Serialize, Deserialize)]
3462#[serde(untagged)]
3463pub enum GetVaultAccountError {
3464 DefaultResponse(models::ErrorSchema),
3465 UnknownValue(serde_json::Value),
3466}
3467
3468#[derive(Debug, Clone, Serialize, Deserialize)]
3470#[serde(untagged)]
3471pub enum GetVaultAccountAssetError {
3472 DefaultResponse(models::ErrorSchema),
3473 UnknownValue(serde_json::Value),
3474}
3475
3476#[derive(Debug, Clone, Serialize, Deserialize)]
3479#[serde(untagged)]
3480pub enum GetVaultAccountAssetAddressesError {
3481 DefaultResponse(models::ErrorSchema),
3482 UnknownValue(serde_json::Value),
3483}
3484
3485#[derive(Debug, Clone, Serialize, Deserialize)]
3488#[serde(untagged)]
3489pub enum GetVaultAccountAssetAddressesPaginatedError {
3490 DefaultResponse(models::ErrorSchema),
3491 UnknownValue(serde_json::Value),
3492}
3493
3494#[derive(Debug, Clone, Serialize, Deserialize)]
3496#[serde(untagged)]
3497pub enum GetVaultAssetsError {
3498 DefaultResponse(models::ErrorSchema),
3499 UnknownValue(serde_json::Value),
3500}
3501
3502#[derive(Debug, Clone, Serialize, Deserialize)]
3504#[serde(untagged)]
3505pub enum GetVaultBalanceByAssetError {
3506 DefaultResponse(models::ErrorSchema),
3507 UnknownValue(serde_json::Value),
3508}
3509
3510#[derive(Debug, Clone, Serialize, Deserialize)]
3512#[serde(untagged)]
3513pub enum HideVaultAccountError {
3514 DefaultResponse(models::ErrorSchema),
3515 UnknownValue(serde_json::Value),
3516}
3517
3518#[derive(Debug, Clone, Serialize, Deserialize)]
3521#[serde(untagged)]
3522pub enum SetCustomerRefIdForAddressError {
3523 DefaultResponse(models::ErrorSchema),
3524 UnknownValue(serde_json::Value),
3525}
3526
3527#[derive(Debug, Clone, Serialize, Deserialize)]
3529#[serde(untagged)]
3530pub enum SetVaultAccountAutoFuelError {
3531 DefaultResponse(models::ErrorSchema),
3532 UnknownValue(serde_json::Value),
3533}
3534
3535#[derive(Debug, Clone, Serialize, Deserialize)]
3538#[serde(untagged)]
3539pub enum SetVaultAccountCustomerRefIdError {
3540 DefaultResponse(models::ErrorSchema),
3541 UnknownValue(serde_json::Value),
3542}
3543
3544#[derive(Debug, Clone, Serialize, Deserialize)]
3546#[serde(untagged)]
3547pub enum UnhideVaultAccountError {
3548 DefaultResponse(models::ErrorSchema),
3549 UnknownValue(serde_json::Value),
3550}
3551
3552#[derive(Debug, Clone, Serialize, Deserialize)]
3554#[serde(untagged)]
3555pub enum UpdateVaultAccountError {
3556 DefaultResponse(models::ErrorSchema),
3557 UnknownValue(serde_json::Value),
3558}
3559
3560#[derive(Debug, Clone, Serialize, Deserialize)]
3563#[serde(untagged)]
3564pub enum UpdateVaultAccountAssetAddressError {
3565 DefaultResponse(models::ErrorSchema),
3566 UnknownValue(serde_json::Value),
3567}
3568
3569#[derive(Debug, Clone, Serialize, Deserialize)]
3572#[serde(untagged)]
3573pub enum UpdateVaultAccountAssetBalanceError {
3574 DefaultResponse(models::ErrorSchema),
3575 UnknownValue(serde_json::Value),
3576}