mod room;
pub mod thread;
use matrix_sdk_base::deserialized_responses::TimelineEvent;
pub use room::*;
use ruma::OwnedEventId;
#[derive(Clone, Debug, PartialEq)]
pub enum PaginationToken {
None,
HasMore(String),
HitEnd,
}
impl From<Option<String>> for PaginationToken {
fn from(token: Option<String>) -> Self {
match token {
Some(val) => Self::HasMore(val),
None => Self::None,
}
}
}
#[derive(Debug)]
pub struct PaginationResult {
pub events: Vec<TimelineEvent>,
pub hit_end_of_timeline: bool,
}
#[derive(Debug, thiserror::Error)]
pub enum PaginatorError {
#[error("target event with id {0} could not be found")]
EventNotFound(OwnedEventId),
#[error("expected paginator state {expected:?}, observed {actual:?}")]
InvalidPreviousState {
expected: PaginatorState,
actual: PaginatorState,
},
#[error("an error happened while paginating: {0}")]
SdkError(#[from] Box<crate::Error>),
}