use futures_core::Stream;
use super::{
PageRequest, Withdrawals,
page::{every, history},
};
use crate::{
Result,
model::{Page, WithdrawalHistoryRow},
transport::{Call, ops},
};
impl Withdrawals<'_> {
pub async fn history(&self, page: &PageRequest) -> Result<Page<WithdrawalHistoryRow>> {
history(self.inner, self.auth, &ops::GET_WITHDRAWAL_HISTORY, page).await
}
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;