dfns-sdk-rust 0.2.0

Dfns API SDK for Rust
Documentation
// Code generated by rust-sdk-generator. crate root (module wiring is generated).

pub mod client;
pub mod error;
pub mod signer;
pub mod types;

pub mod address_watches;
pub mod agreements;
pub mod allocations;
pub mod auth;
pub mod exchanges;
pub mod fee_sponsors;
pub mod keys;
pub mod networks;
pub mod payins;
pub mod payouts;
pub mod permissions;
pub mod policies;
pub mod signers;
pub mod staking;
pub mod swaps;
pub mod vaults;
pub mod wallets;
pub mod webhooks;

pub use client::{Client, MultipartFile, Options};
pub use error::Error;

/// Aggregate entry point exposing every domain client over one transport.
#[derive(Clone)]
pub struct DfnsClient {
    pub address_watches: address_watches::AddressWatchesClient,
    pub agreements: agreements::AgreementsClient,
    pub allocations: allocations::AllocationsClient,
    pub auth: auth::AuthClient,
    pub exchanges: exchanges::ExchangesClient,
    pub fee_sponsors: fee_sponsors::FeeSponsorsClient,
    pub keys: keys::KeysClient,
    pub networks: networks::NetworksClient,
    pub payins: payins::PayinsClient,
    pub payouts: payouts::PayoutsClient,
    pub permissions: permissions::PermissionsClient,
    pub policies: policies::PoliciesClient,
    pub signers: signers::SignersClient,
    pub staking: staking::StakingClient,
    pub swaps: swaps::SwapsClient,
    pub vaults: vaults::VaultsClient,
    pub wallets: wallets::WalletsClient,
    pub webhooks: webhooks::WebhooksClient,
}

impl DfnsClient {
    pub fn new(options: Options) -> Result<Self, Error> {
        let client = Client::new(options)?;
        Ok(DfnsClient {
            address_watches: address_watches::AddressWatchesClient::new(client.clone()),
            agreements: agreements::AgreementsClient::new(client.clone()),
            allocations: allocations::AllocationsClient::new(client.clone()),
            auth: auth::AuthClient::new(client.clone()),
            exchanges: exchanges::ExchangesClient::new(client.clone()),
            fee_sponsors: fee_sponsors::FeeSponsorsClient::new(client.clone()),
            keys: keys::KeysClient::new(client.clone()),
            networks: networks::NetworksClient::new(client.clone()),
            payins: payins::PayinsClient::new(client.clone()),
            payouts: payouts::PayoutsClient::new(client.clone()),
            permissions: permissions::PermissionsClient::new(client.clone()),
            policies: policies::PoliciesClient::new(client.clone()),
            signers: signers::SignersClient::new(client.clone()),
            staking: staking::StakingClient::new(client.clone()),
            swaps: swaps::SwapsClient::new(client.clone()),
            vaults: vaults::VaultsClient::new(client.clone()),
            wallets: wallets::WalletsClient::new(client.clone()),
            webhooks: webhooks::WebhooksClient::new(client.clone()),
        })
    }
}

/// Same as DfnsClient but signed operations are init/complete pairs, no signer needed.
#[derive(Clone)]
pub struct DfnsDelegatedClient {
    pub address_watches: address_watches::delegated::DelegatedAddressWatchesClient,
    pub agreements: agreements::delegated::DelegatedAgreementsClient,
    pub allocations: allocations::delegated::DelegatedAllocationsClient,
    pub auth: auth::delegated::DelegatedAuthClient,
    pub exchanges: exchanges::delegated::DelegatedExchangesClient,
    pub fee_sponsors: fee_sponsors::delegated::DelegatedFeeSponsorsClient,
    pub keys: keys::delegated::DelegatedKeysClient,
    pub networks: networks::delegated::DelegatedNetworksClient,
    pub payins: payins::delegated::DelegatedPayinsClient,
    pub payouts: payouts::delegated::DelegatedPayoutsClient,
    pub permissions: permissions::delegated::DelegatedPermissionsClient,
    pub policies: policies::delegated::DelegatedPoliciesClient,
    pub signers: signers::delegated::DelegatedSignersClient,
    pub staking: staking::delegated::DelegatedStakingClient,
    pub swaps: swaps::delegated::DelegatedSwapsClient,
    pub vaults: vaults::delegated::DelegatedVaultsClient,
    pub wallets: wallets::delegated::DelegatedWalletsClient,
    pub webhooks: webhooks::delegated::DelegatedWebhooksClient,
}

impl DfnsDelegatedClient {
    pub fn new(options: Options) -> Result<Self, Error> {
        let client = Client::new(options)?;
        Ok(DfnsDelegatedClient {
            address_watches: address_watches::delegated::DelegatedAddressWatchesClient::new(
                client.clone(),
            ),
            agreements: agreements::delegated::DelegatedAgreementsClient::new(client.clone()),
            allocations: allocations::delegated::DelegatedAllocationsClient::new(client.clone()),
            auth: auth::delegated::DelegatedAuthClient::new(client.clone()),
            exchanges: exchanges::delegated::DelegatedExchangesClient::new(client.clone()),
            fee_sponsors: fee_sponsors::delegated::DelegatedFeeSponsorsClient::new(client.clone()),
            keys: keys::delegated::DelegatedKeysClient::new(client.clone()),
            networks: networks::delegated::DelegatedNetworksClient::new(client.clone()),
            payins: payins::delegated::DelegatedPayinsClient::new(client.clone()),
            payouts: payouts::delegated::DelegatedPayoutsClient::new(client.clone()),
            permissions: permissions::delegated::DelegatedPermissionsClient::new(client.clone()),
            policies: policies::delegated::DelegatedPoliciesClient::new(client.clone()),
            signers: signers::delegated::DelegatedSignersClient::new(client.clone()),
            staking: staking::delegated::DelegatedStakingClient::new(client.clone()),
            swaps: swaps::delegated::DelegatedSwapsClient::new(client.clone()),
            vaults: vaults::delegated::DelegatedVaultsClient::new(client.clone()),
            wallets: wallets::delegated::DelegatedWalletsClient::new(client.clone()),
            webhooks: webhooks::delegated::DelegatedWebhooksClient::new(client.clone()),
        })
    }
}