// Fireblocks API
//
// Fireblocks provides a suite of applications to manage digital asset operations and a complete development platform to build your business on the blockchain. - Visit our website for more information: [Fireblocks Website](https://fireblocks.com) - Visit our developer docs: [Fireblocks DevPortal](https://developers.fireblocks.com)
//
// The version of the OpenAPI document: 1.8.0
// Contact: developers@fireblocks.com
// Generated by: https://openapi-generator.tech
use {
super::{Error, configuration},
crate::{
apis::{ContentType, ResponseContent},
models,
},
async_trait::async_trait,
reqwest,
serde::{Deserialize, Serialize, de::Error as _},
std::sync::Arc,
};
#[async_trait]
pub trait FireblocksNetworkApi: Send + Sync {
/// GET /network_connections/{connectionId}/is_third_party_routing/
/// {assetType}
///
/// The Fireblocks Network allows for flexibility around incoming deposits.
/// A receiver can receive network deposits to locations other than
/// Fireblocks. This endpoint validates whether future transactions are
/// routed to the displayed recipient or to a 3rd party. </br>Endpoint
/// Permission: Admin, Non-Signing Admin.
async fn check_third_party_routing(
&self,
params: CheckThirdPartyRoutingParams,
) -> Result<models::ThirdPartyRouting, Error<CheckThirdPartyRoutingError>>;
/// POST /network_connections
///
/// Initiates a new network connection. **Note:** This API call is subject to Flexible Routing Schemes. Your routing policy defines how your transactions are routed. You can choose 1 of the 3 different schemes mentioned below for each asset type: - **None**; Defines the profile routing to no destination for that asset type. Incoming transactions to asset types routed to `None` will fail. - **Custom**; Route to an account that you choose. If you remove the account, incoming transactions will fail until you choose another one. - **Default**; Use the routing specified by the network profile the connection is connected to. This scheme is also referred to as \"Profile Routing\" Default Workspace Presets: - Network Profile Crypto → **Custom** - Network Profile FIAT → **None** - Network Connection Crypto → **Default** - Network Connection FIAT → **Default** Supported asset groups for routing policy can be found at `/network_ids/routing_policy_asset_groups` **Note**: By default, Custom routing scheme uses (`dstId` = `0`, `dstType` = `VAULT`). Learn more about Fireblocks Network in the following [guide](https://developers.fireblocks.com/docs/connect-to-the-fireblocks-network). </br>Endpoint Permission: Admin, Non-Signing Admin.
async fn create_network_connection(
&self,
params: CreateNetworkConnectionParams,
) -> Result<models::NetworkConnectionResponse, Error<CreateNetworkConnectionError>>;
/// POST /network_ids
///
/// Creates a new Network ID. **Note:** This API call is subject to
/// Flexible Routing Schemes. Your routing policy defines how your
/// transactions are routed. You can choose 1 of the 3 different schemes
/// mentioned below for each asset type: - **None**; Defines the profile
/// routing to no destination for that asset type. Incoming transactions to
/// asset types routed to `None` will fail. - **Custom**; Route to an
/// account that you choose. If you remove the account, incoming
/// transactions will fail until you choose another one. - **Default**;
/// Use the routing specified by the network profile the connection is
/// connected to. This scheme is also referred to as \"Profile Routing\"
/// Default Workspace Presets: - Network Profile Crypto → **Custom** -
/// Network Profile FIAT → **None** - Network Connection Crypto →
/// **Default** - Network Connection FIAT → **Default** Supported asset
/// groups for routing policy can be found at
/// `/network_ids/routing_policy_asset_groups` **Note**: By default, Custom
/// routing scheme uses (`dstId` = `0`, `dstType` = `VAULT`). </br>Endpoint
/// Permission: Admin, Non-Signing Admin.
async fn create_network_id(
&self,
params: CreateNetworkIdParams,
) -> Result<models::NetworkIdResponse, Error<CreateNetworkIdError>>;
/// DELETE /network_connections/{connectionId}
///
/// Deletes an existing network connection specified by its connection ID.
/// **Note:** This API call is subject to Flexible Routing Schemes. Your
/// routing policy defines how your transactions are routed. You can choose
/// 1 of the 3 different schemes mentioned below for each asset type: -
/// **None**; Defines the profile routing to no destination for that asset
/// type. Incoming transactions to asset types routed to `None` will fail.
/// - **Custom**; Route to an account that you choose. If you remove the
/// account, incoming transactions will fail until you choose another one.
/// - **Default**; Use the routing specified by the network profile the
/// connection is connected to. This scheme is also referred to as \"Profile
/// Routing\" Default Workspace Presets: - Network Profile Crypto →
/// **Custom** - Network Profile FIAT → **None** - Network Connection
/// Crypto → **Default** - Network Connection FIAT → **Default**
/// **Note**: By default, Custom routing scheme uses (`dstId` = `0`,
/// `dstType` = `VAULT`). </br>Endpoint Permission: Admin, Non-Signing
/// Admin.
async fn delete_network_connection(
&self,
params: DeleteNetworkConnectionParams,
) -> Result<models::DeleteNetworkConnectionResponse, Error<DeleteNetworkConnectionError>>;
/// DELETE /network_ids/{networkId}
///
/// Deletes a network by its ID. **Note:** This API call is subject to
/// Flexible Routing Schemes. Your routing policy defines how your
/// transactions are routed. You can choose 1 of the 3 different schemes
/// mentioned below for each asset type: - **None**; Defines the profile
/// routing to no destination for that asset type. Incoming transactions to
/// asset types routed to `None` will fail. - **Custom**; Route to an
/// account that you choose. If you remove the account, incoming
/// transactions will fail until you choose another one. - **Default**;
/// Use the routing specified by the network profile the connection is
/// connected to. This scheme is also referred to as \"Profile Routing\"
/// Default Workspace Presets: - Network Profile Crypto → **Custom** -
/// Network Profile FIAT → **None** - Network Connection Crypto →
/// **Default** - Network Connection FIAT → **Default** **Note**: By
/// default, Custom routing scheme uses (`dstId` = `0`, `dstType` =
/// `VAULT`). </br>Endpoint Permission: Admin, Non-Signing Admin.
async fn delete_network_id(
&self,
params: DeleteNetworkIdParams,
) -> Result<models::DeleteNetworkIdResponse, Error<DeleteNetworkIdError>>;
/// GET /network_connections/{connectionId}
///
/// Gets a network connection by ID. **Note:** This API call is subject to
/// Flexible Routing Schemes. Your routing policy defines how your
/// transactions are routed. You can choose 1 of the 3 different schemes
/// mentioned below for each asset type: - **None**; Defines the profile
/// routing to no destination for that asset type. Incoming transactions to
/// asset types routed to `None` will fail. - **Custom**; Route to an
/// account that you choose. If you remove the account, incoming
/// transactions will fail until you choose another one. - **Default**;
/// Use the routing specified by the network profile the connection is
/// connected to. This scheme is also referred to as \"Profile Routing\"
/// Default Workspace Presets: - Network Profile Crypto → **Custom** -
/// Network Profile FIAT → **None** - Network Connection Crypto →
/// **Default** - Network Connection FIAT → **Default** **Note**: By
/// default, Custom routing scheme uses (`dstId` = `0`, `dstType` =
/// `VAULT`). </br>Endpoint Permission: Admin, Non-Signing Admin.
async fn get_network(
&self,
params: GetNetworkParams,
) -> Result<models::NetworkConnectionResponse, Error<GetNetworkError>>;
/// GET /network_connections
///
/// Returns all network connections. **Note:** This API call is subject to
/// Flexible Routing Schemes. Your routing policy defines how your
/// transactions are routed. You can choose 1 of the 3 different schemes
/// mentioned below for each asset type: - **None**; Defines the profile
/// routing to no destination for that asset type. Incoming transactions to
/// asset types routed to `None` will fail. - **Custom**; Route to an
/// account that you choose. If you remove the account, incoming
/// transactions will fail until you choose another one. - **Default**;
/// Use the routing specified by the network profile the connection is
/// connected to. This scheme is also referred to as \"Profile Routing\"
/// Default Workspace Presets: - Network Profile Crypto → **Custom** -
/// Network Profile FIAT → **None** - Network Connection Crypto →
/// **Default** - Network Connection FIAT → **Default** - **Note**:
/// By default, Custom routing scheme uses (`dstId` = `0`, `dstType` =
/// `VAULT`). </br>Endpoint Permission: Admin, Non-Signing Admin.
async fn get_network_connections(
&self,
) -> Result<Vec<models::NetworkConnectionResponse>, Error<GetNetworkConnectionsError>>;
/// GET /network_ids/{networkId}
///
/// Retrieves a network by its ID. **Note:** This API call is subject to
/// Flexible Routing Schemes. Your routing policy defines how your
/// transactions are routed. You can choose 1 of the 3 different schemes
/// mentioned below for each asset type: - **None**; Defines the profile
/// routing to no destination for that asset type. Incoming transactions to
/// asset types routed to `None` will fail. - **Custom**; Route to an
/// account that you choose. If you remove the account, incoming
/// transactions will fail until you choose another one. - **Default**;
/// Use the routing specified by the network profile the connection is
/// connected to. This scheme is also referred to as \"Profile Routing\"
/// Default Workspace Presets: - Network Profile Crypto → **Custom** -
/// Network Profile FIAT → **None** - Network Connection Crypto →
/// **Default** - Network Connection FIAT → **Default** **Note**: By
/// default, Custom routing scheme uses (`dstId` = `0`, `dstType` =
/// `VAULT`). </br>Endpoint Permission: Admin, Non-Signing Admin.
async fn get_network_id(
&self,
params: GetNetworkIdParams,
) -> Result<models::NetworkIdResponse, Error<GetNetworkIdError>>;
/// GET /network_ids
///
/// Retrieves a list of all local and discoverable remote network IDs.
/// **Note:** This API call is subject to Flexible Routing Schemes. Your
/// routing policy defines how your transactions are routed. You can choose
/// 1 of the 3 different schemes mentioned below for each asset type: -
/// **None**; Defines the profile routing to no destination for that asset
/// type. Incoming transactions to asset types routed to `None` will fail.
/// - **Custom**; Route to an account that you choose. If you remove the
/// account, incoming transactions will fail until you choose another one.
/// - **Default**; Use the routing specified by the network profile the
/// connection is connected to. This scheme is also referred to as \"Profile
/// Routing\" Default Workspace Presets: - Network Profile Crypto →
/// **Custom** - Network Profile FIAT → **None** - Network Connection
/// Crypto → **Default** - Network Connection FIAT → **Default**
/// **Note**: By default, Custom routing scheme uses (`dstId` = `0`,
/// `dstType` = `VAULT`). </br>Endpoint Permission: Admin, Non-Signing
/// Admin.
async fn get_network_ids(
&self,
) -> Result<Vec<models::NetworkIdResponse>, Error<GetNetworkIdsError>>;
/// GET /network_ids/routing_policy_asset_groups
///
/// Retrieves a list of all enabled routing policy asset groups. Your
/// routing policy defines how your transactions are routed. You can use one
/// or more enabled routing policy asset groups to describe connection or
/// network id routing policy. </br>Endpoint Permission: Admin, Non-Signing
/// Admin.
async fn get_routing_policy_asset_groups(
&self,
) -> Result<Vec<String>, Error<GetRoutingPolicyAssetGroupsError>>;
/// GET /network_ids/search
///
/// Retrieves a list of all local and discoverable remote network IDs. Can
/// be filtered. **Note:** This API call is subject to Flexible Routing
/// Schemes. Your routing policy defines how your transactions are routed.
/// You can choose 1 of the 3 different schemes mentioned below for each
/// asset type: - **None**; Defines the profile routing to no destination
/// for that asset type. Incoming transactions to asset types routed to
/// `None` will fail. - **Custom**; Route to an account that you choose.
/// If you remove the account, incoming transactions will fail until you
/// choose another one. - **Default**; Use the routing specified by the
/// network profile the connection is connected to. This scheme is also
/// referred to as \"Profile Routing\" Default Workspace Presets: -
/// Network Profile Crypto → **Custom** - Network Profile FIAT → **None**
/// - Network Connection Crypto → **Default** - Network Connection FIAT →
/// **Default** - **Note**: By default, Custom routing scheme uses
/// (`dstId` = `0`, `dstType` = `VAULT`).
async fn search_network_ids(
&self,
params: SearchNetworkIdsParams,
) -> Result<models::SearchNetworkIdsResponse, Error<SearchNetworkIdsError>>;
/// PATCH /network_ids/{networkId}/set_discoverability
///
/// Update whether or not the network ID is discoverable by others.
/// **Note:** This API call is subject to Flexible Routing Schemes. Your
/// routing policy defines how your transactions are routed. You can choose
/// 1 of the 3 different schemes mentioned below for each asset type: -
/// **None**; Defines the profile routing to no destination for that asset
/// type. Incoming transactions to asset types routed to `None` will fail.
/// - **Custom**; Route to an account that you choose. If you remove the
/// account, incoming transactions will fail until you choose another one.
/// - **Default**; Use the routing specified by the network profile the
/// connection is connected to. This scheme is also referred to as \"Profile
/// Routing\" Default Workspace Presets: - Network Profile Crypto →
/// **Custom** - Network Profile FIAT → **None** - Network Connection
/// Crypto → **Default** - Network Connection FIAT → **Default**
/// **Note**: By default, Custom routing scheme uses (`dstId` = `0`,
/// `dstType` = `VAULT`). </br>Endpoint Permission: Admin, Non-Signing
/// Admin.
async fn set_network_id_discoverability(
&self,
params: SetNetworkIdDiscoverabilityParams,
) -> Result<models::SetNetworkIdResponse, Error<SetNetworkIdDiscoverabilityError>>;
/// PATCH /network_ids/{networkId}/set_name
///
/// Updates name of a specified network ID. **Note:** This API call is
/// subject to Flexible Routing Schemes. Your routing policy defines how
/// your transactions are routed. You can choose 1 of the 3 different
/// schemes mentioned below for each asset type: - **None**; Defines the
/// profile routing to no destination for that asset type. Incoming
/// transactions to asset types routed to `None` will fail. - **Custom**;
/// Route to an account that you choose. If you remove the account, incoming
/// transactions will fail until you choose another one. - **Default**;
/// Use the routing specified by the network profile the connection is
/// connected to. This scheme is also referred to as \"Profile Routing\"
/// Default Workspace Presets: - Network Profile Crypto → **Custom** -
/// Network Profile FIAT → **None** - Network Connection Crypto →
/// **Default** - Network Connection FIAT → **Default** **Note**: By
/// default, Custom routing scheme uses (`dstId` = `0`, `dstType` =
/// `VAULT`). </br>Endpoint Permission: Admin, Non-Signing Admin.
async fn set_network_id_name(
&self,
params: SetNetworkIdNameParams,
) -> Result<models::SetNetworkIdResponse, Error<SetNetworkIdNameError>>;
/// PATCH /network_ids/{networkId}/set_routing_policy
///
/// Updates the routing policy of a specified network ID. **Note:** This
/// API call is subject to Flexible Routing Schemes. Your routing policy
/// defines how your transactions are routed. You can choose 1 of the 3
/// different schemes mentioned below for each asset type: - **None**;
/// Defines the profile routing to no destination for that asset type.
/// Incoming transactions to asset types routed to `None` will fail. -
/// **Custom**; Route to an account that you choose. If you remove the
/// account, incoming transactions will fail until you choose another one.
/// - **Default**; Use the routing specified by the network profile the
/// connection is connected to. This scheme is also referred to as \"Profile
/// Routing\" Default Workspace Presets: - Network Profile Crypto →
/// **Custom** - Network Profile FIAT → **None** - Network Connection
/// Crypto → **Default** - Network Connection FIAT → **Default**
/// Supported asset groups for routing policy can be found at
/// `/network_ids/routing_policy_asset_groups` **Note**: By default, Custom
/// routing scheme uses (`dstId` = `0`, `dstType` = `VAULT`). </br>Endpoint
/// Permission: Admin, Non-Signing Admin.
async fn set_network_id_routing_policy(
&self,
params: SetNetworkIdRoutingPolicyParams,
) -> Result<models::SetNetworkIdResponse, Error<SetNetworkIdRoutingPolicyError>>;
/// PATCH /network_connections/{connectionId}/set_routing_policy
///
/// Updates an existing network connection's routing policy. **Note:** This
/// API call is subject to Flexible Routing Schemes. Your routing policy
/// defines how your transactions are routed. You can choose 1 of the 3
/// different schemes mentioned below for each asset type: - **None**;
/// Defines the profile routing to no destination for that asset type.
/// Incoming transactions to asset types routed to `None` will fail. -
/// **Custom**; Route to an account that you choose. If you remove the
/// account, incoming transactions will fail until you choose another one.
/// - **Default**; Use the routing specified by the network profile the
/// connection is connected to. This scheme is also referred to as \"Profile
/// Routing\" Default Workspace Presets: - Network Profile Crypto →
/// **Custom** - Network Profile FIAT → **None** - Network Connection
/// Crypto → **Default** - Network Connection FIAT → **Default**
/// Supported asset groups for routing policy can be found at
/// `/network_ids/routing_policy_asset_groups` **Note**: By default, Custom
/// routing scheme uses (`dstId` = `0`, `dstType` = `VAULT`). </br>Endpoint
/// Permission: Admin, Non-Signing Admin.
async fn set_routing_policy(
&self,
params: SetRoutingPolicyParams,
) -> Result<models::SetRoutingPolicyResponse, Error<SetRoutingPolicyError>>;
}
pub struct FireblocksNetworkApiClient {
configuration: Arc<configuration::Configuration>,
}
impl FireblocksNetworkApiClient {
pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
Self { configuration }
}
}
/// struct for passing parameters to the method
/// [`FireblocksNetworkApi::check_third_party_routing`]
#[derive(Clone, Debug)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
pub struct CheckThirdPartyRoutingParams {
/// The ID of the network connection
pub connection_id: String,
/// The destination asset type
pub asset_type: String,
}
/// struct for passing parameters to the method
/// [`FireblocksNetworkApi::create_network_connection`]
#[derive(Clone, Debug)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
pub struct CreateNetworkConnectionParams {
/// A unique identifier for the request. If the request is sent multiple
/// times with the same idempotency key, the server will return the same
/// response as the first request. The idempotency key is valid for 24
/// hours.
pub idempotency_key: Option<String>,
pub network_connection: Option<models::NetworkConnection>,
}
/// struct for passing parameters to the method
/// [`FireblocksNetworkApi::create_network_id`]
#[derive(Clone, Debug)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
pub struct CreateNetworkIdParams {
/// A unique identifier for the request. If the request is sent multiple
/// times with the same idempotency key, the server will return the same
/// response as the first request. The idempotency key is valid for 24
/// hours.
pub idempotency_key: Option<String>,
pub create_network_id_request: Option<models::CreateNetworkIdRequest>,
}
/// struct for passing parameters to the method
/// [`FireblocksNetworkApi::delete_network_connection`]
#[derive(Clone, Debug)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
pub struct DeleteNetworkConnectionParams {
/// The ID of the network connection to delete
pub connection_id: String,
}
/// struct for passing parameters to the method
/// [`FireblocksNetworkApi::delete_network_id`]
#[derive(Clone, Debug)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
pub struct DeleteNetworkIdParams {
/// The ID of the network
pub network_id: String,
}
/// struct for passing parameters to the method
/// [`FireblocksNetworkApi::get_network`]
#[derive(Clone, Debug)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
pub struct GetNetworkParams {
/// The ID of the connection
pub connection_id: String,
}
/// struct for passing parameters to the method
/// [`FireblocksNetworkApi::get_network_id`]
#[derive(Clone, Debug)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
pub struct GetNetworkIdParams {
/// The ID of the network
pub network_id: String,
}
/// struct for passing parameters to the method
/// [`FireblocksNetworkApi::search_network_ids`]
#[derive(Clone, Debug)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
pub struct SearchNetworkIdsParams {
/// Search string - displayName networkId. Optional
pub search: Option<String>,
/// Exclude your networkIds. Optional, default false
pub exclude_self: Option<bool>,
/// Exclude connected networkIds. Optional, default false
pub exclude_connected: Option<bool>,
/// ID of the record after which to fetch $limit records
pub page_cursor: Option<String>,
/// Number of records to fetch. By default, it is 50
pub page_size: Option<f64>,
}
/// struct for passing parameters to the method
/// [`FireblocksNetworkApi::set_network_id_discoverability`]
#[derive(Clone, Debug)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
pub struct SetNetworkIdDiscoverabilityParams {
/// The ID of the network
pub network_id: String,
pub set_network_id_discoverability_request: models::SetNetworkIdDiscoverabilityRequest,
}
/// struct for passing parameters to the method
/// [`FireblocksNetworkApi::set_network_id_name`]
#[derive(Clone, Debug)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
pub struct SetNetworkIdNameParams {
/// The ID of the network
pub network_id: String,
pub set_network_id_name_request: models::SetNetworkIdNameRequest,
}
/// struct for passing parameters to the method
/// [`FireblocksNetworkApi::set_network_id_routing_policy`]
#[derive(Clone, Debug)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
pub struct SetNetworkIdRoutingPolicyParams {
/// The ID of the network
pub network_id: String,
pub set_network_id_routing_policy_request: Option<models::SetNetworkIdRoutingPolicyRequest>,
}
/// struct for passing parameters to the method
/// [`FireblocksNetworkApi::set_routing_policy`]
#[derive(Clone, Debug)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
pub struct SetRoutingPolicyParams {
/// The ID of the network connection
pub connection_id: String,
pub set_routing_policy_request: Option<models::SetRoutingPolicyRequest>,
}
#[async_trait]
impl FireblocksNetworkApi for FireblocksNetworkApiClient {
/// The Fireblocks Network allows for flexibility around incoming deposits.
/// A receiver can receive network deposits to locations other than
/// Fireblocks. This endpoint validates whether future transactions are
/// routed to the displayed recipient or to a 3rd party. </br>Endpoint
/// Permission: Admin, Non-Signing Admin.
async fn check_third_party_routing(
&self,
params: CheckThirdPartyRoutingParams,
) -> Result<models::ThirdPartyRouting, Error<CheckThirdPartyRoutingError>> {
let CheckThirdPartyRoutingParams {
connection_id,
asset_type,
} = params;
let local_var_configuration = &self.configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/network_connections/{connectionId}/is_third_party_routing/{assetType}",
local_var_configuration.base_path,
connectionId = crate::apis::urlencode(connection_id),
assetType = crate::apis::urlencode(asset_type)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content_type = local_var_resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let local_var_content_type = super::ContentType::from(local_var_content_type);
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
match local_var_content_type {
ContentType::Json => {
crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
}
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to \
`models::ThirdPartyRouting`",
)));
}
ContentType::Unsupported(local_var_unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{local_var_unknown_type}` content type response that cannot be \
converted to `models::ThirdPartyRouting`"
))));
}
}
} else {
let local_var_entity: Option<CheckThirdPartyRoutingError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Initiates a new network connection. **Note:** This API call is subject to Flexible Routing Schemes. Your routing policy defines how your transactions are routed. You can choose 1 of the 3 different schemes mentioned below for each asset type: - **None**; Defines the profile routing to no destination for that asset type. Incoming transactions to asset types routed to `None` will fail. - **Custom**; Route to an account that you choose. If you remove the account, incoming transactions will fail until you choose another one. - **Default**; Use the routing specified by the network profile the connection is connected to. This scheme is also referred to as \"Profile Routing\" Default Workspace Presets: - Network Profile Crypto → **Custom** - Network Profile FIAT → **None** - Network Connection Crypto → **Default** - Network Connection FIAT → **Default** Supported asset groups for routing policy can be found at `/network_ids/routing_policy_asset_groups` **Note**: By default, Custom routing scheme uses (`dstId` = `0`, `dstType` = `VAULT`). Learn more about Fireblocks Network in the following [guide](https://developers.fireblocks.com/docs/connect-to-the-fireblocks-network). </br>Endpoint Permission: Admin, Non-Signing Admin.
async fn create_network_connection(
&self,
params: CreateNetworkConnectionParams,
) -> Result<models::NetworkConnectionResponse, Error<CreateNetworkConnectionError>> {
let CreateNetworkConnectionParams {
idempotency_key,
network_connection,
} = params;
let local_var_configuration = &self.configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str =
format!("{}/network_connections", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(local_var_param_value) = idempotency_key {
local_var_req_builder =
local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
}
local_var_req_builder = local_var_req_builder.json(&network_connection);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content_type = local_var_resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let local_var_content_type = super::ContentType::from(local_var_content_type);
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
match local_var_content_type {
ContentType::Json => {
crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
}
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to \
`models::NetworkConnectionResponse`",
)));
}
ContentType::Unsupported(local_var_unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{local_var_unknown_type}` content type response that cannot be \
converted to `models::NetworkConnectionResponse`"
))));
}
}
} else {
let local_var_entity: Option<CreateNetworkConnectionError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Creates a new Network ID. **Note:** This API call is subject to
/// Flexible Routing Schemes. Your routing policy defines how your
/// transactions are routed. You can choose 1 of the 3 different schemes
/// mentioned below for each asset type: - **None**; Defines the profile
/// routing to no destination for that asset type. Incoming transactions to
/// asset types routed to `None` will fail. - **Custom**; Route to an
/// account that you choose. If you remove the account, incoming
/// transactions will fail until you choose another one. - **Default**;
/// Use the routing specified by the network profile the connection is
/// connected to. This scheme is also referred to as \"Profile Routing\"
/// Default Workspace Presets: - Network Profile Crypto → **Custom** -
/// Network Profile FIAT → **None** - Network Connection Crypto →
/// **Default** - Network Connection FIAT → **Default** Supported asset
/// groups for routing policy can be found at
/// `/network_ids/routing_policy_asset_groups` **Note**: By default, Custom
/// routing scheme uses (`dstId` = `0`, `dstType` = `VAULT`). </br>Endpoint
/// Permission: Admin, Non-Signing Admin.
async fn create_network_id(
&self,
params: CreateNetworkIdParams,
) -> Result<models::NetworkIdResponse, Error<CreateNetworkIdError>> {
let CreateNetworkIdParams {
idempotency_key,
create_network_id_request,
} = params;
let local_var_configuration = &self.configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/network_ids", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(local_var_param_value) = idempotency_key {
local_var_req_builder =
local_var_req_builder.header("Idempotency-Key", local_var_param_value.to_string());
}
local_var_req_builder = local_var_req_builder.json(&create_network_id_request);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content_type = local_var_resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let local_var_content_type = super::ContentType::from(local_var_content_type);
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
match local_var_content_type {
ContentType::Json => {
crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
}
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to \
`models::NetworkIdResponse`",
)));
}
ContentType::Unsupported(local_var_unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{local_var_unknown_type}` content type response that cannot be \
converted to `models::NetworkIdResponse`"
))));
}
}
} else {
let local_var_entity: Option<CreateNetworkIdError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Deletes an existing network connection specified by its connection ID.
/// **Note:** This API call is subject to Flexible Routing Schemes. Your
/// routing policy defines how your transactions are routed. You can choose
/// 1 of the 3 different schemes mentioned below for each asset type: -
/// **None**; Defines the profile routing to no destination for that asset
/// type. Incoming transactions to asset types routed to `None` will fail.
/// - **Custom**; Route to an account that you choose. If you remove the
/// account, incoming transactions will fail until you choose another one.
/// - **Default**; Use the routing specified by the network profile the
/// connection is connected to. This scheme is also referred to as \"Profile
/// Routing\" Default Workspace Presets: - Network Profile Crypto →
/// **Custom** - Network Profile FIAT → **None** - Network Connection
/// Crypto → **Default** - Network Connection FIAT → **Default**
/// **Note**: By default, Custom routing scheme uses (`dstId` = `0`,
/// `dstType` = `VAULT`). </br>Endpoint Permission: Admin, Non-Signing
/// Admin.
async fn delete_network_connection(
&self,
params: DeleteNetworkConnectionParams,
) -> Result<models::DeleteNetworkConnectionResponse, Error<DeleteNetworkConnectionError>> {
let DeleteNetworkConnectionParams { connection_id } = params;
let local_var_configuration = &self.configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/network_connections/{connectionId}",
local_var_configuration.base_path,
connectionId = crate::apis::urlencode(connection_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content_type = local_var_resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let local_var_content_type = super::ContentType::from(local_var_content_type);
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
match local_var_content_type {
ContentType::Json => {
crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
}
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to \
`models::DeleteNetworkConnectionResponse`",
)));
}
ContentType::Unsupported(local_var_unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{local_var_unknown_type}` content type response that cannot be \
converted to `models::DeleteNetworkConnectionResponse`"
))));
}
}
} else {
let local_var_entity: Option<DeleteNetworkConnectionError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Deletes a network by its ID. **Note:** This API call is subject to
/// Flexible Routing Schemes. Your routing policy defines how your
/// transactions are routed. You can choose 1 of the 3 different schemes
/// mentioned below for each asset type: - **None**; Defines the profile
/// routing to no destination for that asset type. Incoming transactions to
/// asset types routed to `None` will fail. - **Custom**; Route to an
/// account that you choose. If you remove the account, incoming
/// transactions will fail until you choose another one. - **Default**;
/// Use the routing specified by the network profile the connection is
/// connected to. This scheme is also referred to as \"Profile Routing\"
/// Default Workspace Presets: - Network Profile Crypto → **Custom** -
/// Network Profile FIAT → **None** - Network Connection Crypto →
/// **Default** - Network Connection FIAT → **Default** **Note**: By
/// default, Custom routing scheme uses (`dstId` = `0`, `dstType` =
/// `VAULT`). </br>Endpoint Permission: Admin, Non-Signing Admin.
async fn delete_network_id(
&self,
params: DeleteNetworkIdParams,
) -> Result<models::DeleteNetworkIdResponse, Error<DeleteNetworkIdError>> {
let DeleteNetworkIdParams { network_id } = params;
let local_var_configuration = &self.configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/network_ids/{networkId}",
local_var_configuration.base_path,
networkId = crate::apis::urlencode(network_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content_type = local_var_resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let local_var_content_type = super::ContentType::from(local_var_content_type);
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
match local_var_content_type {
ContentType::Json => {
crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
}
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to \
`models::DeleteNetworkIdResponse`",
)));
}
ContentType::Unsupported(local_var_unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{local_var_unknown_type}` content type response that cannot be \
converted to `models::DeleteNetworkIdResponse`"
))));
}
}
} else {
let local_var_entity: Option<DeleteNetworkIdError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Gets a network connection by ID. **Note:** This API call is subject to
/// Flexible Routing Schemes. Your routing policy defines how your
/// transactions are routed. You can choose 1 of the 3 different schemes
/// mentioned below for each asset type: - **None**; Defines the profile
/// routing to no destination for that asset type. Incoming transactions to
/// asset types routed to `None` will fail. - **Custom**; Route to an
/// account that you choose. If you remove the account, incoming
/// transactions will fail until you choose another one. - **Default**;
/// Use the routing specified by the network profile the connection is
/// connected to. This scheme is also referred to as \"Profile Routing\"
/// Default Workspace Presets: - Network Profile Crypto → **Custom** -
/// Network Profile FIAT → **None** - Network Connection Crypto →
/// **Default** - Network Connection FIAT → **Default** **Note**: By
/// default, Custom routing scheme uses (`dstId` = `0`, `dstType` =
/// `VAULT`). </br>Endpoint Permission: Admin, Non-Signing Admin.
async fn get_network(
&self,
params: GetNetworkParams,
) -> Result<models::NetworkConnectionResponse, Error<GetNetworkError>> {
let GetNetworkParams { connection_id } = params;
let local_var_configuration = &self.configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/network_connections/{connectionId}",
local_var_configuration.base_path,
connectionId = crate::apis::urlencode(connection_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content_type = local_var_resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let local_var_content_type = super::ContentType::from(local_var_content_type);
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
match local_var_content_type {
ContentType::Json => {
crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
}
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to \
`models::NetworkConnectionResponse`",
)));
}
ContentType::Unsupported(local_var_unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{local_var_unknown_type}` content type response that cannot be \
converted to `models::NetworkConnectionResponse`"
))));
}
}
} else {
let local_var_entity: Option<GetNetworkError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Returns all network connections. **Note:** This API call is subject to
/// Flexible Routing Schemes. Your routing policy defines how your
/// transactions are routed. You can choose 1 of the 3 different schemes
/// mentioned below for each asset type: - **None**; Defines the profile
/// routing to no destination for that asset type. Incoming transactions to
/// asset types routed to `None` will fail. - **Custom**; Route to an
/// account that you choose. If you remove the account, incoming
/// transactions will fail until you choose another one. - **Default**;
/// Use the routing specified by the network profile the connection is
/// connected to. This scheme is also referred to as \"Profile Routing\"
/// Default Workspace Presets: - Network Profile Crypto → **Custom** -
/// Network Profile FIAT → **None** - Network Connection Crypto →
/// **Default** - Network Connection FIAT → **Default** - **Note**:
/// By default, Custom routing scheme uses (`dstId` = `0`, `dstType` =
/// `VAULT`). </br>Endpoint Permission: Admin, Non-Signing Admin.
async fn get_network_connections(
&self,
) -> Result<Vec<models::NetworkConnectionResponse>, Error<GetNetworkConnectionsError>> {
let local_var_configuration = &self.configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str =
format!("{}/network_connections", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content_type = local_var_resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let local_var_content_type = super::ContentType::from(local_var_content_type);
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
match local_var_content_type {
ContentType::Json => {
crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
}
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to \
`Vec<models::NetworkConnectionResponse>`",
)));
}
ContentType::Unsupported(local_var_unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{local_var_unknown_type}` content type response that cannot be \
converted to `Vec<models::NetworkConnectionResponse>`"
))));
}
}
} else {
let local_var_entity: Option<GetNetworkConnectionsError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Retrieves a network by its ID. **Note:** This API call is subject to
/// Flexible Routing Schemes. Your routing policy defines how your
/// transactions are routed. You can choose 1 of the 3 different schemes
/// mentioned below for each asset type: - **None**; Defines the profile
/// routing to no destination for that asset type. Incoming transactions to
/// asset types routed to `None` will fail. - **Custom**; Route to an
/// account that you choose. If you remove the account, incoming
/// transactions will fail until you choose another one. - **Default**;
/// Use the routing specified by the network profile the connection is
/// connected to. This scheme is also referred to as \"Profile Routing\"
/// Default Workspace Presets: - Network Profile Crypto → **Custom** -
/// Network Profile FIAT → **None** - Network Connection Crypto →
/// **Default** - Network Connection FIAT → **Default** **Note**: By
/// default, Custom routing scheme uses (`dstId` = `0`, `dstType` =
/// `VAULT`). </br>Endpoint Permission: Admin, Non-Signing Admin.
async fn get_network_id(
&self,
params: GetNetworkIdParams,
) -> Result<models::NetworkIdResponse, Error<GetNetworkIdError>> {
let GetNetworkIdParams { network_id } = params;
let local_var_configuration = &self.configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/network_ids/{networkId}",
local_var_configuration.base_path,
networkId = crate::apis::urlencode(network_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content_type = local_var_resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let local_var_content_type = super::ContentType::from(local_var_content_type);
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
match local_var_content_type {
ContentType::Json => {
crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
}
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to \
`models::NetworkIdResponse`",
)));
}
ContentType::Unsupported(local_var_unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{local_var_unknown_type}` content type response that cannot be \
converted to `models::NetworkIdResponse`"
))));
}
}
} else {
let local_var_entity: Option<GetNetworkIdError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Retrieves a list of all local and discoverable remote network IDs.
/// **Note:** This API call is subject to Flexible Routing Schemes. Your
/// routing policy defines how your transactions are routed. You can choose
/// 1 of the 3 different schemes mentioned below for each asset type: -
/// **None**; Defines the profile routing to no destination for that asset
/// type. Incoming transactions to asset types routed to `None` will fail.
/// - **Custom**; Route to an account that you choose. If you remove the
/// account, incoming transactions will fail until you choose another one.
/// - **Default**; Use the routing specified by the network profile the
/// connection is connected to. This scheme is also referred to as \"Profile
/// Routing\" Default Workspace Presets: - Network Profile Crypto →
/// **Custom** - Network Profile FIAT → **None** - Network Connection
/// Crypto → **Default** - Network Connection FIAT → **Default**
/// **Note**: By default, Custom routing scheme uses (`dstId` = `0`,
/// `dstType` = `VAULT`). </br>Endpoint Permission: Admin, Non-Signing
/// Admin.
async fn get_network_ids(
&self,
) -> Result<Vec<models::NetworkIdResponse>, Error<GetNetworkIdsError>> {
let local_var_configuration = &self.configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/network_ids", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content_type = local_var_resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let local_var_content_type = super::ContentType::from(local_var_content_type);
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
match local_var_content_type {
ContentType::Json => {
crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
}
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to \
`Vec<models::NetworkIdResponse>`",
)));
}
ContentType::Unsupported(local_var_unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{local_var_unknown_type}` content type response that cannot be \
converted to `Vec<models::NetworkIdResponse>`"
))));
}
}
} else {
let local_var_entity: Option<GetNetworkIdsError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Retrieves a list of all enabled routing policy asset groups. Your
/// routing policy defines how your transactions are routed. You can use one
/// or more enabled routing policy asset groups to describe connection or
/// network id routing policy. </br>Endpoint Permission: Admin, Non-Signing
/// Admin.
async fn get_routing_policy_asset_groups(
&self,
) -> Result<Vec<String>, Error<GetRoutingPolicyAssetGroupsError>> {
let local_var_configuration = &self.configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/network_ids/routing_policy_asset_groups",
local_var_configuration.base_path
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content_type = local_var_resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let local_var_content_type = super::ContentType::from(local_var_content_type);
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
match local_var_content_type {
ContentType::Json => {
crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
}
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to \
`Vec<String>`",
)));
}
ContentType::Unsupported(local_var_unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{local_var_unknown_type}` content type response that cannot be \
converted to `Vec<String>`"
))));
}
}
} else {
let local_var_entity: Option<GetRoutingPolicyAssetGroupsError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Retrieves a list of all local and discoverable remote network IDs. Can
/// be filtered. **Note:** This API call is subject to Flexible Routing
/// Schemes. Your routing policy defines how your transactions are routed.
/// You can choose 1 of the 3 different schemes mentioned below for each
/// asset type: - **None**; Defines the profile routing to no destination
/// for that asset type. Incoming transactions to asset types routed to
/// `None` will fail. - **Custom**; Route to an account that you choose.
/// If you remove the account, incoming transactions will fail until you
/// choose another one. - **Default**; Use the routing specified by the
/// network profile the connection is connected to. This scheme is also
/// referred to as \"Profile Routing\" Default Workspace Presets: -
/// Network Profile Crypto → **Custom** - Network Profile FIAT → **None**
/// - Network Connection Crypto → **Default** - Network Connection FIAT →
/// **Default** - **Note**: By default, Custom routing scheme uses
/// (`dstId` = `0`, `dstType` = `VAULT`).
async fn search_network_ids(
&self,
params: SearchNetworkIdsParams,
) -> Result<models::SearchNetworkIdsResponse, Error<SearchNetworkIdsError>> {
let SearchNetworkIdsParams {
search,
exclude_self,
exclude_connected,
page_cursor,
page_size,
} = params;
let local_var_configuration = &self.configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/network_ids/search", local_var_configuration.base_path);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref param_value) = search {
local_var_req_builder =
local_var_req_builder.query(&[("search", ¶m_value.to_string())]);
}
if let Some(ref param_value) = exclude_self {
local_var_req_builder =
local_var_req_builder.query(&[("excludeSelf", ¶m_value.to_string())]);
}
if let Some(ref param_value) = exclude_connected {
local_var_req_builder =
local_var_req_builder.query(&[("excludeConnected", ¶m_value.to_string())]);
}
if let Some(ref param_value) = page_cursor {
local_var_req_builder =
local_var_req_builder.query(&[("pageCursor", ¶m_value.to_string())]);
}
if let Some(ref param_value) = page_size {
local_var_req_builder =
local_var_req_builder.query(&[("pageSize", ¶m_value.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content_type = local_var_resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let local_var_content_type = super::ContentType::from(local_var_content_type);
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
match local_var_content_type {
ContentType::Json => {
crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
}
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to \
`models::SearchNetworkIdsResponse`",
)));
}
ContentType::Unsupported(local_var_unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{local_var_unknown_type}` content type response that cannot be \
converted to `models::SearchNetworkIdsResponse`"
))));
}
}
} else {
let local_var_entity: Option<SearchNetworkIdsError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Update whether or not the network ID is discoverable by others.
/// **Note:** This API call is subject to Flexible Routing Schemes. Your
/// routing policy defines how your transactions are routed. You can choose
/// 1 of the 3 different schemes mentioned below for each asset type: -
/// **None**; Defines the profile routing to no destination for that asset
/// type. Incoming transactions to asset types routed to `None` will fail.
/// - **Custom**; Route to an account that you choose. If you remove the
/// account, incoming transactions will fail until you choose another one.
/// - **Default**; Use the routing specified by the network profile the
/// connection is connected to. This scheme is also referred to as \"Profile
/// Routing\" Default Workspace Presets: - Network Profile Crypto →
/// **Custom** - Network Profile FIAT → **None** - Network Connection
/// Crypto → **Default** - Network Connection FIAT → **Default**
/// **Note**: By default, Custom routing scheme uses (`dstId` = `0`,
/// `dstType` = `VAULT`). </br>Endpoint Permission: Admin, Non-Signing
/// Admin.
async fn set_network_id_discoverability(
&self,
params: SetNetworkIdDiscoverabilityParams,
) -> Result<models::SetNetworkIdResponse, Error<SetNetworkIdDiscoverabilityError>> {
let SetNetworkIdDiscoverabilityParams {
network_id,
set_network_id_discoverability_request,
} = params;
let local_var_configuration = &self.configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/network_ids/{networkId}/set_discoverability",
local_var_configuration.base_path,
networkId = crate::apis::urlencode(network_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.json(&set_network_id_discoverability_request);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content_type = local_var_resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let local_var_content_type = super::ContentType::from(local_var_content_type);
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
match local_var_content_type {
ContentType::Json => {
crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
}
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to \
`models::SetNetworkIdResponse`",
)));
}
ContentType::Unsupported(local_var_unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{local_var_unknown_type}` content type response that cannot be \
converted to `models::SetNetworkIdResponse`"
))));
}
}
} else {
let local_var_entity: Option<SetNetworkIdDiscoverabilityError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Updates name of a specified network ID. **Note:** This API call is
/// subject to Flexible Routing Schemes. Your routing policy defines how
/// your transactions are routed. You can choose 1 of the 3 different
/// schemes mentioned below for each asset type: - **None**; Defines the
/// profile routing to no destination for that asset type. Incoming
/// transactions to asset types routed to `None` will fail. - **Custom**;
/// Route to an account that you choose. If you remove the account, incoming
/// transactions will fail until you choose another one. - **Default**;
/// Use the routing specified by the network profile the connection is
/// connected to. This scheme is also referred to as \"Profile Routing\"
/// Default Workspace Presets: - Network Profile Crypto → **Custom** -
/// Network Profile FIAT → **None** - Network Connection Crypto →
/// **Default** - Network Connection FIAT → **Default** **Note**: By
/// default, Custom routing scheme uses (`dstId` = `0`, `dstType` =
/// `VAULT`). </br>Endpoint Permission: Admin, Non-Signing Admin.
async fn set_network_id_name(
&self,
params: SetNetworkIdNameParams,
) -> Result<models::SetNetworkIdResponse, Error<SetNetworkIdNameError>> {
let SetNetworkIdNameParams {
network_id,
set_network_id_name_request,
} = params;
let local_var_configuration = &self.configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/network_ids/{networkId}/set_name",
local_var_configuration.base_path,
networkId = crate::apis::urlencode(network_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.json(&set_network_id_name_request);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content_type = local_var_resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let local_var_content_type = super::ContentType::from(local_var_content_type);
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
match local_var_content_type {
ContentType::Json => {
crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
}
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to \
`models::SetNetworkIdResponse`",
)));
}
ContentType::Unsupported(local_var_unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{local_var_unknown_type}` content type response that cannot be \
converted to `models::SetNetworkIdResponse`"
))));
}
}
} else {
let local_var_entity: Option<SetNetworkIdNameError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Updates the routing policy of a specified network ID. **Note:** This
/// API call is subject to Flexible Routing Schemes. Your routing policy
/// defines how your transactions are routed. You can choose 1 of the 3
/// different schemes mentioned below for each asset type: - **None**;
/// Defines the profile routing to no destination for that asset type.
/// Incoming transactions to asset types routed to `None` will fail. -
/// **Custom**; Route to an account that you choose. If you remove the
/// account, incoming transactions will fail until you choose another one.
/// - **Default**; Use the routing specified by the network profile the
/// connection is connected to. This scheme is also referred to as \"Profile
/// Routing\" Default Workspace Presets: - Network Profile Crypto →
/// **Custom** - Network Profile FIAT → **None** - Network Connection
/// Crypto → **Default** - Network Connection FIAT → **Default**
/// Supported asset groups for routing policy can be found at
/// `/network_ids/routing_policy_asset_groups` **Note**: By default, Custom
/// routing scheme uses (`dstId` = `0`, `dstType` = `VAULT`). </br>Endpoint
/// Permission: Admin, Non-Signing Admin.
async fn set_network_id_routing_policy(
&self,
params: SetNetworkIdRoutingPolicyParams,
) -> Result<models::SetNetworkIdResponse, Error<SetNetworkIdRoutingPolicyError>> {
let SetNetworkIdRoutingPolicyParams {
network_id,
set_network_id_routing_policy_request,
} = params;
let local_var_configuration = &self.configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/network_ids/{networkId}/set_routing_policy",
local_var_configuration.base_path,
networkId = crate::apis::urlencode(network_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.json(&set_network_id_routing_policy_request);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content_type = local_var_resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let local_var_content_type = super::ContentType::from(local_var_content_type);
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
match local_var_content_type {
ContentType::Json => {
crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
}
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to \
`models::SetNetworkIdResponse`",
)));
}
ContentType::Unsupported(local_var_unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{local_var_unknown_type}` content type response that cannot be \
converted to `models::SetNetworkIdResponse`"
))));
}
}
} else {
let local_var_entity: Option<SetNetworkIdRoutingPolicyError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
/// Updates an existing network connection's routing policy. **Note:** This
/// API call is subject to Flexible Routing Schemes. Your routing policy
/// defines how your transactions are routed. You can choose 1 of the 3
/// different schemes mentioned below for each asset type: - **None**;
/// Defines the profile routing to no destination for that asset type.
/// Incoming transactions to asset types routed to `None` will fail. -
/// **Custom**; Route to an account that you choose. If you remove the
/// account, incoming transactions will fail until you choose another one.
/// - **Default**; Use the routing specified by the network profile the
/// connection is connected to. This scheme is also referred to as \"Profile
/// Routing\" Default Workspace Presets: - Network Profile Crypto →
/// **Custom** - Network Profile FIAT → **None** - Network Connection
/// Crypto → **Default** - Network Connection FIAT → **Default**
/// Supported asset groups for routing policy can be found at
/// `/network_ids/routing_policy_asset_groups` **Note**: By default, Custom
/// routing scheme uses (`dstId` = `0`, `dstType` = `VAULT`). </br>Endpoint
/// Permission: Admin, Non-Signing Admin.
async fn set_routing_policy(
&self,
params: SetRoutingPolicyParams,
) -> Result<models::SetRoutingPolicyResponse, Error<SetRoutingPolicyError>> {
let SetRoutingPolicyParams {
connection_id,
set_routing_policy_request,
} = params;
let local_var_configuration = &self.configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!(
"{}/network_connections/{connectionId}/set_routing_policy",
local_var_configuration.base_path,
connectionId = crate::apis::urlencode(connection_id)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.json(&set_routing_policy_request);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content_type = local_var_resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let local_var_content_type = super::ContentType::from(local_var_content_type);
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
match local_var_content_type {
ContentType::Json => {
crate::deserialize_wrapper(&local_var_content).map_err(Error::from)
}
ContentType::Text => {
return Err(Error::from(serde_json::Error::custom(
"Received `text/plain` content type response that cannot be converted to \
`models::SetRoutingPolicyResponse`",
)));
}
ContentType::Unsupported(local_var_unknown_type) => {
return Err(Error::from(serde_json::Error::custom(format!(
"Received `{local_var_unknown_type}` content type response that cannot be \
converted to `models::SetRoutingPolicyResponse`"
))));
}
}
} else {
let local_var_entity: Option<SetRoutingPolicyError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}
}
/// struct for typed errors of method
/// [`FireblocksNetworkApi::check_third_party_routing`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CheckThirdPartyRoutingError {
DefaultResponse(models::ErrorSchema),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method
/// [`FireblocksNetworkApi::create_network_connection`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateNetworkConnectionError {
DefaultResponse(models::ErrorSchema),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method
/// [`FireblocksNetworkApi::create_network_id`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateNetworkIdError {
DefaultResponse(models::ErrorSchema),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method
/// [`FireblocksNetworkApi::delete_network_connection`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteNetworkConnectionError {
DefaultResponse(models::ErrorSchema),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method
/// [`FireblocksNetworkApi::delete_network_id`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteNetworkIdError {
DefaultResponse(models::ErrorSchema),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`FireblocksNetworkApi::get_network`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetNetworkError {
DefaultResponse(models::ErrorSchema),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method
/// [`FireblocksNetworkApi::get_network_connections`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetNetworkConnectionsError {
DefaultResponse(models::ErrorSchema),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`FireblocksNetworkApi::get_network_id`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetNetworkIdError {
DefaultResponse(models::ErrorSchema),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`FireblocksNetworkApi::get_network_ids`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetNetworkIdsError {
DefaultResponse(models::ErrorSchema),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method
/// [`FireblocksNetworkApi::get_routing_policy_asset_groups`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetRoutingPolicyAssetGroupsError {
DefaultResponse(models::ErrorSchema),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method
/// [`FireblocksNetworkApi::search_network_ids`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SearchNetworkIdsError {
DefaultResponse(models::ErrorSchema),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method
/// [`FireblocksNetworkApi::set_network_id_discoverability`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SetNetworkIdDiscoverabilityError {
DefaultResponse(models::ErrorSchema),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method
/// [`FireblocksNetworkApi::set_network_id_name`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SetNetworkIdNameError {
DefaultResponse(models::ErrorSchema),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method
/// [`FireblocksNetworkApi::set_network_id_routing_policy`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SetNetworkIdRoutingPolicyError {
DefaultResponse(models::ErrorSchema),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method
/// [`FireblocksNetworkApi::set_routing_policy`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SetRoutingPolicyError {
DefaultResponse(models::ErrorSchema),
UnknownValue(serde_json::Value),
}