mirror of
https://codeberg.org/demostf/api-client.git
synced 2026-06-03 16:44:09 +02:00
add support for new before/after_id filters
This commit is contained in:
parent
46f548fcb4
commit
6beeed435c
2 changed files with 22 additions and 2 deletions
20
src/lib.rs
20
src/lib.rs
|
|
@ -324,6 +324,8 @@ pub struct ListParams {
|
|||
after: Option<OffsetDateTime>,
|
||||
#[serde(serialize_with = "serialize_option_time")]
|
||||
before: Option<OffsetDateTime>,
|
||||
before_id: Option<u64>,
|
||||
after_id: Option<u64>,
|
||||
}
|
||||
|
||||
fn serialize_option_time<S>(dt: &Option<OffsetDateTime>, serializer: S) -> Result<S::Ok, S::Error>
|
||||
|
|
@ -441,6 +443,24 @@ impl ListParams {
|
|||
}
|
||||
}
|
||||
|
||||
/// Specify the maximum demo id to filter demos with
|
||||
#[must_use]
|
||||
pub fn with_before_id(self, before: u64) -> Self {
|
||||
ListParams {
|
||||
before_id: Some(before),
|
||||
..self
|
||||
}
|
||||
}
|
||||
|
||||
/// Specify the minimum demo id to filter demos with
|
||||
#[must_use]
|
||||
pub fn with_after_id(self, after: u64) -> Self {
|
||||
ListParams {
|
||||
after_id: Some(after),
|
||||
..self
|
||||
}
|
||||
}
|
||||
|
||||
/// Specify the sort
|
||||
#[must_use]
|
||||
pub fn with_order(self, order: ListOrder) -> Self {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue