pub struct TaleaClient { /* private fields */ }Expand description
HTTP client for a talea server, implementing LedgerApi.
Cheap to share: hold it in an Arc or clone the underlying reqwest
client via the builder. Construct with TaleaClient::builder.
Implementations§
Source§impl TaleaClient
impl TaleaClient
Sourcepub fn builder(base_url: impl Into<String>) -> ClientBuilder
pub fn builder(base_url: impl Into<String>) -> ClientBuilder
Start building a client for the server at base_url
(e.g. http://127.0.0.1:8080). A path prefix is preserved, but the
base must not already include the /v1 version segment.
Trait Implementations§
Source§impl LedgerApi for TaleaClient
impl LedgerApi for TaleaClient
Source§fn post_batch<'life0, 'async_trait>(
&'life0 self,
drafts: Vec<TransactionDraft>,
) -> Pin<Box<dyn Future<Output = Vec<ApiResult<Posted>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn post_batch<'life0, 'async_trait>(
&'life0 self,
drafts: Vec<TransactionDraft>,
) -> Pin<Box<dyn Future<Output = Vec<ApiResult<Posted>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Post a batch via one POST /v1/transactions/batch call.
Empty input returns an empty Vec immediately without any HTTP call.
Whole-request failure (401 / 415 / 400 / transport) yields the
same error in every slot. Callers can detect this via all-slots-
identical. Retrying the whole batch is always safe because idempotency
keys dedup per draft: any slot that already committed returns
deduplicated: true instead of double-posting.
Retry: the whole request goes through the standard 503/408/transport retry wrapper — safe for the same dedup reason.
Source§fn register_asset<'life0, 'async_trait>(
&'life0 self,
draft: AssetDraft,
) -> Pin<Box<dyn Future<Output = ApiResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn register_asset<'life0, 'async_trait>(
&'life0 self,
draft: AssetDraft,
) -> Pin<Box<dyn Future<Output = ApiResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
AlreadyExists.
Crypto assets require a network; precision is immutable forever.Source§fn open_account<'life0, 'async_trait>(
&'life0 self,
draft: AccountDraft,
) -> Pin<Box<dyn Future<Output = ApiResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn open_account<'life0, 'async_trait>(
&'life0 self,
draft: AccountDraft,
) -> Pin<Box<dyn Future<Output = ApiResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn post<'life0, 'async_trait>(
&'life0 self,
draft: TransactionDraft,
) -> Pin<Box<dyn Future<Output = ApiResult<Posted>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn post<'life0, 'async_trait>(
&'life0 self,
draft: TransactionDraft,
) -> Pin<Box<dyn Future<Output = ApiResult<Posted>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Posted with
deduplicated: true and never double-posts — which is what makes
retrying on failure unconditionally safe.Source§fn balance<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
book: &'life1 str,
path: &'life2 str,
as_of: Option<DateTime<Utc>>,
) -> Pin<Box<dyn Future<Output = ApiResult<BalanceView>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn balance<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
book: &'life1 str,
path: &'life2 str,
as_of: Option<DateTime<Utc>>,
) -> Pin<Box<dyn Future<Output = ApiResult<BalanceView>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
as_of replays by commit time;
None reads the live projection.Source§fn account_history<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
book: &'life1 str,
path: &'life2 str,
page: Page,
) -> Pin<Box<dyn Future<Output = ApiResult<Paged<PostingView>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn account_history<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
book: &'life1 str,
path: &'life2 str,
page: Page,
) -> Pin<Box<dyn Future<Output = ApiResult<Paged<PostingView>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
page.after_seq is
exclusive (resume with the last seen seq); limit counts
transactions, so one transaction’s postings never split across
pages. Paged::next is None once exhausted.Source§fn transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
tx_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = ApiResult<TransactionView>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
tx_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = ApiResult<TransactionView>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
NotFound.Source§fn trial_balance<'life0, 'life1, 'async_trait>(
&'life0 self,
book: &'life1 str,
as_of: Option<DateTime<Utc>>,
) -> Pin<Box<dyn Future<Output = ApiResult<TrialBalance>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn trial_balance<'life0, 'life1, 'async_trait>(
&'life0 self,
book: &'life1 str,
as_of: Option<DateTime<Utc>>,
) -> Pin<Box<dyn Future<Output = ApiResult<TrialBalance>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
book: &'life1 str,
from: Seq,
) -> Pin<Box<dyn Future<Output = ApiResult<EventStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
book: &'life1 str,
from: Seq,
) -> Pin<Box<dyn Future<Output = ApiResult<EventStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
from (inclusive:
catch-up first, then tail). Delivery is at-least-once; consumers
resume after a disconnect from their last seen EventEnvelope::seq.
The HTTP client implementation does that resumption automatically.