lamarge 0.6.0

Client for the LaMarge API: sign-in, takes, transfers, withdrawals and market making, each request checked before it is signed.
Documentation
//! Withdrawal history.

use futures_core::Stream;

use super::{
    PageRequest, Withdrawals,
    page::{every, history},
};
use crate::{
    Result,
    model::{Page, WithdrawalHistoryRow},
    transport::{Call, ops},
};

impl Withdrawals<'_> {
    /// One page of the session's withdrawals and sends, newest first.
    pub async fn history(&self, page: &PageRequest) -> Result<Page<WithdrawalHistoryRow>> {
        history(self.inner, self.auth, &ops::GET_WITHDRAWAL_HISTORY, page).await
    }

    /// Every withdrawal, newest first, reading pages of `page_size` (clamped to `1..=500`) as
    /// consumed. The stream owns what it needs, so it outlives the handle.
    pub fn history_stream(
        &self,
        page_size: u16,
    ) -> impl Stream<Item = Result<WithdrawalHistoryRow>> + Send + Unpin + 'static {
        every(self.inner, self.auth, PageRequest::first(page_size), || {
            Call::new(&ops::GET_WITHDRAWAL_HISTORY)
        })
    }
}

#[cfg(test)]
mod tests;