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_tags_to_vault_accounts(
38 &self,
39 params: AttachTagsToVaultAccountsParams,
40 ) -> Result<(), Error<AttachTagsToVaultAccountsError>>;
41
42 async fn create_legacy_address(
48 &self,
49 params: CreateLegacyAddressParams,
50 ) -> Result<models::CreateAddressResponse, Error<CreateLegacyAddressError>>;
51
52 async fn create_multiple_accounts(
59 &self,
60 params: CreateMultipleAccountsParams,
61 ) -> Result<models::JobCreated, Error<CreateMultipleAccountsError>>;
62
63 async fn create_multiple_deposit_addresses(
72 &self,
73 params: CreateMultipleDepositAddressesParams,
74 ) -> Result<models::JobCreated, Error<CreateMultipleDepositAddressesError>>;
75
76 async fn create_vault_account(
80 &self,
81 params: CreateVaultAccountParams,
82 ) -> Result<models::VaultAccount, Error<CreateVaultAccountError>>;
83
84 async fn create_vault_account_asset(
88 &self,
89 params: CreateVaultAccountAssetParams,
90 ) -> Result<models::CreateVaultAssetResponse, Error<CreateVaultAccountAssetError>>;
91
92 async fn create_vault_account_asset_address(
99 &self,
100 params: CreateVaultAccountAssetAddressParams,
101 ) -> Result<models::CreateAddressResponse, Error<CreateVaultAccountAssetAddressError>>;
102
103 async fn detach_tags_from_vault_accounts(
107 &self,
108 params: DetachTagsFromVaultAccountsParams,
109 ) -> Result<(), Error<DetachTagsFromVaultAccountsError>>;
110
111 async fn get_asset_wallets(
118 &self,
119 params: GetAssetWalletsParams,
120 ) -> Result<models::PaginatedAssetWalletResponse, Error<GetAssetWalletsError>>;
121
122 async fn get_create_multiple_deposit_addresses_job_status(
128 &self,
129 params: GetCreateMultipleDepositAddressesJobStatusParams,
130 ) -> Result<
131 models::CreateMultipleDepositAddressesJobStatus,
132 Error<GetCreateMultipleDepositAddressesJobStatusError>,
133 >;
134
135 async fn get_create_multiple_vault_accounts_job_status(
141 &self,
142 params: GetCreateMultipleVaultAccountsJobStatusParams,
143 ) -> Result<
144 models::CreateMultipleVaultAccountsJobStatus,
145 Error<GetCreateMultipleVaultAccountsJobStatusError>,
146 >;
147
148 async fn get_max_spendable_amount(
155 &self,
156 params: GetMaxSpendableAmountParams,
157 ) -> Result<models::GetMaxSpendableAmountResponse, Error<GetMaxSpendableAmountError>>;
158
159 async fn get_paged_vault_accounts(
165 &self,
166 params: GetPagedVaultAccountsParams,
167 ) -> Result<models::VaultAccountsPagedResponse, Error<GetPagedVaultAccountsError>>;
168
169 async fn get_public_key_info(
174 &self,
175 params: GetPublicKeyInfoParams,
176 ) -> Result<models::PublicKeyInformation, Error<GetPublicKeyInfoError>>;
177
178 async fn get_public_key_info_for_address(
184 &self,
185 params: GetPublicKeyInfoForAddressParams,
186 ) -> Result<models::PublicKeyInformation, Error<GetPublicKeyInfoForAddressError>>;
187
188 async fn get_unspent_inputs(
194 &self,
195 params: GetUnspentInputsParams,
196 ) -> Result<Vec<models::UnspentInputsResponse>, Error<GetUnspentInputsError>>;
197
198 async fn get_vault_account(
203 &self,
204 params: GetVaultAccountParams,
205 ) -> Result<models::VaultAccount, Error<GetVaultAccountError>>;
206
207 async fn get_vault_account_asset(
213 &self,
214 params: GetVaultAccountAssetParams,
215 ) -> Result<models::VaultAsset, Error<GetVaultAccountAssetError>>;
216
217 async fn get_vault_account_asset_addresses(
231 &self,
232 params: GetVaultAccountAssetAddressesParams,
233 ) -> Result<Vec<models::VaultWalletAddress>, Error<GetVaultAccountAssetAddressesError>>;
234
235 async fn get_vault_account_asset_addresses_paginated(
241 &self,
242 params: GetVaultAccountAssetAddressesPaginatedParams,
243 ) -> Result<models::PaginatedAddressResponse, Error<GetVaultAccountAssetAddressesPaginatedError>>;
244
245 async fn get_vault_assets(
251 &self,
252 params: GetVaultAssetsParams,
253 ) -> Result<Vec<models::VaultAsset>, Error<GetVaultAssetsError>>;
254
255 async fn get_vault_balance_by_asset(
261 &self,
262 params: GetVaultBalanceByAssetParams,
263 ) -> Result<models::VaultAsset, Error<GetVaultBalanceByAssetError>>;
264
265 async fn hide_vault_account(
269 &self,
270 params: HideVaultAccountParams,
271 ) -> Result<models::VaultActionStatus, Error<HideVaultAccountError>>;
272
273 async fn set_customer_ref_id_for_address(
279 &self,
280 params: SetCustomerRefIdForAddressParams,
281 ) -> Result<models::VaultActionStatus, Error<SetCustomerRefIdForAddressError>>;
282
283 async fn set_vault_account_auto_fuel(
287 &self,
288 params: SetVaultAccountAutoFuelParams,
289 ) -> Result<models::VaultActionStatus, Error<SetVaultAccountAutoFuelError>>;
290
291 async fn set_vault_account_customer_ref_id(
295 &self,
296 params: SetVaultAccountCustomerRefIdParams,
297 ) -> Result<models::VaultActionStatus, Error<SetVaultAccountCustomerRefIdError>>;
298
299 async fn unhide_vault_account(
304 &self,
305 params: UnhideVaultAccountParams,
306 ) -> Result<models::VaultActionStatus, Error<UnhideVaultAccountError>>;
307
308 async fn update_vault_account(
313 &self,
314 params: UpdateVaultAccountParams,
315 ) -> Result<models::RenameVaultAccountResponse, Error<UpdateVaultAccountError>>;
316
317 async fn update_vault_account_asset_address(
323 &self,
324 params: UpdateVaultAccountAssetAddressParams,
325 ) -> Result<models::VaultActionStatus, Error<UpdateVaultAccountAssetAddressError>>;
326
327 async fn update_vault_account_asset_balance(
334 &self,
335 params: UpdateVaultAccountAssetBalanceParams,
336 ) -> Result<models::VaultAsset, Error<UpdateVaultAccountAssetBalanceError>>;
337}
338
339pub struct VaultsApiClient {
340 configuration: Arc<configuration::Configuration>,
341}
342
343impl VaultsApiClient {
344 pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
345 Self { configuration }
346 }
347}
348
349#[derive(Clone, Debug)]
352#[cfg_attr(feature = "bon", derive(::bon::Builder))]
353pub struct ActivateAssetForVaultAccountParams {
354 pub vault_account_id: String,
356 pub asset_id: String,
358 pub idempotency_key: Option<String>,
363}
364
365#[derive(Clone, Debug)]
368#[cfg_attr(feature = "bon", derive(::bon::Builder))]
369pub struct AttachTagsToVaultAccountsParams {
370 pub vault_accounts_tag_attachments_request: models::VaultAccountsTagAttachmentsRequest,
371 pub idempotency_key: Option<String>,
376}
377
378#[derive(Clone, Debug)]
381#[cfg_attr(feature = "bon", derive(::bon::Builder))]
382pub struct CreateLegacyAddressParams {
383 pub vault_account_id: String,
385 pub asset_id: String,
387 pub address_id: String,
389 pub idempotency_key: Option<String>,
394}
395
396#[derive(Clone, Debug)]
399#[cfg_attr(feature = "bon", derive(::bon::Builder))]
400pub struct CreateMultipleAccountsParams {
401 pub create_multiple_accounts_request: models::CreateMultipleAccountsRequest,
402 pub idempotency_key: Option<String>,
407}
408
409#[derive(Clone, Debug)]
412#[cfg_attr(feature = "bon", derive(::bon::Builder))]
413pub struct CreateMultipleDepositAddressesParams {
414 pub create_multiple_deposit_addresses_request: models::CreateMultipleDepositAddressesRequest,
415 pub idempotency_key: Option<String>,
420}
421
422#[derive(Clone, Debug)]
425#[cfg_attr(feature = "bon", derive(::bon::Builder))]
426pub struct CreateVaultAccountParams {
427 pub create_vault_account_request: models::CreateVaultAccountRequest,
428 pub idempotency_key: Option<String>,
433}
434
435#[derive(Clone, Debug)]
438#[cfg_attr(feature = "bon", derive(::bon::Builder))]
439pub struct CreateVaultAccountAssetParams {
440 pub vault_account_id: String,
443 pub asset_id: String,
445 pub idempotency_key: Option<String>,
450 pub create_assets_request: Option<models::CreateAssetsRequest>,
451}
452
453#[derive(Clone, Debug)]
456#[cfg_attr(feature = "bon", derive(::bon::Builder))]
457pub struct CreateVaultAccountAssetAddressParams {
458 pub vault_account_id: String,
460 pub asset_id: String,
462 pub idempotency_key: Option<String>,
467 pub create_address_request: Option<models::CreateAddressRequest>,
468}
469
470#[derive(Clone, Debug)]
473#[cfg_attr(feature = "bon", derive(::bon::Builder))]
474pub struct DetachTagsFromVaultAccountsParams {
475 pub vault_accounts_tag_attachments_request: models::VaultAccountsTagAttachmentsRequest,
476 pub idempotency_key: Option<String>,
481}
482
483#[derive(Clone, Debug)]
485#[cfg_attr(feature = "bon", derive(::bon::Builder))]
486pub struct GetAssetWalletsParams {
487 pub total_amount_larger_than: Option<f64>,
490 pub asset_id: Option<String>,
492 pub order_by: Option<String>,
493 pub before: Option<String>,
496 pub after: Option<String>,
499 pub limit: Option<f64>,
502}
503
504#[derive(Clone, Debug)]
507#[cfg_attr(feature = "bon", derive(::bon::Builder))]
508pub struct GetCreateMultipleDepositAddressesJobStatusParams {
509 pub job_id: String,
511}
512
513#[derive(Clone, Debug)]
516#[cfg_attr(feature = "bon", derive(::bon::Builder))]
517pub struct GetCreateMultipleVaultAccountsJobStatusParams {
518 pub job_id: String,
520}
521
522#[derive(Clone, Debug)]
525#[cfg_attr(feature = "bon", derive(::bon::Builder))]
526pub struct GetMaxSpendableAmountParams {
527 pub vault_account_id: String,
529 pub asset_id: String,
531 pub manual_signing: Option<bool>,
535}
536
537#[derive(Clone, Debug)]
540#[cfg_attr(feature = "bon", derive(::bon::Builder))]
541pub struct GetPagedVaultAccountsParams {
542 pub name_prefix: Option<String>,
543 pub name_suffix: Option<String>,
544 pub min_amount_threshold: Option<f64>,
548 pub asset_id: Option<String>,
549 pub order_by: Option<String>,
550 pub before: Option<String>,
551 pub after: Option<String>,
552 pub limit: Option<f64>,
553 pub tag_ids: Option<Vec<uuid::Uuid>>,
555}
556
557#[derive(Clone, Debug)]
560#[cfg_attr(feature = "bon", derive(::bon::Builder))]
561pub struct GetPublicKeyInfoParams {
562 pub derivation_path: Vec<i32>,
565 pub algorithm: String,
566 pub compressed: Option<bool>,
567}
568
569#[derive(Clone, Debug)]
572#[cfg_attr(feature = "bon", derive(::bon::Builder))]
573pub struct GetPublicKeyInfoForAddressParams {
574 pub vault_account_id: String,
575 pub asset_id: String,
576 pub change: f64,
578 pub address_index: f64,
580 pub compressed: Option<bool>,
582}
583
584#[derive(Clone, Debug)]
587#[cfg_attr(feature = "bon", derive(::bon::Builder))]
588pub struct GetUnspentInputsParams {
589 pub vault_account_id: String,
591 pub asset_id: String,
593}
594
595#[derive(Clone, Debug)]
597#[cfg_attr(feature = "bon", derive(::bon::Builder))]
598pub struct GetVaultAccountParams {
599 pub vault_account_id: String,
601}
602
603#[derive(Clone, Debug)]
606#[cfg_attr(feature = "bon", derive(::bon::Builder))]
607pub struct GetVaultAccountAssetParams {
608 pub vault_account_id: String,
610 pub asset_id: String,
612}
613
614#[derive(Clone, Debug)]
617#[cfg_attr(feature = "bon", derive(::bon::Builder))]
618pub struct GetVaultAccountAssetAddressesParams {
619 pub vault_account_id: String,
621 pub asset_id: String,
623}
624
625#[derive(Clone, Debug)]
628#[cfg_attr(feature = "bon", derive(::bon::Builder))]
629pub struct GetVaultAccountAssetAddressesPaginatedParams {
630 pub vault_account_id: String,
632 pub asset_id: String,
634 pub limit: Option<f64>,
636 pub before: Option<String>,
638 pub after: Option<String>,
640}
641
642#[derive(Clone, Debug)]
644#[cfg_attr(feature = "bon", derive(::bon::Builder))]
645pub struct GetVaultAssetsParams {
646 pub account_name_prefix: Option<String>,
647 pub account_name_suffix: Option<String>,
648}
649
650#[derive(Clone, Debug)]
653#[cfg_attr(feature = "bon", derive(::bon::Builder))]
654pub struct GetVaultBalanceByAssetParams {
655 pub asset_id: String,
656}
657
658#[derive(Clone, Debug)]
661#[cfg_attr(feature = "bon", derive(::bon::Builder))]
662pub struct HideVaultAccountParams {
663 pub vault_account_id: String,
665 pub idempotency_key: Option<String>,
670}
671
672#[derive(Clone, Debug)]
675#[cfg_attr(feature = "bon", derive(::bon::Builder))]
676pub struct SetCustomerRefIdForAddressParams {
677 pub vault_account_id: String,
679 pub asset_id: String,
681 pub address_id: String,
684 pub set_customer_ref_id_for_address_request: models::SetCustomerRefIdForAddressRequest,
685 pub idempotency_key: Option<String>,
690}
691
692#[derive(Clone, Debug)]
695#[cfg_attr(feature = "bon", derive(::bon::Builder))]
696pub struct SetVaultAccountAutoFuelParams {
697 pub vault_account_id: String,
699 pub set_auto_fuel_request: models::SetAutoFuelRequest,
700 pub idempotency_key: Option<String>,
705}
706
707#[derive(Clone, Debug)]
710#[cfg_attr(feature = "bon", derive(::bon::Builder))]
711pub struct SetVaultAccountCustomerRefIdParams {
712 pub vault_account_id: String,
714 pub set_customer_ref_id_request: models::SetCustomerRefIdRequest,
715 pub idempotency_key: Option<String>,
720}
721
722#[derive(Clone, Debug)]
725#[cfg_attr(feature = "bon", derive(::bon::Builder))]
726pub struct UnhideVaultAccountParams {
727 pub vault_account_id: String,
729 pub idempotency_key: Option<String>,
734}
735
736#[derive(Clone, Debug)]
739#[cfg_attr(feature = "bon", derive(::bon::Builder))]
740pub struct UpdateVaultAccountParams {
741 pub vault_account_id: String,
743 pub update_vault_account_request: models::UpdateVaultAccountRequest,
744 pub idempotency_key: Option<String>,
749}
750
751#[derive(Clone, Debug)]
754#[cfg_attr(feature = "bon", derive(::bon::Builder))]
755pub struct UpdateVaultAccountAssetAddressParams {
756 pub vault_account_id: String,
758 pub asset_id: String,
760 pub address_id: String,
763 pub idempotency_key: Option<String>,
768 pub update_vault_account_asset_address_request:
769 Option<models::UpdateVaultAccountAssetAddressRequest>,
770}
771
772#[derive(Clone, Debug)]
775#[cfg_attr(feature = "bon", derive(::bon::Builder))]
776pub struct UpdateVaultAccountAssetBalanceParams {
777 pub vault_account_id: String,
779 pub asset_id: String,
781 pub idempotency_key: Option<String>,
786}
787
788#[async_trait]
789impl VaultsApi for VaultsApiClient {
790 async fn activate_asset_for_vault_account(
795 &self,
796 params: ActivateAssetForVaultAccountParams,
797 ) -> Result<models::CreateVaultAssetResponse, Error<ActivateAssetForVaultAccountError>> {
798 let ActivateAssetForVaultAccountParams {
799 vault_account_id,
800 asset_id,
801 idempotency_key,
802 } = params;
803
804 let local_var_configuration = &self.configuration;
805
806 let local_var_client = &local_var_configuration.client;
807
808 let local_var_uri_str = format!(
809 "{}/vault/accounts/{vaultAccountId}/{assetId}/activate",
810 local_var_configuration.base_path,
811 vaultAccountId = crate::apis::urlencode(vault_account_id),
812 assetId = crate::apis::urlencode(asset_id)
813 );
814 let mut local_var_req_builder =
815 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
816
817 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
818 local_var_req_builder = local_var_req_builder
819 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
820 }
821 if let Some(local_var_param_value) = idempotency_key {
822 local_var_req_builder =
823 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
824 }
825
826 let local_var_req = local_var_req_builder.build()?;
827 let local_var_resp = local_var_client.execute(local_var_req).await?;
828
829 let local_var_status = local_var_resp.status();
830 let local_var_content_type = local_var_resp
831 .headers()
832 .get("content-type")
833 .and_then(|v| v.to_str().ok())
834 .unwrap_or("application/octet-stream");
835 let local_var_content_type = super::ContentType::from(local_var_content_type);
836 let local_var_content = local_var_resp.text().await?;
837
838 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
839 match local_var_content_type {
840 ContentType::Json => {
841 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
842 }
843 ContentType::Text => {
844 return Err(Error::from(serde_json::Error::custom(
845 "Received `text/plain` content type response that cannot be converted to \
846 `models::CreateVaultAssetResponse`",
847 )));
848 }
849 ContentType::Unsupported(local_var_unknown_type) => {
850 return Err(Error::from(serde_json::Error::custom(format!(
851 "Received `{local_var_unknown_type}` content type response that cannot be \
852 converted to `models::CreateVaultAssetResponse`"
853 ))));
854 }
855 }
856 } else {
857 let local_var_entity: Option<ActivateAssetForVaultAccountError> =
858 serde_json::from_str(&local_var_content).ok();
859 let local_var_error = ResponseContent {
860 status: local_var_status,
861 content: local_var_content,
862 entity: local_var_entity,
863 };
864 Err(Error::ResponseError(local_var_error))
865 }
866 }
867
868 async fn attach_tags_to_vault_accounts(
870 &self,
871 params: AttachTagsToVaultAccountsParams,
872 ) -> Result<(), Error<AttachTagsToVaultAccountsError>> {
873 let AttachTagsToVaultAccountsParams {
874 vault_accounts_tag_attachments_request,
875 idempotency_key,
876 } = params;
877
878 let local_var_configuration = &self.configuration;
879
880 let local_var_client = &local_var_configuration.client;
881
882 let local_var_uri_str = format!(
883 "{}/vault/accounts/attached/tags/attach",
884 local_var_configuration.base_path
885 );
886 let mut local_var_req_builder =
887 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
888
889 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
890 local_var_req_builder = local_var_req_builder
891 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
892 }
893 if let Some(local_var_param_value) = idempotency_key {
894 local_var_req_builder =
895 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
896 }
897 local_var_req_builder = local_var_req_builder.json(&vault_accounts_tag_attachments_request);
898
899 let local_var_req = local_var_req_builder.build()?;
900 let local_var_resp = local_var_client.execute(local_var_req).await?;
901
902 let local_var_status = local_var_resp.status();
903 let local_var_content = local_var_resp.text().await?;
904
905 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
906 Ok(())
907 } else {
908 let local_var_entity: Option<AttachTagsToVaultAccountsError> =
909 serde_json::from_str(&local_var_content).ok();
910 let local_var_error = ResponseContent {
911 status: local_var_status,
912 content: local_var_content,
913 entity: local_var_entity,
914 };
915 Err(Error::ResponseError(local_var_error))
916 }
917 }
918
919 async fn create_legacy_address(
922 &self,
923 params: CreateLegacyAddressParams,
924 ) -> Result<models::CreateAddressResponse, Error<CreateLegacyAddressError>> {
925 let CreateLegacyAddressParams {
926 vault_account_id,
927 asset_id,
928 address_id,
929 idempotency_key,
930 } = params;
931
932 let local_var_configuration = &self.configuration;
933
934 let local_var_client = &local_var_configuration.client;
935
936 let local_var_uri_str = format!(
937 "{}/vault/accounts/{vaultAccountId}/{assetId}/addresses/{addressId}/create_legacy",
938 local_var_configuration.base_path,
939 vaultAccountId = crate::apis::urlencode(vault_account_id),
940 assetId = crate::apis::urlencode(asset_id),
941 addressId = crate::apis::urlencode(address_id)
942 );
943 let mut local_var_req_builder =
944 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
945
946 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
947 local_var_req_builder = local_var_req_builder
948 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
949 }
950 if let Some(local_var_param_value) = idempotency_key {
951 local_var_req_builder =
952 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
953 }
954
955 let local_var_req = local_var_req_builder.build()?;
956 let local_var_resp = local_var_client.execute(local_var_req).await?;
957
958 let local_var_status = local_var_resp.status();
959 let local_var_content_type = local_var_resp
960 .headers()
961 .get("content-type")
962 .and_then(|v| v.to_str().ok())
963 .unwrap_or("application/octet-stream");
964 let local_var_content_type = super::ContentType::from(local_var_content_type);
965 let local_var_content = local_var_resp.text().await?;
966
967 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
968 match local_var_content_type {
969 ContentType::Json => {
970 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
971 }
972 ContentType::Text => {
973 return Err(Error::from(serde_json::Error::custom(
974 "Received `text/plain` content type response that cannot be converted to \
975 `models::CreateAddressResponse`",
976 )));
977 }
978 ContentType::Unsupported(local_var_unknown_type) => {
979 return Err(Error::from(serde_json::Error::custom(format!(
980 "Received `{local_var_unknown_type}` content type response that cannot be \
981 converted to `models::CreateAddressResponse`"
982 ))));
983 }
984 }
985 } else {
986 let local_var_entity: Option<CreateLegacyAddressError> =
987 serde_json::from_str(&local_var_content).ok();
988 let local_var_error = ResponseContent {
989 status: local_var_status,
990 content: local_var_content,
991 entity: local_var_entity,
992 };
993 Err(Error::ResponseError(local_var_error))
994 }
995 }
996
997 async fn create_multiple_accounts(
1002 &self,
1003 params: CreateMultipleAccountsParams,
1004 ) -> Result<models::JobCreated, Error<CreateMultipleAccountsError>> {
1005 let CreateMultipleAccountsParams {
1006 create_multiple_accounts_request,
1007 idempotency_key,
1008 } = params;
1009
1010 let local_var_configuration = &self.configuration;
1011
1012 let local_var_client = &local_var_configuration.client;
1013
1014 let local_var_uri_str =
1015 format!("{}/vault/accounts/bulk/", local_var_configuration.base_path);
1016 let mut local_var_req_builder =
1017 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1018
1019 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1020 local_var_req_builder = local_var_req_builder
1021 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1022 }
1023 if let Some(local_var_param_value) = idempotency_key {
1024 local_var_req_builder =
1025 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
1026 }
1027 local_var_req_builder = local_var_req_builder.json(&create_multiple_accounts_request);
1028
1029 let local_var_req = local_var_req_builder.build()?;
1030 let local_var_resp = local_var_client.execute(local_var_req).await?;
1031
1032 let local_var_status = local_var_resp.status();
1033 let local_var_content_type = local_var_resp
1034 .headers()
1035 .get("content-type")
1036 .and_then(|v| v.to_str().ok())
1037 .unwrap_or("application/octet-stream");
1038 let local_var_content_type = super::ContentType::from(local_var_content_type);
1039 let local_var_content = local_var_resp.text().await?;
1040
1041 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1042 match local_var_content_type {
1043 ContentType::Json => {
1044 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1045 }
1046 ContentType::Text => {
1047 return Err(Error::from(serde_json::Error::custom(
1048 "Received `text/plain` content type response that cannot be converted to \
1049 `models::JobCreated`",
1050 )));
1051 }
1052 ContentType::Unsupported(local_var_unknown_type) => {
1053 return Err(Error::from(serde_json::Error::custom(format!(
1054 "Received `{local_var_unknown_type}` content type response that cannot be \
1055 converted to `models::JobCreated`"
1056 ))));
1057 }
1058 }
1059 } else {
1060 let local_var_entity: Option<CreateMultipleAccountsError> =
1061 serde_json::from_str(&local_var_content).ok();
1062 let local_var_error = ResponseContent {
1063 status: local_var_status,
1064 content: local_var_content,
1065 entity: local_var_entity,
1066 };
1067 Err(Error::ResponseError(local_var_error))
1068 }
1069 }
1070
1071 async fn create_multiple_deposit_addresses(
1078 &self,
1079 params: CreateMultipleDepositAddressesParams,
1080 ) -> Result<models::JobCreated, Error<CreateMultipleDepositAddressesError>> {
1081 let CreateMultipleDepositAddressesParams {
1082 create_multiple_deposit_addresses_request,
1083 idempotency_key,
1084 } = params;
1085
1086 let local_var_configuration = &self.configuration;
1087
1088 let local_var_client = &local_var_configuration.client;
1089
1090 let local_var_uri_str = format!(
1091 "{}/vault/accounts/addresses/bulk",
1092 local_var_configuration.base_path
1093 );
1094 let mut local_var_req_builder =
1095 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1096
1097 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1098 local_var_req_builder = local_var_req_builder
1099 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1100 }
1101 if let Some(local_var_param_value) = idempotency_key {
1102 local_var_req_builder =
1103 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
1104 }
1105 local_var_req_builder =
1106 local_var_req_builder.json(&create_multiple_deposit_addresses_request);
1107
1108 let local_var_req = local_var_req_builder.build()?;
1109 let local_var_resp = local_var_client.execute(local_var_req).await?;
1110
1111 let local_var_status = local_var_resp.status();
1112 let local_var_content_type = local_var_resp
1113 .headers()
1114 .get("content-type")
1115 .and_then(|v| v.to_str().ok())
1116 .unwrap_or("application/octet-stream");
1117 let local_var_content_type = super::ContentType::from(local_var_content_type);
1118 let local_var_content = local_var_resp.text().await?;
1119
1120 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1121 match local_var_content_type {
1122 ContentType::Json => {
1123 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1124 }
1125 ContentType::Text => {
1126 return Err(Error::from(serde_json::Error::custom(
1127 "Received `text/plain` content type response that cannot be converted to \
1128 `models::JobCreated`",
1129 )));
1130 }
1131 ContentType::Unsupported(local_var_unknown_type) => {
1132 return Err(Error::from(serde_json::Error::custom(format!(
1133 "Received `{local_var_unknown_type}` content type response that cannot be \
1134 converted to `models::JobCreated`"
1135 ))));
1136 }
1137 }
1138 } else {
1139 let local_var_entity: Option<CreateMultipleDepositAddressesError> =
1140 serde_json::from_str(&local_var_content).ok();
1141 let local_var_error = ResponseContent {
1142 status: local_var_status,
1143 content: local_var_content,
1144 entity: local_var_entity,
1145 };
1146 Err(Error::ResponseError(local_var_error))
1147 }
1148 }
1149
1150 async fn create_vault_account(
1152 &self,
1153 params: CreateVaultAccountParams,
1154 ) -> Result<models::VaultAccount, Error<CreateVaultAccountError>> {
1155 let CreateVaultAccountParams {
1156 create_vault_account_request,
1157 idempotency_key,
1158 } = params;
1159
1160 let local_var_configuration = &self.configuration;
1161
1162 let local_var_client = &local_var_configuration.client;
1163
1164 let local_var_uri_str = format!("{}/vault/accounts", local_var_configuration.base_path);
1165 let mut local_var_req_builder =
1166 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1167
1168 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1169 local_var_req_builder = local_var_req_builder
1170 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1171 }
1172 if let Some(local_var_param_value) = idempotency_key {
1173 local_var_req_builder =
1174 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
1175 }
1176 local_var_req_builder = local_var_req_builder.json(&create_vault_account_request);
1177
1178 let local_var_req = local_var_req_builder.build()?;
1179 let local_var_resp = local_var_client.execute(local_var_req).await?;
1180
1181 let local_var_status = local_var_resp.status();
1182 let local_var_content_type = local_var_resp
1183 .headers()
1184 .get("content-type")
1185 .and_then(|v| v.to_str().ok())
1186 .unwrap_or("application/octet-stream");
1187 let local_var_content_type = super::ContentType::from(local_var_content_type);
1188 let local_var_content = local_var_resp.text().await?;
1189
1190 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1191 match local_var_content_type {
1192 ContentType::Json => {
1193 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1194 }
1195 ContentType::Text => {
1196 return Err(Error::from(serde_json::Error::custom(
1197 "Received `text/plain` content type response that cannot be converted to \
1198 `models::VaultAccount`",
1199 )));
1200 }
1201 ContentType::Unsupported(local_var_unknown_type) => {
1202 return Err(Error::from(serde_json::Error::custom(format!(
1203 "Received `{local_var_unknown_type}` content type response that cannot be \
1204 converted to `models::VaultAccount`"
1205 ))));
1206 }
1207 }
1208 } else {
1209 let local_var_entity: Option<CreateVaultAccountError> =
1210 serde_json::from_str(&local_var_content).ok();
1211 let local_var_error = ResponseContent {
1212 status: local_var_status,
1213 content: local_var_content,
1214 entity: local_var_entity,
1215 };
1216 Err(Error::ResponseError(local_var_error))
1217 }
1218 }
1219
1220 async fn create_vault_account_asset(
1222 &self,
1223 params: CreateVaultAccountAssetParams,
1224 ) -> Result<models::CreateVaultAssetResponse, Error<CreateVaultAccountAssetError>> {
1225 let CreateVaultAccountAssetParams {
1226 vault_account_id,
1227 asset_id,
1228 idempotency_key,
1229 create_assets_request,
1230 } = params;
1231
1232 let local_var_configuration = &self.configuration;
1233
1234 let local_var_client = &local_var_configuration.client;
1235
1236 let local_var_uri_str = format!(
1237 "{}/vault/accounts/{vaultAccountId}/{assetId}",
1238 local_var_configuration.base_path,
1239 vaultAccountId = crate::apis::urlencode(vault_account_id),
1240 assetId = crate::apis::urlencode(asset_id)
1241 );
1242 let mut local_var_req_builder =
1243 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1244
1245 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1246 local_var_req_builder = local_var_req_builder
1247 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1248 }
1249 if let Some(local_var_param_value) = idempotency_key {
1250 local_var_req_builder =
1251 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
1252 }
1253 local_var_req_builder = local_var_req_builder.json(&create_assets_request);
1254
1255 let local_var_req = local_var_req_builder.build()?;
1256 let local_var_resp = local_var_client.execute(local_var_req).await?;
1257
1258 let local_var_status = local_var_resp.status();
1259 let local_var_content_type = local_var_resp
1260 .headers()
1261 .get("content-type")
1262 .and_then(|v| v.to_str().ok())
1263 .unwrap_or("application/octet-stream");
1264 let local_var_content_type = super::ContentType::from(local_var_content_type);
1265 let local_var_content = local_var_resp.text().await?;
1266
1267 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1268 match local_var_content_type {
1269 ContentType::Json => {
1270 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1271 }
1272 ContentType::Text => {
1273 return Err(Error::from(serde_json::Error::custom(
1274 "Received `text/plain` content type response that cannot be converted to \
1275 `models::CreateVaultAssetResponse`",
1276 )));
1277 }
1278 ContentType::Unsupported(local_var_unknown_type) => {
1279 return Err(Error::from(serde_json::Error::custom(format!(
1280 "Received `{local_var_unknown_type}` content type response that cannot be \
1281 converted to `models::CreateVaultAssetResponse`"
1282 ))));
1283 }
1284 }
1285 } else {
1286 let local_var_entity: Option<CreateVaultAccountAssetError> =
1287 serde_json::from_str(&local_var_content).ok();
1288 let local_var_error = ResponseContent {
1289 status: local_var_status,
1290 content: local_var_content,
1291 entity: local_var_entity,
1292 };
1293 Err(Error::ResponseError(local_var_error))
1294 }
1295 }
1296
1297 async fn create_vault_account_asset_address(
1302 &self,
1303 params: CreateVaultAccountAssetAddressParams,
1304 ) -> Result<models::CreateAddressResponse, Error<CreateVaultAccountAssetAddressError>> {
1305 let CreateVaultAccountAssetAddressParams {
1306 vault_account_id,
1307 asset_id,
1308 idempotency_key,
1309 create_address_request,
1310 } = params;
1311
1312 let local_var_configuration = &self.configuration;
1313
1314 let local_var_client = &local_var_configuration.client;
1315
1316 let local_var_uri_str = format!(
1317 "{}/vault/accounts/{vaultAccountId}/{assetId}/addresses",
1318 local_var_configuration.base_path,
1319 vaultAccountId = crate::apis::urlencode(vault_account_id),
1320 assetId = crate::apis::urlencode(asset_id)
1321 );
1322 let mut local_var_req_builder =
1323 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1324
1325 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1326 local_var_req_builder = local_var_req_builder
1327 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1328 }
1329 if let Some(local_var_param_value) = idempotency_key {
1330 local_var_req_builder =
1331 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
1332 }
1333 local_var_req_builder = local_var_req_builder.json(&create_address_request);
1334
1335 let local_var_req = local_var_req_builder.build()?;
1336 let local_var_resp = local_var_client.execute(local_var_req).await?;
1337
1338 let local_var_status = local_var_resp.status();
1339 let local_var_content_type = local_var_resp
1340 .headers()
1341 .get("content-type")
1342 .and_then(|v| v.to_str().ok())
1343 .unwrap_or("application/octet-stream");
1344 let local_var_content_type = super::ContentType::from(local_var_content_type);
1345 let local_var_content = local_var_resp.text().await?;
1346
1347 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1348 match local_var_content_type {
1349 ContentType::Json => {
1350 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1351 }
1352 ContentType::Text => {
1353 return Err(Error::from(serde_json::Error::custom(
1354 "Received `text/plain` content type response that cannot be converted to \
1355 `models::CreateAddressResponse`",
1356 )));
1357 }
1358 ContentType::Unsupported(local_var_unknown_type) => {
1359 return Err(Error::from(serde_json::Error::custom(format!(
1360 "Received `{local_var_unknown_type}` content type response that cannot be \
1361 converted to `models::CreateAddressResponse`"
1362 ))));
1363 }
1364 }
1365 } else {
1366 let local_var_entity: Option<CreateVaultAccountAssetAddressError> =
1367 serde_json::from_str(&local_var_content).ok();
1368 let local_var_error = ResponseContent {
1369 status: local_var_status,
1370 content: local_var_content,
1371 entity: local_var_entity,
1372 };
1373 Err(Error::ResponseError(local_var_error))
1374 }
1375 }
1376
1377 async fn detach_tags_from_vault_accounts(
1379 &self,
1380 params: DetachTagsFromVaultAccountsParams,
1381 ) -> Result<(), Error<DetachTagsFromVaultAccountsError>> {
1382 let DetachTagsFromVaultAccountsParams {
1383 vault_accounts_tag_attachments_request,
1384 idempotency_key,
1385 } = params;
1386
1387 let local_var_configuration = &self.configuration;
1388
1389 let local_var_client = &local_var_configuration.client;
1390
1391 let local_var_uri_str = format!(
1392 "{}/vault/accounts/attached/tags/detached",
1393 local_var_configuration.base_path
1394 );
1395 let mut local_var_req_builder =
1396 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1397
1398 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1399 local_var_req_builder = local_var_req_builder
1400 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1401 }
1402 if let Some(local_var_param_value) = idempotency_key {
1403 local_var_req_builder =
1404 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
1405 }
1406 local_var_req_builder = local_var_req_builder.json(&vault_accounts_tag_attachments_request);
1407
1408 let local_var_req = local_var_req_builder.build()?;
1409 let local_var_resp = local_var_client.execute(local_var_req).await?;
1410
1411 let local_var_status = local_var_resp.status();
1412 let local_var_content = local_var_resp.text().await?;
1413
1414 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1415 Ok(())
1416 } else {
1417 let local_var_entity: Option<DetachTagsFromVaultAccountsError> =
1418 serde_json::from_str(&local_var_content).ok();
1419 let local_var_error = ResponseContent {
1420 status: local_var_status,
1421 content: local_var_content,
1422 entity: local_var_entity,
1423 };
1424 Err(Error::ResponseError(local_var_error))
1425 }
1426 }
1427
1428 async fn get_asset_wallets(
1433 &self,
1434 params: GetAssetWalletsParams,
1435 ) -> Result<models::PaginatedAssetWalletResponse, Error<GetAssetWalletsError>> {
1436 let GetAssetWalletsParams {
1437 total_amount_larger_than,
1438 asset_id,
1439 order_by,
1440 before,
1441 after,
1442 limit,
1443 } = params;
1444
1445 let local_var_configuration = &self.configuration;
1446
1447 let local_var_client = &local_var_configuration.client;
1448
1449 let local_var_uri_str =
1450 format!("{}/vault/asset_wallets", local_var_configuration.base_path);
1451 let mut local_var_req_builder =
1452 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1453
1454 if let Some(ref param_value) = total_amount_larger_than {
1455 local_var_req_builder =
1456 local_var_req_builder.query(&[("totalAmountLargerThan", ¶m_value.to_string())]);
1457 }
1458 if let Some(ref param_value) = asset_id {
1459 local_var_req_builder =
1460 local_var_req_builder.query(&[("assetId", ¶m_value.to_string())]);
1461 }
1462 if let Some(ref param_value) = order_by {
1463 local_var_req_builder =
1464 local_var_req_builder.query(&[("orderBy", ¶m_value.to_string())]);
1465 }
1466 if let Some(ref param_value) = before {
1467 local_var_req_builder =
1468 local_var_req_builder.query(&[("before", ¶m_value.to_string())]);
1469 }
1470 if let Some(ref param_value) = after {
1471 local_var_req_builder =
1472 local_var_req_builder.query(&[("after", ¶m_value.to_string())]);
1473 }
1474 if let Some(ref param_value) = limit {
1475 local_var_req_builder =
1476 local_var_req_builder.query(&[("limit", ¶m_value.to_string())]);
1477 }
1478 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1479 local_var_req_builder = local_var_req_builder
1480 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1481 }
1482
1483 let local_var_req = local_var_req_builder.build()?;
1484 let local_var_resp = local_var_client.execute(local_var_req).await?;
1485
1486 let local_var_status = local_var_resp.status();
1487 let local_var_content_type = local_var_resp
1488 .headers()
1489 .get("content-type")
1490 .and_then(|v| v.to_str().ok())
1491 .unwrap_or("application/octet-stream");
1492 let local_var_content_type = super::ContentType::from(local_var_content_type);
1493 let local_var_content = local_var_resp.text().await?;
1494
1495 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1496 match local_var_content_type {
1497 ContentType::Json => {
1498 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1499 }
1500 ContentType::Text => {
1501 return Err(Error::from(serde_json::Error::custom(
1502 "Received `text/plain` content type response that cannot be converted to \
1503 `models::PaginatedAssetWalletResponse`",
1504 )));
1505 }
1506 ContentType::Unsupported(local_var_unknown_type) => {
1507 return Err(Error::from(serde_json::Error::custom(format!(
1508 "Received `{local_var_unknown_type}` content type response that cannot be \
1509 converted to `models::PaginatedAssetWalletResponse`"
1510 ))));
1511 }
1512 }
1513 } else {
1514 let local_var_entity: Option<GetAssetWalletsError> =
1515 serde_json::from_str(&local_var_content).ok();
1516 let local_var_error = ResponseContent {
1517 status: local_var_status,
1518 content: local_var_content,
1519 entity: local_var_entity,
1520 };
1521 Err(Error::ResponseError(local_var_error))
1522 }
1523 }
1524
1525 async fn get_create_multiple_deposit_addresses_job_status(
1529 &self,
1530 params: GetCreateMultipleDepositAddressesJobStatusParams,
1531 ) -> Result<
1532 models::CreateMultipleDepositAddressesJobStatus,
1533 Error<GetCreateMultipleDepositAddressesJobStatusError>,
1534 > {
1535 let GetCreateMultipleDepositAddressesJobStatusParams { job_id } = params;
1536
1537 let local_var_configuration = &self.configuration;
1538
1539 let local_var_client = &local_var_configuration.client;
1540
1541 let local_var_uri_str = format!(
1542 "{}/vault/accounts/addresses/bulk/{jobId}",
1543 local_var_configuration.base_path,
1544 jobId = crate::apis::urlencode(job_id)
1545 );
1546 let mut local_var_req_builder =
1547 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1548
1549 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1550 local_var_req_builder = local_var_req_builder
1551 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1552 }
1553
1554 let local_var_req = local_var_req_builder.build()?;
1555 let local_var_resp = local_var_client.execute(local_var_req).await?;
1556
1557 let local_var_status = local_var_resp.status();
1558 let local_var_content_type = local_var_resp
1559 .headers()
1560 .get("content-type")
1561 .and_then(|v| v.to_str().ok())
1562 .unwrap_or("application/octet-stream");
1563 let local_var_content_type = super::ContentType::from(local_var_content_type);
1564 let local_var_content = local_var_resp.text().await?;
1565
1566 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1567 match local_var_content_type {
1568 ContentType::Json => {
1569 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1570 }
1571 ContentType::Text => {
1572 return Err(Error::from(serde_json::Error::custom(
1573 "Received `text/plain` content type response that cannot be converted to \
1574 `models::CreateMultipleDepositAddressesJobStatus`",
1575 )));
1576 }
1577 ContentType::Unsupported(local_var_unknown_type) => {
1578 return Err(Error::from(serde_json::Error::custom(format!(
1579 "Received `{local_var_unknown_type}` content type response that cannot be \
1580 converted to `models::CreateMultipleDepositAddressesJobStatus`"
1581 ))));
1582 }
1583 }
1584 } else {
1585 let local_var_entity: Option<GetCreateMultipleDepositAddressesJobStatusError> =
1586 serde_json::from_str(&local_var_content).ok();
1587 let local_var_error = ResponseContent {
1588 status: local_var_status,
1589 content: local_var_content,
1590 entity: local_var_entity,
1591 };
1592 Err(Error::ResponseError(local_var_error))
1593 }
1594 }
1595
1596 async fn get_create_multiple_vault_accounts_job_status(
1600 &self,
1601 params: GetCreateMultipleVaultAccountsJobStatusParams,
1602 ) -> Result<
1603 models::CreateMultipleVaultAccountsJobStatus,
1604 Error<GetCreateMultipleVaultAccountsJobStatusError>,
1605 > {
1606 let GetCreateMultipleVaultAccountsJobStatusParams { job_id } = params;
1607
1608 let local_var_configuration = &self.configuration;
1609
1610 let local_var_client = &local_var_configuration.client;
1611
1612 let local_var_uri_str = format!(
1613 "{}/vault/accounts/bulk/{jobId}",
1614 local_var_configuration.base_path,
1615 jobId = crate::apis::urlencode(job_id)
1616 );
1617 let mut local_var_req_builder =
1618 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1619
1620 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1621 local_var_req_builder = local_var_req_builder
1622 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1623 }
1624
1625 let local_var_req = local_var_req_builder.build()?;
1626 let local_var_resp = local_var_client.execute(local_var_req).await?;
1627
1628 let local_var_status = local_var_resp.status();
1629 let local_var_content_type = local_var_resp
1630 .headers()
1631 .get("content-type")
1632 .and_then(|v| v.to_str().ok())
1633 .unwrap_or("application/octet-stream");
1634 let local_var_content_type = super::ContentType::from(local_var_content_type);
1635 let local_var_content = local_var_resp.text().await?;
1636
1637 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1638 match local_var_content_type {
1639 ContentType::Json => {
1640 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1641 }
1642 ContentType::Text => {
1643 return Err(Error::from(serde_json::Error::custom(
1644 "Received `text/plain` content type response that cannot be converted to \
1645 `models::CreateMultipleVaultAccountsJobStatus`",
1646 )));
1647 }
1648 ContentType::Unsupported(local_var_unknown_type) => {
1649 return Err(Error::from(serde_json::Error::custom(format!(
1650 "Received `{local_var_unknown_type}` content type response that cannot be \
1651 converted to `models::CreateMultipleVaultAccountsJobStatus`"
1652 ))));
1653 }
1654 }
1655 } else {
1656 let local_var_entity: Option<GetCreateMultipleVaultAccountsJobStatusError> =
1657 serde_json::from_str(&local_var_content).ok();
1658 let local_var_error = ResponseContent {
1659 status: local_var_status,
1660 content: local_var_content,
1661 entity: local_var_entity,
1662 };
1663 Err(Error::ResponseError(local_var_error))
1664 }
1665 }
1666
1667 async fn get_max_spendable_amount(
1672 &self,
1673 params: GetMaxSpendableAmountParams,
1674 ) -> Result<models::GetMaxSpendableAmountResponse, Error<GetMaxSpendableAmountError>> {
1675 let GetMaxSpendableAmountParams {
1676 vault_account_id,
1677 asset_id,
1678 manual_signing,
1679 } = params;
1680
1681 let local_var_configuration = &self.configuration;
1682
1683 let local_var_client = &local_var_configuration.client;
1684
1685 let local_var_uri_str = format!(
1686 "{}/vault/accounts/{vaultAccountId}/{assetId}/max_spendable_amount",
1687 local_var_configuration.base_path,
1688 vaultAccountId = crate::apis::urlencode(vault_account_id),
1689 assetId = crate::apis::urlencode(asset_id)
1690 );
1691 let mut local_var_req_builder =
1692 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1693
1694 if let Some(ref param_value) = manual_signing {
1695 local_var_req_builder =
1696 local_var_req_builder.query(&[("manualSigning", ¶m_value.to_string())]);
1697 }
1698 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1699 local_var_req_builder = local_var_req_builder
1700 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1701 }
1702
1703 let local_var_req = local_var_req_builder.build()?;
1704 let local_var_resp = local_var_client.execute(local_var_req).await?;
1705
1706 let local_var_status = local_var_resp.status();
1707 let local_var_content_type = local_var_resp
1708 .headers()
1709 .get("content-type")
1710 .and_then(|v| v.to_str().ok())
1711 .unwrap_or("application/octet-stream");
1712 let local_var_content_type = super::ContentType::from(local_var_content_type);
1713 let local_var_content = local_var_resp.text().await?;
1714
1715 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1716 match local_var_content_type {
1717 ContentType::Json => {
1718 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1719 }
1720 ContentType::Text => {
1721 return Err(Error::from(serde_json::Error::custom(
1722 "Received `text/plain` content type response that cannot be converted to \
1723 `models::GetMaxSpendableAmountResponse`",
1724 )));
1725 }
1726 ContentType::Unsupported(local_var_unknown_type) => {
1727 return Err(Error::from(serde_json::Error::custom(format!(
1728 "Received `{local_var_unknown_type}` content type response that cannot be \
1729 converted to `models::GetMaxSpendableAmountResponse`"
1730 ))));
1731 }
1732 }
1733 } else {
1734 let local_var_entity: Option<GetMaxSpendableAmountError> =
1735 serde_json::from_str(&local_var_content).ok();
1736 let local_var_error = ResponseContent {
1737 status: local_var_status,
1738 content: local_var_content,
1739 entity: local_var_entity,
1740 };
1741 Err(Error::ResponseError(local_var_error))
1742 }
1743 }
1744
1745 async fn get_paged_vault_accounts(
1749 &self,
1750 params: GetPagedVaultAccountsParams,
1751 ) -> Result<models::VaultAccountsPagedResponse, Error<GetPagedVaultAccountsError>> {
1752 let GetPagedVaultAccountsParams {
1753 name_prefix,
1754 name_suffix,
1755 min_amount_threshold,
1756 asset_id,
1757 order_by,
1758 before,
1759 after,
1760 limit,
1761 tag_ids,
1762 } = params;
1763
1764 let local_var_configuration = &self.configuration;
1765
1766 let local_var_client = &local_var_configuration.client;
1767
1768 let local_var_uri_str =
1769 format!("{}/vault/accounts_paged", local_var_configuration.base_path);
1770 let mut local_var_req_builder =
1771 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1772
1773 if let Some(ref param_value) = name_prefix {
1774 local_var_req_builder =
1775 local_var_req_builder.query(&[("namePrefix", ¶m_value.to_string())]);
1776 }
1777 if let Some(ref param_value) = name_suffix {
1778 local_var_req_builder =
1779 local_var_req_builder.query(&[("nameSuffix", ¶m_value.to_string())]);
1780 }
1781 if let Some(ref param_value) = min_amount_threshold {
1782 local_var_req_builder =
1783 local_var_req_builder.query(&[("minAmountThreshold", ¶m_value.to_string())]);
1784 }
1785 if let Some(ref param_value) = asset_id {
1786 local_var_req_builder =
1787 local_var_req_builder.query(&[("assetId", ¶m_value.to_string())]);
1788 }
1789 if let Some(ref param_value) = order_by {
1790 local_var_req_builder =
1791 local_var_req_builder.query(&[("orderBy", ¶m_value.to_string())]);
1792 }
1793 if let Some(ref param_value) = before {
1794 local_var_req_builder =
1795 local_var_req_builder.query(&[("before", ¶m_value.to_string())]);
1796 }
1797 if let Some(ref param_value) = after {
1798 local_var_req_builder =
1799 local_var_req_builder.query(&[("after", ¶m_value.to_string())]);
1800 }
1801 if let Some(ref param_value) = limit {
1802 local_var_req_builder =
1803 local_var_req_builder.query(&[("limit", ¶m_value.to_string())]);
1804 }
1805 if let Some(ref param_value) = tag_ids {
1806 local_var_req_builder = match "multi" {
1807 "multi" => local_var_req_builder.query(
1808 ¶m_value
1809 .into_iter()
1810 .map(|p| ("tagIds".to_owned(), p.to_string()))
1811 .collect::<Vec<(std::string::String, std::string::String)>>(),
1812 ),
1813 _ => local_var_req_builder.query(&[(
1814 "tagIds",
1815 ¶m_value
1816 .into_iter()
1817 .map(|p| p.to_string())
1818 .collect::<Vec<String>>()
1819 .join(",")
1820 .to_string(),
1821 )]),
1822 };
1823 }
1824 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1825 local_var_req_builder = local_var_req_builder
1826 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1827 }
1828
1829 let local_var_req = local_var_req_builder.build()?;
1830 let local_var_resp = local_var_client.execute(local_var_req).await?;
1831
1832 let local_var_status = local_var_resp.status();
1833 let local_var_content_type = local_var_resp
1834 .headers()
1835 .get("content-type")
1836 .and_then(|v| v.to_str().ok())
1837 .unwrap_or("application/octet-stream");
1838 let local_var_content_type = super::ContentType::from(local_var_content_type);
1839 let local_var_content = local_var_resp.text().await?;
1840
1841 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1842 match local_var_content_type {
1843 ContentType::Json => {
1844 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1845 }
1846 ContentType::Text => {
1847 return Err(Error::from(serde_json::Error::custom(
1848 "Received `text/plain` content type response that cannot be converted to \
1849 `models::VaultAccountsPagedResponse`",
1850 )));
1851 }
1852 ContentType::Unsupported(local_var_unknown_type) => {
1853 return Err(Error::from(serde_json::Error::custom(format!(
1854 "Received `{local_var_unknown_type}` content type response that cannot be \
1855 converted to `models::VaultAccountsPagedResponse`"
1856 ))));
1857 }
1858 }
1859 } else {
1860 let local_var_entity: Option<GetPagedVaultAccountsError> =
1861 serde_json::from_str(&local_var_content).ok();
1862 let local_var_error = ResponseContent {
1863 status: local_var_status,
1864 content: local_var_content,
1865 entity: local_var_entity,
1866 };
1867 Err(Error::ResponseError(local_var_error))
1868 }
1869 }
1870
1871 async fn get_public_key_info(
1874 &self,
1875 params: GetPublicKeyInfoParams,
1876 ) -> Result<models::PublicKeyInformation, Error<GetPublicKeyInfoError>> {
1877 let GetPublicKeyInfoParams {
1878 derivation_path,
1879 algorithm,
1880 compressed,
1881 } = params;
1882
1883 let local_var_configuration = &self.configuration;
1884
1885 let local_var_client = &local_var_configuration.client;
1886
1887 let local_var_uri_str = format!(
1888 "{}/vault/public_key_info",
1889 local_var_configuration.base_path
1890 );
1891 let mut local_var_req_builder =
1892 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1893
1894 local_var_req_builder = match "multi" {
1895 "multi" => local_var_req_builder.query(
1896 &derivation_path
1897 .into_iter()
1898 .map(|p| ("derivationPath".to_owned(), p.to_string()))
1899 .collect::<Vec<(std::string::String, std::string::String)>>(),
1900 ),
1901 _ => local_var_req_builder.query(&[(
1902 "derivationPath",
1903 &derivation_path
1904 .into_iter()
1905 .map(|p| p.to_string())
1906 .collect::<Vec<String>>()
1907 .join(",")
1908 .to_string(),
1909 )]),
1910 };
1911 local_var_req_builder =
1912 local_var_req_builder.query(&[("algorithm", &algorithm.to_string())]);
1913 if let Some(ref param_value) = compressed {
1914 local_var_req_builder =
1915 local_var_req_builder.query(&[("compressed", ¶m_value.to_string())]);
1916 }
1917 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1918 local_var_req_builder = local_var_req_builder
1919 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1920 }
1921
1922 let local_var_req = local_var_req_builder.build()?;
1923 let local_var_resp = local_var_client.execute(local_var_req).await?;
1924
1925 let local_var_status = local_var_resp.status();
1926 let local_var_content_type = local_var_resp
1927 .headers()
1928 .get("content-type")
1929 .and_then(|v| v.to_str().ok())
1930 .unwrap_or("application/octet-stream");
1931 let local_var_content_type = super::ContentType::from(local_var_content_type);
1932 let local_var_content = local_var_resp.text().await?;
1933
1934 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1935 match local_var_content_type {
1936 ContentType::Json => {
1937 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
1938 }
1939 ContentType::Text => {
1940 return Err(Error::from(serde_json::Error::custom(
1941 "Received `text/plain` content type response that cannot be converted to \
1942 `models::PublicKeyInformation`",
1943 )));
1944 }
1945 ContentType::Unsupported(local_var_unknown_type) => {
1946 return Err(Error::from(serde_json::Error::custom(format!(
1947 "Received `{local_var_unknown_type}` content type response that cannot be \
1948 converted to `models::PublicKeyInformation`"
1949 ))));
1950 }
1951 }
1952 } else {
1953 let local_var_entity: Option<GetPublicKeyInfoError> =
1954 serde_json::from_str(&local_var_content).ok();
1955 let local_var_error = ResponseContent {
1956 status: local_var_status,
1957 content: local_var_content,
1958 entity: local_var_entity,
1959 };
1960 Err(Error::ResponseError(local_var_error))
1961 }
1962 }
1963
1964 async fn get_public_key_info_for_address(
1967 &self,
1968 params: GetPublicKeyInfoForAddressParams,
1969 ) -> Result<models::PublicKeyInformation, Error<GetPublicKeyInfoForAddressError>> {
1970 let GetPublicKeyInfoForAddressParams {
1971 vault_account_id,
1972 asset_id,
1973 change,
1974 address_index,
1975 compressed,
1976 } = params;
1977
1978 let local_var_configuration = &self.configuration;
1979
1980 let local_var_client = &local_var_configuration.client;
1981
1982 let local_var_uri_str = format!(
1983 "{}/vault/accounts/{vaultAccountId}/{assetId}/{change}/{addressIndex}/public_key_info",
1984 local_var_configuration.base_path,
1985 vaultAccountId = crate::apis::urlencode(vault_account_id),
1986 assetId = crate::apis::urlencode(asset_id),
1987 change = change,
1988 addressIndex = address_index
1989 );
1990 let mut local_var_req_builder =
1991 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1992
1993 if let Some(ref param_value) = compressed {
1994 local_var_req_builder =
1995 local_var_req_builder.query(&[("compressed", ¶m_value.to_string())]);
1996 }
1997 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1998 local_var_req_builder = local_var_req_builder
1999 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2000 }
2001
2002 let local_var_req = local_var_req_builder.build()?;
2003 let local_var_resp = local_var_client.execute(local_var_req).await?;
2004
2005 let local_var_status = local_var_resp.status();
2006 let local_var_content_type = local_var_resp
2007 .headers()
2008 .get("content-type")
2009 .and_then(|v| v.to_str().ok())
2010 .unwrap_or("application/octet-stream");
2011 let local_var_content_type = super::ContentType::from(local_var_content_type);
2012 let local_var_content = local_var_resp.text().await?;
2013
2014 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2015 match local_var_content_type {
2016 ContentType::Json => {
2017 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
2018 }
2019 ContentType::Text => {
2020 return Err(Error::from(serde_json::Error::custom(
2021 "Received `text/plain` content type response that cannot be converted to \
2022 `models::PublicKeyInformation`",
2023 )));
2024 }
2025 ContentType::Unsupported(local_var_unknown_type) => {
2026 return Err(Error::from(serde_json::Error::custom(format!(
2027 "Received `{local_var_unknown_type}` content type response that cannot be \
2028 converted to `models::PublicKeyInformation`"
2029 ))));
2030 }
2031 }
2032 } else {
2033 let local_var_entity: Option<GetPublicKeyInfoForAddressError> =
2034 serde_json::from_str(&local_var_content).ok();
2035 let local_var_error = ResponseContent {
2036 status: local_var_status,
2037 content: local_var_content,
2038 entity: local_var_entity,
2039 };
2040 Err(Error::ResponseError(local_var_error))
2041 }
2042 }
2043
2044 async fn get_unspent_inputs(
2048 &self,
2049 params: GetUnspentInputsParams,
2050 ) -> Result<Vec<models::UnspentInputsResponse>, Error<GetUnspentInputsError>> {
2051 let GetUnspentInputsParams {
2052 vault_account_id,
2053 asset_id,
2054 } = params;
2055
2056 let local_var_configuration = &self.configuration;
2057
2058 let local_var_client = &local_var_configuration.client;
2059
2060 let local_var_uri_str = format!(
2061 "{}/vault/accounts/{vaultAccountId}/{assetId}/unspent_inputs",
2062 local_var_configuration.base_path,
2063 vaultAccountId = crate::apis::urlencode(vault_account_id),
2064 assetId = crate::apis::urlencode(asset_id)
2065 );
2066 let mut local_var_req_builder =
2067 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2068
2069 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2070 local_var_req_builder = local_var_req_builder
2071 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2072 }
2073
2074 let local_var_req = local_var_req_builder.build()?;
2075 let local_var_resp = local_var_client.execute(local_var_req).await?;
2076
2077 let local_var_status = local_var_resp.status();
2078 let local_var_content_type = local_var_resp
2079 .headers()
2080 .get("content-type")
2081 .and_then(|v| v.to_str().ok())
2082 .unwrap_or("application/octet-stream");
2083 let local_var_content_type = super::ContentType::from(local_var_content_type);
2084 let local_var_content = local_var_resp.text().await?;
2085
2086 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2087 match local_var_content_type {
2088 ContentType::Json => {
2089 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
2090 }
2091 ContentType::Text => {
2092 return Err(Error::from(serde_json::Error::custom(
2093 "Received `text/plain` content type response that cannot be converted to \
2094 `Vec<models::UnspentInputsResponse>`",
2095 )));
2096 }
2097 ContentType::Unsupported(local_var_unknown_type) => {
2098 return Err(Error::from(serde_json::Error::custom(format!(
2099 "Received `{local_var_unknown_type}` content type response that cannot be \
2100 converted to `Vec<models::UnspentInputsResponse>`"
2101 ))));
2102 }
2103 }
2104 } else {
2105 let local_var_entity: Option<GetUnspentInputsError> =
2106 serde_json::from_str(&local_var_content).ok();
2107 let local_var_error = ResponseContent {
2108 status: local_var_status,
2109 content: local_var_content,
2110 entity: local_var_entity,
2111 };
2112 Err(Error::ResponseError(local_var_error))
2113 }
2114 }
2115
2116 async fn get_vault_account(
2119 &self,
2120 params: GetVaultAccountParams,
2121 ) -> Result<models::VaultAccount, Error<GetVaultAccountError>> {
2122 let GetVaultAccountParams { vault_account_id } = params;
2123
2124 let local_var_configuration = &self.configuration;
2125
2126 let local_var_client = &local_var_configuration.client;
2127
2128 let local_var_uri_str = format!(
2129 "{}/vault/accounts/{vaultAccountId}",
2130 local_var_configuration.base_path,
2131 vaultAccountId = crate::apis::urlencode(vault_account_id)
2132 );
2133 let mut local_var_req_builder =
2134 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2135
2136 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2137 local_var_req_builder = local_var_req_builder
2138 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2139 }
2140
2141 let local_var_req = local_var_req_builder.build()?;
2142 let local_var_resp = local_var_client.execute(local_var_req).await?;
2143
2144 let local_var_status = local_var_resp.status();
2145 let local_var_content_type = local_var_resp
2146 .headers()
2147 .get("content-type")
2148 .and_then(|v| v.to_str().ok())
2149 .unwrap_or("application/octet-stream");
2150 let local_var_content_type = super::ContentType::from(local_var_content_type);
2151 let local_var_content = local_var_resp.text().await?;
2152
2153 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2154 match local_var_content_type {
2155 ContentType::Json => {
2156 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
2157 }
2158 ContentType::Text => {
2159 return Err(Error::from(serde_json::Error::custom(
2160 "Received `text/plain` content type response that cannot be converted to \
2161 `models::VaultAccount`",
2162 )));
2163 }
2164 ContentType::Unsupported(local_var_unknown_type) => {
2165 return Err(Error::from(serde_json::Error::custom(format!(
2166 "Received `{local_var_unknown_type}` content type response that cannot be \
2167 converted to `models::VaultAccount`"
2168 ))));
2169 }
2170 }
2171 } else {
2172 let local_var_entity: Option<GetVaultAccountError> =
2173 serde_json::from_str(&local_var_content).ok();
2174 let local_var_error = ResponseContent {
2175 status: local_var_status,
2176 content: local_var_content,
2177 entity: local_var_entity,
2178 };
2179 Err(Error::ResponseError(local_var_error))
2180 }
2181 }
2182
2183 async fn get_vault_account_asset(
2187 &self,
2188 params: GetVaultAccountAssetParams,
2189 ) -> Result<models::VaultAsset, Error<GetVaultAccountAssetError>> {
2190 let GetVaultAccountAssetParams {
2191 vault_account_id,
2192 asset_id,
2193 } = params;
2194
2195 let local_var_configuration = &self.configuration;
2196
2197 let local_var_client = &local_var_configuration.client;
2198
2199 let local_var_uri_str = format!(
2200 "{}/vault/accounts/{vaultAccountId}/{assetId}",
2201 local_var_configuration.base_path,
2202 vaultAccountId = crate::apis::urlencode(vault_account_id),
2203 assetId = crate::apis::urlencode(asset_id)
2204 );
2205 let mut local_var_req_builder =
2206 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2207
2208 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2209 local_var_req_builder = local_var_req_builder
2210 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2211 }
2212
2213 let local_var_req = local_var_req_builder.build()?;
2214 let local_var_resp = local_var_client.execute(local_var_req).await?;
2215
2216 let local_var_status = local_var_resp.status();
2217 let local_var_content_type = local_var_resp
2218 .headers()
2219 .get("content-type")
2220 .and_then(|v| v.to_str().ok())
2221 .unwrap_or("application/octet-stream");
2222 let local_var_content_type = super::ContentType::from(local_var_content_type);
2223 let local_var_content = local_var_resp.text().await?;
2224
2225 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2226 match local_var_content_type {
2227 ContentType::Json => {
2228 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
2229 }
2230 ContentType::Text => {
2231 return Err(Error::from(serde_json::Error::custom(
2232 "Received `text/plain` content type response that cannot be converted to \
2233 `models::VaultAsset`",
2234 )));
2235 }
2236 ContentType::Unsupported(local_var_unknown_type) => {
2237 return Err(Error::from(serde_json::Error::custom(format!(
2238 "Received `{local_var_unknown_type}` content type response that cannot be \
2239 converted to `models::VaultAsset`"
2240 ))));
2241 }
2242 }
2243 } else {
2244 let local_var_entity: Option<GetVaultAccountAssetError> =
2245 serde_json::from_str(&local_var_content).ok();
2246 let local_var_error = ResponseContent {
2247 status: local_var_status,
2248 content: local_var_content,
2249 entity: local_var_entity,
2250 };
2251 Err(Error::ResponseError(local_var_error))
2252 }
2253 }
2254
2255 async fn get_vault_account_asset_addresses(
2267 &self,
2268 params: GetVaultAccountAssetAddressesParams,
2269 ) -> Result<Vec<models::VaultWalletAddress>, Error<GetVaultAccountAssetAddressesError>> {
2270 let GetVaultAccountAssetAddressesParams {
2271 vault_account_id,
2272 asset_id,
2273 } = params;
2274
2275 let local_var_configuration = &self.configuration;
2276
2277 let local_var_client = &local_var_configuration.client;
2278
2279 let local_var_uri_str = format!(
2280 "{}/vault/accounts/{vaultAccountId}/{assetId}/addresses",
2281 local_var_configuration.base_path,
2282 vaultAccountId = crate::apis::urlencode(vault_account_id),
2283 assetId = crate::apis::urlencode(asset_id)
2284 );
2285 let mut local_var_req_builder =
2286 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2287
2288 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2289 local_var_req_builder = local_var_req_builder
2290 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2291 }
2292
2293 let local_var_req = local_var_req_builder.build()?;
2294 let local_var_resp = local_var_client.execute(local_var_req).await?;
2295
2296 let local_var_status = local_var_resp.status();
2297 let local_var_content_type = local_var_resp
2298 .headers()
2299 .get("content-type")
2300 .and_then(|v| v.to_str().ok())
2301 .unwrap_or("application/octet-stream");
2302 let local_var_content_type = super::ContentType::from(local_var_content_type);
2303 let local_var_content = local_var_resp.text().await?;
2304
2305 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2306 match local_var_content_type {
2307 ContentType::Json => {
2308 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
2309 }
2310 ContentType::Text => {
2311 return Err(Error::from(serde_json::Error::custom(
2312 "Received `text/plain` content type response that cannot be converted to \
2313 `Vec<models::VaultWalletAddress>`",
2314 )));
2315 }
2316 ContentType::Unsupported(local_var_unknown_type) => {
2317 return Err(Error::from(serde_json::Error::custom(format!(
2318 "Received `{local_var_unknown_type}` content type response that cannot be \
2319 converted to `Vec<models::VaultWalletAddress>`"
2320 ))));
2321 }
2322 }
2323 } else {
2324 let local_var_entity: Option<GetVaultAccountAssetAddressesError> =
2325 serde_json::from_str(&local_var_content).ok();
2326 let local_var_error = ResponseContent {
2327 status: local_var_status,
2328 content: local_var_content,
2329 entity: local_var_entity,
2330 };
2331 Err(Error::ResponseError(local_var_error))
2332 }
2333 }
2334
2335 async fn get_vault_account_asset_addresses_paginated(
2339 &self,
2340 params: GetVaultAccountAssetAddressesPaginatedParams,
2341 ) -> Result<models::PaginatedAddressResponse, Error<GetVaultAccountAssetAddressesPaginatedError>>
2342 {
2343 let GetVaultAccountAssetAddressesPaginatedParams {
2344 vault_account_id,
2345 asset_id,
2346 limit,
2347 before,
2348 after,
2349 } = params;
2350
2351 let local_var_configuration = &self.configuration;
2352
2353 let local_var_client = &local_var_configuration.client;
2354
2355 let local_var_uri_str = format!(
2356 "{}/vault/accounts/{vaultAccountId}/{assetId}/addresses_paginated",
2357 local_var_configuration.base_path,
2358 vaultAccountId = crate::apis::urlencode(vault_account_id),
2359 assetId = crate::apis::urlencode(asset_id)
2360 );
2361 let mut local_var_req_builder =
2362 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2363
2364 if let Some(ref param_value) = limit {
2365 local_var_req_builder =
2366 local_var_req_builder.query(&[("limit", ¶m_value.to_string())]);
2367 }
2368 if let Some(ref param_value) = before {
2369 local_var_req_builder =
2370 local_var_req_builder.query(&[("before", ¶m_value.to_string())]);
2371 }
2372 if let Some(ref param_value) = after {
2373 local_var_req_builder =
2374 local_var_req_builder.query(&[("after", ¶m_value.to_string())]);
2375 }
2376 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2377 local_var_req_builder = local_var_req_builder
2378 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2379 }
2380
2381 let local_var_req = local_var_req_builder.build()?;
2382 let local_var_resp = local_var_client.execute(local_var_req).await?;
2383
2384 let local_var_status = local_var_resp.status();
2385 let local_var_content_type = local_var_resp
2386 .headers()
2387 .get("content-type")
2388 .and_then(|v| v.to_str().ok())
2389 .unwrap_or("application/octet-stream");
2390 let local_var_content_type = super::ContentType::from(local_var_content_type);
2391 let local_var_content = local_var_resp.text().await?;
2392
2393 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2394 match local_var_content_type {
2395 ContentType::Json => {
2396 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
2397 }
2398 ContentType::Text => {
2399 return Err(Error::from(serde_json::Error::custom(
2400 "Received `text/plain` content type response that cannot be converted to \
2401 `models::PaginatedAddressResponse`",
2402 )));
2403 }
2404 ContentType::Unsupported(local_var_unknown_type) => {
2405 return Err(Error::from(serde_json::Error::custom(format!(
2406 "Received `{local_var_unknown_type}` content type response that cannot be \
2407 converted to `models::PaginatedAddressResponse`"
2408 ))));
2409 }
2410 }
2411 } else {
2412 let local_var_entity: Option<GetVaultAccountAssetAddressesPaginatedError> =
2413 serde_json::from_str(&local_var_content).ok();
2414 let local_var_error = ResponseContent {
2415 status: local_var_status,
2416 content: local_var_content,
2417 entity: local_var_entity,
2418 };
2419 Err(Error::ResponseError(local_var_error))
2420 }
2421 }
2422
2423 async fn get_vault_assets(
2427 &self,
2428 params: GetVaultAssetsParams,
2429 ) -> Result<Vec<models::VaultAsset>, Error<GetVaultAssetsError>> {
2430 let GetVaultAssetsParams {
2431 account_name_prefix,
2432 account_name_suffix,
2433 } = params;
2434
2435 let local_var_configuration = &self.configuration;
2436
2437 let local_var_client = &local_var_configuration.client;
2438
2439 let local_var_uri_str = format!("{}/vault/assets", local_var_configuration.base_path);
2440 let mut local_var_req_builder =
2441 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2442
2443 if let Some(ref param_value) = account_name_prefix {
2444 local_var_req_builder =
2445 local_var_req_builder.query(&[("accountNamePrefix", ¶m_value.to_string())]);
2446 }
2447 if let Some(ref param_value) = account_name_suffix {
2448 local_var_req_builder =
2449 local_var_req_builder.query(&[("accountNameSuffix", ¶m_value.to_string())]);
2450 }
2451 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2452 local_var_req_builder = local_var_req_builder
2453 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2454 }
2455
2456 let local_var_req = local_var_req_builder.build()?;
2457 let local_var_resp = local_var_client.execute(local_var_req).await?;
2458
2459 let local_var_status = local_var_resp.status();
2460 let local_var_content_type = local_var_resp
2461 .headers()
2462 .get("content-type")
2463 .and_then(|v| v.to_str().ok())
2464 .unwrap_or("application/octet-stream");
2465 let local_var_content_type = super::ContentType::from(local_var_content_type);
2466 let local_var_content = local_var_resp.text().await?;
2467
2468 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2469 match local_var_content_type {
2470 ContentType::Json => {
2471 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
2472 }
2473 ContentType::Text => {
2474 return Err(Error::from(serde_json::Error::custom(
2475 "Received `text/plain` content type response that cannot be converted to \
2476 `Vec<models::VaultAsset>`",
2477 )));
2478 }
2479 ContentType::Unsupported(local_var_unknown_type) => {
2480 return Err(Error::from(serde_json::Error::custom(format!(
2481 "Received `{local_var_unknown_type}` content type response that cannot be \
2482 converted to `Vec<models::VaultAsset>`"
2483 ))));
2484 }
2485 }
2486 } else {
2487 let local_var_entity: Option<GetVaultAssetsError> =
2488 serde_json::from_str(&local_var_content).ok();
2489 let local_var_error = ResponseContent {
2490 status: local_var_status,
2491 content: local_var_content,
2492 entity: local_var_entity,
2493 };
2494 Err(Error::ResponseError(local_var_error))
2495 }
2496 }
2497
2498 async fn get_vault_balance_by_asset(
2502 &self,
2503 params: GetVaultBalanceByAssetParams,
2504 ) -> Result<models::VaultAsset, Error<GetVaultBalanceByAssetError>> {
2505 let GetVaultBalanceByAssetParams { asset_id } = params;
2506
2507 let local_var_configuration = &self.configuration;
2508
2509 let local_var_client = &local_var_configuration.client;
2510
2511 let local_var_uri_str = format!(
2512 "{}/vault/assets/{assetId}",
2513 local_var_configuration.base_path,
2514 assetId = crate::apis::urlencode(asset_id)
2515 );
2516 let mut local_var_req_builder =
2517 local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
2518
2519 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2520 local_var_req_builder = local_var_req_builder
2521 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2522 }
2523
2524 let local_var_req = local_var_req_builder.build()?;
2525 let local_var_resp = local_var_client.execute(local_var_req).await?;
2526
2527 let local_var_status = local_var_resp.status();
2528 let local_var_content_type = local_var_resp
2529 .headers()
2530 .get("content-type")
2531 .and_then(|v| v.to_str().ok())
2532 .unwrap_or("application/octet-stream");
2533 let local_var_content_type = super::ContentType::from(local_var_content_type);
2534 let local_var_content = local_var_resp.text().await?;
2535
2536 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2537 match local_var_content_type {
2538 ContentType::Json => {
2539 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
2540 }
2541 ContentType::Text => {
2542 return Err(Error::from(serde_json::Error::custom(
2543 "Received `text/plain` content type response that cannot be converted to \
2544 `models::VaultAsset`",
2545 )));
2546 }
2547 ContentType::Unsupported(local_var_unknown_type) => {
2548 return Err(Error::from(serde_json::Error::custom(format!(
2549 "Received `{local_var_unknown_type}` content type response that cannot be \
2550 converted to `models::VaultAsset`"
2551 ))));
2552 }
2553 }
2554 } else {
2555 let local_var_entity: Option<GetVaultBalanceByAssetError> =
2556 serde_json::from_str(&local_var_content).ok();
2557 let local_var_error = ResponseContent {
2558 status: local_var_status,
2559 content: local_var_content,
2560 entity: local_var_entity,
2561 };
2562 Err(Error::ResponseError(local_var_error))
2563 }
2564 }
2565
2566 async fn hide_vault_account(
2568 &self,
2569 params: HideVaultAccountParams,
2570 ) -> Result<models::VaultActionStatus, Error<HideVaultAccountError>> {
2571 let HideVaultAccountParams {
2572 vault_account_id,
2573 idempotency_key,
2574 } = params;
2575
2576 let local_var_configuration = &self.configuration;
2577
2578 let local_var_client = &local_var_configuration.client;
2579
2580 let local_var_uri_str = format!(
2581 "{}/vault/accounts/{vaultAccountId}/hide",
2582 local_var_configuration.base_path,
2583 vaultAccountId = crate::apis::urlencode(vault_account_id)
2584 );
2585 let mut local_var_req_builder =
2586 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2587
2588 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2589 local_var_req_builder = local_var_req_builder
2590 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2591 }
2592 if let Some(local_var_param_value) = idempotency_key {
2593 local_var_req_builder =
2594 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
2595 }
2596
2597 let local_var_req = local_var_req_builder.build()?;
2598 let local_var_resp = local_var_client.execute(local_var_req).await?;
2599
2600 let local_var_status = local_var_resp.status();
2601 let local_var_content_type = local_var_resp
2602 .headers()
2603 .get("content-type")
2604 .and_then(|v| v.to_str().ok())
2605 .unwrap_or("application/octet-stream");
2606 let local_var_content_type = super::ContentType::from(local_var_content_type);
2607 let local_var_content = local_var_resp.text().await?;
2608
2609 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2610 match local_var_content_type {
2611 ContentType::Json => {
2612 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
2613 }
2614 ContentType::Text => {
2615 return Err(Error::from(serde_json::Error::custom(
2616 "Received `text/plain` content type response that cannot be converted to \
2617 `models::VaultActionStatus`",
2618 )));
2619 }
2620 ContentType::Unsupported(local_var_unknown_type) => {
2621 return Err(Error::from(serde_json::Error::custom(format!(
2622 "Received `{local_var_unknown_type}` content type response that cannot be \
2623 converted to `models::VaultActionStatus`"
2624 ))));
2625 }
2626 }
2627 } else {
2628 let local_var_entity: Option<HideVaultAccountError> =
2629 serde_json::from_str(&local_var_content).ok();
2630 let local_var_error = ResponseContent {
2631 status: local_var_status,
2632 content: local_var_content,
2633 entity: local_var_entity,
2634 };
2635 Err(Error::ResponseError(local_var_error))
2636 }
2637 }
2638
2639 async fn set_customer_ref_id_for_address(
2642 &self,
2643 params: SetCustomerRefIdForAddressParams,
2644 ) -> Result<models::VaultActionStatus, Error<SetCustomerRefIdForAddressError>> {
2645 let SetCustomerRefIdForAddressParams {
2646 vault_account_id,
2647 asset_id,
2648 address_id,
2649 set_customer_ref_id_for_address_request,
2650 idempotency_key,
2651 } = params;
2652
2653 let local_var_configuration = &self.configuration;
2654
2655 let local_var_client = &local_var_configuration.client;
2656
2657 let local_var_uri_str = format!(
2658 "{}/vault/accounts/{vaultAccountId}/{assetId}/addresses/{addressId}/\
2659 set_customer_ref_id",
2660 local_var_configuration.base_path,
2661 vaultAccountId = crate::apis::urlencode(vault_account_id),
2662 assetId = crate::apis::urlencode(asset_id),
2663 addressId = crate::apis::urlencode(address_id)
2664 );
2665 let mut local_var_req_builder =
2666 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2667
2668 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2669 local_var_req_builder = local_var_req_builder
2670 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2671 }
2672 if let Some(local_var_param_value) = idempotency_key {
2673 local_var_req_builder =
2674 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
2675 }
2676 local_var_req_builder =
2677 local_var_req_builder.json(&set_customer_ref_id_for_address_request);
2678
2679 let local_var_req = local_var_req_builder.build()?;
2680 let local_var_resp = local_var_client.execute(local_var_req).await?;
2681
2682 let local_var_status = local_var_resp.status();
2683 let local_var_content_type = local_var_resp
2684 .headers()
2685 .get("content-type")
2686 .and_then(|v| v.to_str().ok())
2687 .unwrap_or("application/octet-stream");
2688 let local_var_content_type = super::ContentType::from(local_var_content_type);
2689 let local_var_content = local_var_resp.text().await?;
2690
2691 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2692 match local_var_content_type {
2693 ContentType::Json => {
2694 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
2695 }
2696 ContentType::Text => {
2697 return Err(Error::from(serde_json::Error::custom(
2698 "Received `text/plain` content type response that cannot be converted to \
2699 `models::VaultActionStatus`",
2700 )));
2701 }
2702 ContentType::Unsupported(local_var_unknown_type) => {
2703 return Err(Error::from(serde_json::Error::custom(format!(
2704 "Received `{local_var_unknown_type}` content type response that cannot be \
2705 converted to `models::VaultActionStatus`"
2706 ))));
2707 }
2708 }
2709 } else {
2710 let local_var_entity: Option<SetCustomerRefIdForAddressError> =
2711 serde_json::from_str(&local_var_content).ok();
2712 let local_var_error = ResponseContent {
2713 status: local_var_status,
2714 content: local_var_content,
2715 entity: local_var_entity,
2716 };
2717 Err(Error::ResponseError(local_var_error))
2718 }
2719 }
2720
2721 async fn set_vault_account_auto_fuel(
2723 &self,
2724 params: SetVaultAccountAutoFuelParams,
2725 ) -> Result<models::VaultActionStatus, Error<SetVaultAccountAutoFuelError>> {
2726 let SetVaultAccountAutoFuelParams {
2727 vault_account_id,
2728 set_auto_fuel_request,
2729 idempotency_key,
2730 } = params;
2731
2732 let local_var_configuration = &self.configuration;
2733
2734 let local_var_client = &local_var_configuration.client;
2735
2736 let local_var_uri_str = format!(
2737 "{}/vault/accounts/{vaultAccountId}/set_auto_fuel",
2738 local_var_configuration.base_path,
2739 vaultAccountId = crate::apis::urlencode(vault_account_id)
2740 );
2741 let mut local_var_req_builder =
2742 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2743
2744 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2745 local_var_req_builder = local_var_req_builder
2746 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2747 }
2748 if let Some(local_var_param_value) = idempotency_key {
2749 local_var_req_builder =
2750 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
2751 }
2752 local_var_req_builder = local_var_req_builder.json(&set_auto_fuel_request);
2753
2754 let local_var_req = local_var_req_builder.build()?;
2755 let local_var_resp = local_var_client.execute(local_var_req).await?;
2756
2757 let local_var_status = local_var_resp.status();
2758 let local_var_content_type = local_var_resp
2759 .headers()
2760 .get("content-type")
2761 .and_then(|v| v.to_str().ok())
2762 .unwrap_or("application/octet-stream");
2763 let local_var_content_type = super::ContentType::from(local_var_content_type);
2764 let local_var_content = local_var_resp.text().await?;
2765
2766 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2767 match local_var_content_type {
2768 ContentType::Json => {
2769 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
2770 }
2771 ContentType::Text => {
2772 return Err(Error::from(serde_json::Error::custom(
2773 "Received `text/plain` content type response that cannot be converted to \
2774 `models::VaultActionStatus`",
2775 )));
2776 }
2777 ContentType::Unsupported(local_var_unknown_type) => {
2778 return Err(Error::from(serde_json::Error::custom(format!(
2779 "Received `{local_var_unknown_type}` content type response that cannot be \
2780 converted to `models::VaultActionStatus`"
2781 ))));
2782 }
2783 }
2784 } else {
2785 let local_var_entity: Option<SetVaultAccountAutoFuelError> =
2786 serde_json::from_str(&local_var_content).ok();
2787 let local_var_error = ResponseContent {
2788 status: local_var_status,
2789 content: local_var_content,
2790 entity: local_var_entity,
2791 };
2792 Err(Error::ResponseError(local_var_error))
2793 }
2794 }
2795
2796 async fn set_vault_account_customer_ref_id(
2798 &self,
2799 params: SetVaultAccountCustomerRefIdParams,
2800 ) -> Result<models::VaultActionStatus, Error<SetVaultAccountCustomerRefIdError>> {
2801 let SetVaultAccountCustomerRefIdParams {
2802 vault_account_id,
2803 set_customer_ref_id_request,
2804 idempotency_key,
2805 } = params;
2806
2807 let local_var_configuration = &self.configuration;
2808
2809 let local_var_client = &local_var_configuration.client;
2810
2811 let local_var_uri_str = format!(
2812 "{}/vault/accounts/{vaultAccountId}/set_customer_ref_id",
2813 local_var_configuration.base_path,
2814 vaultAccountId = crate::apis::urlencode(vault_account_id)
2815 );
2816 let mut local_var_req_builder =
2817 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2818
2819 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2820 local_var_req_builder = local_var_req_builder
2821 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2822 }
2823 if let Some(local_var_param_value) = idempotency_key {
2824 local_var_req_builder =
2825 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
2826 }
2827 local_var_req_builder = local_var_req_builder.json(&set_customer_ref_id_request);
2828
2829 let local_var_req = local_var_req_builder.build()?;
2830 let local_var_resp = local_var_client.execute(local_var_req).await?;
2831
2832 let local_var_status = local_var_resp.status();
2833 let local_var_content_type = local_var_resp
2834 .headers()
2835 .get("content-type")
2836 .and_then(|v| v.to_str().ok())
2837 .unwrap_or("application/octet-stream");
2838 let local_var_content_type = super::ContentType::from(local_var_content_type);
2839 let local_var_content = local_var_resp.text().await?;
2840
2841 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2842 match local_var_content_type {
2843 ContentType::Json => {
2844 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
2845 }
2846 ContentType::Text => {
2847 return Err(Error::from(serde_json::Error::custom(
2848 "Received `text/plain` content type response that cannot be converted to \
2849 `models::VaultActionStatus`",
2850 )));
2851 }
2852 ContentType::Unsupported(local_var_unknown_type) => {
2853 return Err(Error::from(serde_json::Error::custom(format!(
2854 "Received `{local_var_unknown_type}` content type response that cannot be \
2855 converted to `models::VaultActionStatus`"
2856 ))));
2857 }
2858 }
2859 } else {
2860 let local_var_entity: Option<SetVaultAccountCustomerRefIdError> =
2861 serde_json::from_str(&local_var_content).ok();
2862 let local_var_error = ResponseContent {
2863 status: local_var_status,
2864 content: local_var_content,
2865 entity: local_var_entity,
2866 };
2867 Err(Error::ResponseError(local_var_error))
2868 }
2869 }
2870
2871 async fn unhide_vault_account(
2874 &self,
2875 params: UnhideVaultAccountParams,
2876 ) -> Result<models::VaultActionStatus, Error<UnhideVaultAccountError>> {
2877 let UnhideVaultAccountParams {
2878 vault_account_id,
2879 idempotency_key,
2880 } = params;
2881
2882 let local_var_configuration = &self.configuration;
2883
2884 let local_var_client = &local_var_configuration.client;
2885
2886 let local_var_uri_str = format!(
2887 "{}/vault/accounts/{vaultAccountId}/unhide",
2888 local_var_configuration.base_path,
2889 vaultAccountId = crate::apis::urlencode(vault_account_id)
2890 );
2891 let mut local_var_req_builder =
2892 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
2893
2894 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2895 local_var_req_builder = local_var_req_builder
2896 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2897 }
2898 if let Some(local_var_param_value) = idempotency_key {
2899 local_var_req_builder =
2900 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
2901 }
2902
2903 let local_var_req = local_var_req_builder.build()?;
2904 let local_var_resp = local_var_client.execute(local_var_req).await?;
2905
2906 let local_var_status = local_var_resp.status();
2907 let local_var_content_type = local_var_resp
2908 .headers()
2909 .get("content-type")
2910 .and_then(|v| v.to_str().ok())
2911 .unwrap_or("application/octet-stream");
2912 let local_var_content_type = super::ContentType::from(local_var_content_type);
2913 let local_var_content = local_var_resp.text().await?;
2914
2915 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2916 match local_var_content_type {
2917 ContentType::Json => {
2918 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
2919 }
2920 ContentType::Text => {
2921 return Err(Error::from(serde_json::Error::custom(
2922 "Received `text/plain` content type response that cannot be converted to \
2923 `models::VaultActionStatus`",
2924 )));
2925 }
2926 ContentType::Unsupported(local_var_unknown_type) => {
2927 return Err(Error::from(serde_json::Error::custom(format!(
2928 "Received `{local_var_unknown_type}` content type response that cannot be \
2929 converted to `models::VaultActionStatus`"
2930 ))));
2931 }
2932 }
2933 } else {
2934 let local_var_entity: Option<UnhideVaultAccountError> =
2935 serde_json::from_str(&local_var_content).ok();
2936 let local_var_error = ResponseContent {
2937 status: local_var_status,
2938 content: local_var_content,
2939 entity: local_var_entity,
2940 };
2941 Err(Error::ResponseError(local_var_error))
2942 }
2943 }
2944
2945 async fn update_vault_account(
2948 &self,
2949 params: UpdateVaultAccountParams,
2950 ) -> Result<models::RenameVaultAccountResponse, Error<UpdateVaultAccountError>> {
2951 let UpdateVaultAccountParams {
2952 vault_account_id,
2953 update_vault_account_request,
2954 idempotency_key,
2955 } = params;
2956
2957 let local_var_configuration = &self.configuration;
2958
2959 let local_var_client = &local_var_configuration.client;
2960
2961 let local_var_uri_str = format!(
2962 "{}/vault/accounts/{vaultAccountId}",
2963 local_var_configuration.base_path,
2964 vaultAccountId = crate::apis::urlencode(vault_account_id)
2965 );
2966 let mut local_var_req_builder =
2967 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
2968
2969 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
2970 local_var_req_builder = local_var_req_builder
2971 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
2972 }
2973 if let Some(local_var_param_value) = idempotency_key {
2974 local_var_req_builder =
2975 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
2976 }
2977 local_var_req_builder = local_var_req_builder.json(&update_vault_account_request);
2978
2979 let local_var_req = local_var_req_builder.build()?;
2980 let local_var_resp = local_var_client.execute(local_var_req).await?;
2981
2982 let local_var_status = local_var_resp.status();
2983 let local_var_content_type = local_var_resp
2984 .headers()
2985 .get("content-type")
2986 .and_then(|v| v.to_str().ok())
2987 .unwrap_or("application/octet-stream");
2988 let local_var_content_type = super::ContentType::from(local_var_content_type);
2989 let local_var_content = local_var_resp.text().await?;
2990
2991 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
2992 match local_var_content_type {
2993 ContentType::Json => {
2994 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
2995 }
2996 ContentType::Text => {
2997 return Err(Error::from(serde_json::Error::custom(
2998 "Received `text/plain` content type response that cannot be converted to \
2999 `models::RenameVaultAccountResponse`",
3000 )));
3001 }
3002 ContentType::Unsupported(local_var_unknown_type) => {
3003 return Err(Error::from(serde_json::Error::custom(format!(
3004 "Received `{local_var_unknown_type}` content type response that cannot be \
3005 converted to `models::RenameVaultAccountResponse`"
3006 ))));
3007 }
3008 }
3009 } else {
3010 let local_var_entity: Option<UpdateVaultAccountError> =
3011 serde_json::from_str(&local_var_content).ok();
3012 let local_var_error = ResponseContent {
3013 status: local_var_status,
3014 content: local_var_content,
3015 entity: local_var_entity,
3016 };
3017 Err(Error::ResponseError(local_var_error))
3018 }
3019 }
3020
3021 async fn update_vault_account_asset_address(
3025 &self,
3026 params: UpdateVaultAccountAssetAddressParams,
3027 ) -> Result<models::VaultActionStatus, Error<UpdateVaultAccountAssetAddressError>> {
3028 let UpdateVaultAccountAssetAddressParams {
3029 vault_account_id,
3030 asset_id,
3031 address_id,
3032 idempotency_key,
3033 update_vault_account_asset_address_request,
3034 } = params;
3035
3036 let local_var_configuration = &self.configuration;
3037
3038 let local_var_client = &local_var_configuration.client;
3039
3040 let local_var_uri_str = format!(
3041 "{}/vault/accounts/{vaultAccountId}/{assetId}/addresses/{addressId}",
3042 local_var_configuration.base_path,
3043 vaultAccountId = crate::apis::urlencode(vault_account_id),
3044 assetId = crate::apis::urlencode(asset_id),
3045 addressId = crate::apis::urlencode(address_id)
3046 );
3047 let mut local_var_req_builder =
3048 local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
3049
3050 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3051 local_var_req_builder = local_var_req_builder
3052 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3053 }
3054 if let Some(local_var_param_value) = idempotency_key {
3055 local_var_req_builder =
3056 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
3057 }
3058 local_var_req_builder =
3059 local_var_req_builder.json(&update_vault_account_asset_address_request);
3060
3061 let local_var_req = local_var_req_builder.build()?;
3062 let local_var_resp = local_var_client.execute(local_var_req).await?;
3063
3064 let local_var_status = local_var_resp.status();
3065 let local_var_content_type = local_var_resp
3066 .headers()
3067 .get("content-type")
3068 .and_then(|v| v.to_str().ok())
3069 .unwrap_or("application/octet-stream");
3070 let local_var_content_type = super::ContentType::from(local_var_content_type);
3071 let local_var_content = local_var_resp.text().await?;
3072
3073 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3074 match local_var_content_type {
3075 ContentType::Json => {
3076 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
3077 }
3078 ContentType::Text => {
3079 return Err(Error::from(serde_json::Error::custom(
3080 "Received `text/plain` content type response that cannot be converted to \
3081 `models::VaultActionStatus`",
3082 )));
3083 }
3084 ContentType::Unsupported(local_var_unknown_type) => {
3085 return Err(Error::from(serde_json::Error::custom(format!(
3086 "Received `{local_var_unknown_type}` content type response that cannot be \
3087 converted to `models::VaultActionStatus`"
3088 ))));
3089 }
3090 }
3091 } else {
3092 let local_var_entity: Option<UpdateVaultAccountAssetAddressError> =
3093 serde_json::from_str(&local_var_content).ok();
3094 let local_var_error = ResponseContent {
3095 status: local_var_status,
3096 content: local_var_content,
3097 entity: local_var_entity,
3098 };
3099 Err(Error::ResponseError(local_var_error))
3100 }
3101 }
3102
3103 async fn update_vault_account_asset_balance(
3108 &self,
3109 params: UpdateVaultAccountAssetBalanceParams,
3110 ) -> Result<models::VaultAsset, Error<UpdateVaultAccountAssetBalanceError>> {
3111 let UpdateVaultAccountAssetBalanceParams {
3112 vault_account_id,
3113 asset_id,
3114 idempotency_key,
3115 } = params;
3116
3117 let local_var_configuration = &self.configuration;
3118
3119 let local_var_client = &local_var_configuration.client;
3120
3121 let local_var_uri_str = format!(
3122 "{}/vault/accounts/{vaultAccountId}/{assetId}/balance",
3123 local_var_configuration.base_path,
3124 vaultAccountId = crate::apis::urlencode(vault_account_id),
3125 assetId = crate::apis::urlencode(asset_id)
3126 );
3127 let mut local_var_req_builder =
3128 local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
3129
3130 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
3131 local_var_req_builder = local_var_req_builder
3132 .header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
3133 }
3134 if let Some(local_var_param_value) = idempotency_key {
3135 local_var_req_builder =
3136 local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
3137 }
3138
3139 let local_var_req = local_var_req_builder.build()?;
3140 let local_var_resp = local_var_client.execute(local_var_req).await?;
3141
3142 let local_var_status = local_var_resp.status();
3143 let local_var_content_type = local_var_resp
3144 .headers()
3145 .get("content-type")
3146 .and_then(|v| v.to_str().ok())
3147 .unwrap_or("application/octet-stream");
3148 let local_var_content_type = super::ContentType::from(local_var_content_type);
3149 let local_var_content = local_var_resp.text().await?;
3150
3151 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
3152 match local_var_content_type {
3153 ContentType::Json => {
3154 crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
3155 }
3156 ContentType::Text => {
3157 return Err(Error::from(serde_json::Error::custom(
3158 "Received `text/plain` content type response that cannot be converted to \
3159 `models::VaultAsset`",
3160 )));
3161 }
3162 ContentType::Unsupported(local_var_unknown_type) => {
3163 return Err(Error::from(serde_json::Error::custom(format!(
3164 "Received `{local_var_unknown_type}` content type response that cannot be \
3165 converted to `models::VaultAsset`"
3166 ))));
3167 }
3168 }
3169 } else {
3170 let local_var_entity: Option<UpdateVaultAccountAssetBalanceError> =
3171 serde_json::from_str(&local_var_content).ok();
3172 let local_var_error = ResponseContent {
3173 status: local_var_status,
3174 content: local_var_content,
3175 entity: local_var_entity,
3176 };
3177 Err(Error::ResponseError(local_var_error))
3178 }
3179 }
3180}
3181
3182#[derive(Debug, Clone, Serialize, Deserialize)]
3185#[serde(untagged)]
3186pub enum ActivateAssetForVaultAccountError {
3187 DefaultResponse(models::ErrorSchema),
3188 UnknownValue(serde_json::Value),
3189}
3190
3191#[derive(Debug, Clone, Serialize, Deserialize)]
3194#[serde(untagged)]
3195pub enum AttachTagsToVaultAccountsError {
3196 UnknownValue(serde_json::Value),
3197}
3198
3199#[derive(Debug, Clone, Serialize, Deserialize)]
3201#[serde(untagged)]
3202pub enum CreateLegacyAddressError {
3203 DefaultResponse(models::ErrorSchema),
3204 UnknownValue(serde_json::Value),
3205}
3206
3207#[derive(Debug, Clone, Serialize, Deserialize)]
3209#[serde(untagged)]
3210pub enum CreateMultipleAccountsError {
3211 DefaultResponse(models::ErrorSchema),
3212 UnknownValue(serde_json::Value),
3213}
3214
3215#[derive(Debug, Clone, Serialize, Deserialize)]
3218#[serde(untagged)]
3219pub enum CreateMultipleDepositAddressesError {
3220 DefaultResponse(models::ErrorSchema),
3221 UnknownValue(serde_json::Value),
3222}
3223
3224#[derive(Debug, Clone, Serialize, Deserialize)]
3226#[serde(untagged)]
3227pub enum CreateVaultAccountError {
3228 DefaultResponse(models::ErrorSchema),
3229 UnknownValue(serde_json::Value),
3230}
3231
3232#[derive(Debug, Clone, Serialize, Deserialize)]
3234#[serde(untagged)]
3235pub enum CreateVaultAccountAssetError {
3236 DefaultResponse(models::ErrorSchema),
3237 UnknownValue(serde_json::Value),
3238}
3239
3240#[derive(Debug, Clone, Serialize, Deserialize)]
3243#[serde(untagged)]
3244pub enum CreateVaultAccountAssetAddressError {
3245 DefaultResponse(models::ErrorSchema),
3246 UnknownValue(serde_json::Value),
3247}
3248
3249#[derive(Debug, Clone, Serialize, Deserialize)]
3252#[serde(untagged)]
3253pub enum DetachTagsFromVaultAccountsError {
3254 UnknownValue(serde_json::Value),
3255}
3256
3257#[derive(Debug, Clone, Serialize, Deserialize)]
3259#[serde(untagged)]
3260pub enum GetAssetWalletsError {
3261 UnknownValue(serde_json::Value),
3262}
3263
3264#[derive(Debug, Clone, Serialize, Deserialize)]
3267#[serde(untagged)]
3268pub enum GetCreateMultipleDepositAddressesJobStatusError {
3269 DefaultResponse(models::ErrorSchema),
3270 UnknownValue(serde_json::Value),
3271}
3272
3273#[derive(Debug, Clone, Serialize, Deserialize)]
3276#[serde(untagged)]
3277pub enum GetCreateMultipleVaultAccountsJobStatusError {
3278 DefaultResponse(models::ErrorSchema),
3279 UnknownValue(serde_json::Value),
3280}
3281
3282#[derive(Debug, Clone, Serialize, Deserialize)]
3284#[serde(untagged)]
3285pub enum GetMaxSpendableAmountError {
3286 DefaultResponse(models::ErrorSchema),
3287 UnknownValue(serde_json::Value),
3288}
3289
3290#[derive(Debug, Clone, Serialize, Deserialize)]
3292#[serde(untagged)]
3293pub enum GetPagedVaultAccountsError {
3294 UnknownValue(serde_json::Value),
3295}
3296
3297#[derive(Debug, Clone, Serialize, Deserialize)]
3299#[serde(untagged)]
3300pub enum GetPublicKeyInfoError {
3301 DefaultResponse(models::ErrorSchema),
3302 UnknownValue(serde_json::Value),
3303}
3304
3305#[derive(Debug, Clone, Serialize, Deserialize)]
3308#[serde(untagged)]
3309pub enum GetPublicKeyInfoForAddressError {
3310 DefaultResponse(models::ErrorSchema),
3311 UnknownValue(serde_json::Value),
3312}
3313
3314#[derive(Debug, Clone, Serialize, Deserialize)]
3316#[serde(untagged)]
3317pub enum GetUnspentInputsError {
3318 DefaultResponse(models::ErrorSchema),
3319 UnknownValue(serde_json::Value),
3320}
3321
3322#[derive(Debug, Clone, Serialize, Deserialize)]
3324#[serde(untagged)]
3325pub enum GetVaultAccountError {
3326 DefaultResponse(models::ErrorSchema),
3327 UnknownValue(serde_json::Value),
3328}
3329
3330#[derive(Debug, Clone, Serialize, Deserialize)]
3332#[serde(untagged)]
3333pub enum GetVaultAccountAssetError {
3334 DefaultResponse(models::ErrorSchema),
3335 UnknownValue(serde_json::Value),
3336}
3337
3338#[derive(Debug, Clone, Serialize, Deserialize)]
3341#[serde(untagged)]
3342pub enum GetVaultAccountAssetAddressesError {
3343 DefaultResponse(models::ErrorSchema),
3344 UnknownValue(serde_json::Value),
3345}
3346
3347#[derive(Debug, Clone, Serialize, Deserialize)]
3350#[serde(untagged)]
3351pub enum GetVaultAccountAssetAddressesPaginatedError {
3352 DefaultResponse(models::ErrorSchema),
3353 UnknownValue(serde_json::Value),
3354}
3355
3356#[derive(Debug, Clone, Serialize, Deserialize)]
3358#[serde(untagged)]
3359pub enum GetVaultAssetsError {
3360 DefaultResponse(models::ErrorSchema),
3361 UnknownValue(serde_json::Value),
3362}
3363
3364#[derive(Debug, Clone, Serialize, Deserialize)]
3366#[serde(untagged)]
3367pub enum GetVaultBalanceByAssetError {
3368 DefaultResponse(models::ErrorSchema),
3369 UnknownValue(serde_json::Value),
3370}
3371
3372#[derive(Debug, Clone, Serialize, Deserialize)]
3374#[serde(untagged)]
3375pub enum HideVaultAccountError {
3376 DefaultResponse(models::ErrorSchema),
3377 UnknownValue(serde_json::Value),
3378}
3379
3380#[derive(Debug, Clone, Serialize, Deserialize)]
3383#[serde(untagged)]
3384pub enum SetCustomerRefIdForAddressError {
3385 DefaultResponse(models::ErrorSchema),
3386 UnknownValue(serde_json::Value),
3387}
3388
3389#[derive(Debug, Clone, Serialize, Deserialize)]
3391#[serde(untagged)]
3392pub enum SetVaultAccountAutoFuelError {
3393 DefaultResponse(models::ErrorSchema),
3394 UnknownValue(serde_json::Value),
3395}
3396
3397#[derive(Debug, Clone, Serialize, Deserialize)]
3400#[serde(untagged)]
3401pub enum SetVaultAccountCustomerRefIdError {
3402 DefaultResponse(models::ErrorSchema),
3403 UnknownValue(serde_json::Value),
3404}
3405
3406#[derive(Debug, Clone, Serialize, Deserialize)]
3408#[serde(untagged)]
3409pub enum UnhideVaultAccountError {
3410 DefaultResponse(models::ErrorSchema),
3411 UnknownValue(serde_json::Value),
3412}
3413
3414#[derive(Debug, Clone, Serialize, Deserialize)]
3416#[serde(untagged)]
3417pub enum UpdateVaultAccountError {
3418 DefaultResponse(models::ErrorSchema),
3419 UnknownValue(serde_json::Value),
3420}
3421
3422#[derive(Debug, Clone, Serialize, Deserialize)]
3425#[serde(untagged)]
3426pub enum UpdateVaultAccountAssetAddressError {
3427 DefaultResponse(models::ErrorSchema),
3428 UnknownValue(serde_json::Value),
3429}
3430
3431#[derive(Debug, Clone, Serialize, Deserialize)]
3434#[serde(untagged)]
3435pub enum UpdateVaultAccountAssetBalanceError {
3436 DefaultResponse(models::ErrorSchema),
3437 UnknownValue(serde_json::Value),
3438}