pub struct RoutexClient<T> { /* private fields */ }Implementations§
Source§impl RoutexClient<Client>
impl RoutexClient<Client>
Source§impl<T> RoutexClient<T>where
T: HttpClient + Clone,
impl<T> RoutexClient<T>where
T: HttpClient + Clone,
Sourcepub fn with_client(http_client: T) -> Self
pub fn with_client(http_client: T) -> Self
Create a new client
Sourcepub fn with_url_and_client(url: Url, http_client: T) -> Self
pub fn with_url_and_client(url: Url, http_client: T) -> Self
Create a new client with a custom URL
Sourcepub fn for_distribution(
distribution: &str,
version: &str,
url: Url,
http_client: T,
) -> Self
pub fn for_distribution( distribution: &str, version: &str, url: Url, http_client: T, ) -> Self
Create a new client for a versioned distribution and with a custom URL
Sourcepub async fn settle_key<S: Service>(
&self,
ticket: &Authenticated<Ticket<S>>,
) -> Result<()>
pub async fn settle_key<S: Service>( &self, ticket: &Authenticated<Ticket<S>>, ) -> Result<()>
Run a key settlement with the routex service, verifying the attestation report.
Stores a new random secret key and announces its public key to routex. In return, routex responds with its own public key and an attestation report. The attestation report allows verifying that routex created its corresponding secret key within the TEE and that its creation happened in response to our client public key (freshness).
§Errors
Returns an error if the key settlement request fails or the attestation report fails verification.
Sourcepub async fn system_version(&self, ticket_id: Uuid) -> Option<String>
pub async fn system_version(&self, ticket_id: Uuid) -> Option<String>
System version for the established session
Source§impl<T> RoutexClient<T>where
T: HttpClient + Clone,
impl<T> RoutexClient<T>where
T: HttpClient + Clone,
Source§impl<T> RoutexClient<T>where
T: HttpClient + Clone,
impl<T> RoutexClient<T>where
T: HttpClient + Clone,
Sourcepub fn set_redirect_uri(
&mut self,
redirect_uri: &str,
) -> Result<(), InvalidHeaderValue>
pub fn set_redirect_uri( &mut self, redirect_uri: &str, ) -> Result<(), InvalidHeaderValue>
Set a redirect URI for subsequent service requests.
Redirects will eventually forward to that URI. It can be used to redirect back to a web application or to jump back into the context of a desktop or mobile application.
If no redirect URI is set, RedirectHandles will get returned instead of Redirects.
§Errors
Fails if the URI is not a valid header value (probably lacks proper percent encoding).
pub fn set_recurring_consents(&mut self, enabled: bool)
Sourcepub async fn register_redirect_uri<S: Service>(
&self,
ticket: &Authenticated<Ticket<S>>,
handle: impl Into<String>,
redirect_uri: impl Into<String>,
) -> Result<Url>
pub async fn register_redirect_uri<S: Service>( &self, ticket: &Authenticated<Ticket<S>>, handle: impl Into<String>, redirect_uri: impl Into<String>, ) -> Result<Url>
Register a redirect URI for a given redirect handle.
Returns the URL that the user is meant to get sent to.
§Errors
Fails if the request fails or the response data cannot get parsed as expected.
Source§impl<T> RoutexClient<T>where
T: HttpClient + Clone,
impl<T> RoutexClient<T>where
T: HttpClient + Clone,
Sourcepub fn search<S: Service>(
&self,
ticket: Authenticated<Ticket<S>>,
filters: impl IntoIterator<Item = SearchFilter>,
) -> SearchRequest<S, T>
pub fn search<S: Service>( &self, ticket: Authenticated<Ticket<S>>, filters: impl IntoIterator<Item = SearchFilter>, ) -> SearchRequest<S, T>
Search for service connections (banks and other providers)
The result is a list of connections that match all the SearchFilters.
§Errors
Fails if the request fails.
§Example
use routex_client::prelude::*;
// Split input at whitespace for improved name matching
let mut filters: Vec<_> = user_input
.split_whitespace()
.map(|term| SearchFilter::Term(term.to_string()))
.collect();
filters.push(SearchFilter::Types(vec![ConnectionType::Production]));
let connection_infos = client
.search(ticket, filters)
.iban_detection(true)
.limit(20)
.send()
.await?;Sourcepub async fn info<S: Service>(
&self,
ticket: &Authenticated<Ticket<S>>,
connection_id: ConnectionId,
) -> Result<ConnectionInfo>
pub async fn info<S: Service>( &self, ticket: &Authenticated<Ticket<S>>, connection_id: ConnectionId, ) -> Result<ConnectionInfo>
Get information for a service connection
§Errors
Error::RequestErrorif the request fails.Error::NotFoundif the connection ID is not known.
§Examples
let connection_info = client.info(ticket, connection_id).await?;Source§impl<T> RoutexClient<T>where
T: HttpClient + Clone,
impl<T> RoutexClient<T>where
T: HttpClient + Clone,
Sourcepub fn accounts(
&self,
credentials: Credentials,
ticket: &Authenticated<Ticket<AccountsService>>,
fields: impl IntoIterator<Item = AccountField>,
filter: Option<Filter<AccountField>>,
) -> Request<AccountsService, T>
pub fn accounts( &self, credentials: Credentials, ticket: &Authenticated<Ticket<AccountsService>>, fields: impl IntoIterator<Item = AccountField>, filter: Option<Filter<AccountField>>, ) -> Request<AccountsService, T>
§Example
let credentials = Credentials {
connection_id,
user_id,
password,
connection_data,
};
let response = client
.accounts(
credentials,
accounts_ticket,
[
AccountField::Iban,
AccountField::Bic,
AccountField::Name,
AccountField::DisplayName,
AccountField::OwnerName,
AccountField::Currency,
],
Some(
AccountField::IBAN.not_eq(None)
.and(
AccountField::TYPE.eq(Some(AccountType::Current))
.or(AccountField::TYPE.eq(None))
)
.and(Account::supports(SupportedService::CollectPayment)),
),
)
.send()
.await?;
let OBResponse::Result(result, session, connection_data) = response else {
todo!("Handle interrupts");
};Sourcepub async fn respond_accounts(
&self,
ticket: &Authenticated<Ticket<AccountsService>>,
context: InputContext<AccountsService>,
response: impl Into<String>,
) -> Result<OBResponse<AccountsService>>
pub async fn respond_accounts( &self, ticket: &Authenticated<Ticket<AccountsService>>, context: InputContext<AccountsService>, response: impl Into<String>, ) -> Result<OBResponse<AccountsService>>
Respond to Dialog returned by accounts, respond_accounts, or confirm_accounts
§Errors
Fails if the request fails.
Sourcepub async fn confirm_accounts(
&self,
ticket: &Authenticated<Ticket<AccountsService>>,
context: ConfirmationContext<AccountsService>,
) -> Result<OBResponse<AccountsService>>
pub async fn confirm_accounts( &self, ticket: &Authenticated<Ticket<AccountsService>>, context: ConfirmationContext<AccountsService>, ) -> Result<OBResponse<AccountsService>>
Confirm Dialog or Redirect returned by accounts, respond_accounts, or confirm_accounts
§Errors
Fails if the request fails.
Source§impl<T> RoutexClient<T>where
T: HttpClient + Clone,
impl<T> RoutexClient<T>where
T: HttpClient + Clone,
Sourcepub fn balances(
&self,
credentials: Credentials,
ticket: &Authenticated<Ticket<BalancesService>>,
accounts: impl IntoIterator<Item = AccountReference>,
) -> Request<BalancesService, T>
pub fn balances( &self, credentials: Credentials, ticket: &Authenticated<Ticket<BalancesService>>, accounts: impl IntoIterator<Item = AccountReference>, ) -> Request<BalancesService, T>
Sourcepub async fn respond_balances(
&self,
ticket: &Authenticated<Ticket<BalancesService>>,
context: InputContext<BalancesService>,
response: impl Into<String>,
) -> Result<OBResponse<BalancesService>>
pub async fn respond_balances( &self, ticket: &Authenticated<Ticket<BalancesService>>, context: InputContext<BalancesService>, response: impl Into<String>, ) -> Result<OBResponse<BalancesService>>
Respond to Dialog returned by balances, respond_balances, or confirm_balances
§Errors
Fails if the request fails.
Sourcepub async fn confirm_balances(
&self,
ticket: &Authenticated<Ticket<BalancesService>>,
context: ConfirmationContext<BalancesService>,
) -> Result<OBResponse<BalancesService>>
pub async fn confirm_balances( &self, ticket: &Authenticated<Ticket<BalancesService>>, context: ConfirmationContext<BalancesService>, ) -> Result<OBResponse<BalancesService>>
Confirm Dialog or Redirect returned by balances, respond_balances, or confirm_balances
§Errors
Fails if the request fails.
Source§impl<T> RoutexClient<T>where
T: HttpClient + Clone,
impl<T> RoutexClient<T>where
T: HttpClient + Clone,
Sourcepub fn transactions(
&self,
credentials: Credentials,
ticket: &Authenticated<Ticket<TransactionsService>>,
) -> Request<TransactionsService, T>
pub fn transactions( &self, credentials: Credentials, ticket: &Authenticated<Ticket<TransactionsService>>, ) -> Request<TransactionsService, T>
Sourcepub async fn respond_transactions(
&self,
ticket: &Authenticated<Ticket<TransactionsService>>,
context: InputContext<TransactionsService>,
response: impl Into<String>,
) -> Result<OBResponse<TransactionsService>>
pub async fn respond_transactions( &self, ticket: &Authenticated<Ticket<TransactionsService>>, context: InputContext<TransactionsService>, response: impl Into<String>, ) -> Result<OBResponse<TransactionsService>>
Respond to Dialog returned by transactions, respond_transactions, or confirm_transactions
§Errors
Fails if the request fails.
Sourcepub async fn confirm_transactions(
&self,
ticket: &Authenticated<Ticket<TransactionsService>>,
context: ConfirmationContext<TransactionsService>,
) -> Result<OBResponse<TransactionsService>>
pub async fn confirm_transactions( &self, ticket: &Authenticated<Ticket<TransactionsService>>, context: ConfirmationContext<TransactionsService>, ) -> Result<OBResponse<TransactionsService>>
Confirm Dialog or Redirect returned by transactions, respond_transactions, or confirm_transactions
§Errors
Fails if the request fails.
Source§impl<T> RoutexClient<T>where
T: HttpClient + Clone,
impl<T> RoutexClient<T>where
T: HttpClient + Clone,
Sourcepub fn collect_payment(
&self,
credentials: Credentials,
ticket: &Authenticated<Ticket<CollectPaymentService>>,
account: Option<DebtorAccountReference>,
) -> Request<CollectPaymentService, T>
pub fn collect_payment( &self, credentials: Credentials, ticket: &Authenticated<Ticket<CollectPaymentService>>, account: Option<DebtorAccountReference>, ) -> Request<CollectPaymentService, T>
§Example
let response = client
.collect_payment(
credentials,
payment_ticket,
Some(AccountReference {
id: AccountIdentifier::Iban(selected_iban),
currency: None,
}),
)
.session(session)
.send()
.await?;Sourcepub async fn respond_collect_payment(
&self,
ticket: &Authenticated<Ticket<CollectPaymentService>>,
context: InputContext<CollectPaymentService>,
response: impl Into<String>,
) -> Result<OBResponse<CollectPaymentService>>
pub async fn respond_collect_payment( &self, ticket: &Authenticated<Ticket<CollectPaymentService>>, context: InputContext<CollectPaymentService>, response: impl Into<String>, ) -> Result<OBResponse<CollectPaymentService>>
Respond to Dialog returned by collect_payment, respond_collect_payment, or confirm_collect_payment
§Errors
Fails if the request fails.
Sourcepub async fn confirm_collect_payment(
&self,
ticket: &Authenticated<Ticket<CollectPaymentService>>,
context: ConfirmationContext<CollectPaymentService>,
) -> Result<OBResponse<CollectPaymentService>>
pub async fn confirm_collect_payment( &self, ticket: &Authenticated<Ticket<CollectPaymentService>>, context: ConfirmationContext<CollectPaymentService>, ) -> Result<OBResponse<CollectPaymentService>>
Confirm Dialog or Redirect returned by collect_payment, respond_collect_payment, or confirm_collect_payment
§Errors
Fails if the request fails.
Source§impl<T> RoutexClient<T>where
T: HttpClient + Clone,
impl<T> RoutexClient<T>where
T: HttpClient + Clone,
Sourcepub fn transfer(
&self,
credentials: Credentials,
ticket: &Authenticated<Ticket<TransferService>>,
product: PaymentProduct,
debtor_account: Option<AccountReference>,
debtor_name: Option<String>,
requested_execution_date: Option<ISODateTimeOrDate>,
details: impl IntoIterator<Item = TransferDetails>,
) -> Request<TransferService, T>
pub fn transfer( &self, credentials: Credentials, ticket: &Authenticated<Ticket<TransferService>>, product: PaymentProduct, debtor_account: Option<AccountReference>, debtor_name: Option<String>, requested_execution_date: Option<ISODateTimeOrDate>, details: impl IntoIterator<Item = TransferDetails>, ) -> Request<TransferService, T>
Sourcepub async fn respond_transfer(
&self,
ticket: &Authenticated<Ticket<TransferService>>,
context: InputContext<TransferService>,
response: impl Into<String>,
) -> Result<OBResponse<TransferService>>
pub async fn respond_transfer( &self, ticket: &Authenticated<Ticket<TransferService>>, context: InputContext<TransferService>, response: impl Into<String>, ) -> Result<OBResponse<TransferService>>
Respond to Dialog returned by transfer, respond_transfer, or confirm_transfer
§Errors
Fails if the request fails.
Sourcepub async fn confirm_transfer(
&self,
ticket: &Authenticated<Ticket<TransferService>>,
context: ConfirmationContext<TransferService>,
) -> Result<OBResponse<TransferService>>
pub async fn confirm_transfer( &self, ticket: &Authenticated<Ticket<TransferService>>, context: ConfirmationContext<TransferService>, ) -> Result<OBResponse<TransferService>>
Confirm Dialog or Redirect returned by transfer, respond_transfer, or confirm_transfer
§Errors
Fails if the request fails.
Trait Implementations§
Source§impl<T: Clone> Clone for RoutexClient<T>
impl<T: Clone> Clone for RoutexClient<T>
Source§fn clone(&self) -> RoutexClient<T>
fn clone(&self) -> RoutexClient<T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more