pub struct SummaryParams { /* private fields */ }Expand description
Query parameters for the GET /users/current/summaries endpoint.
§Example
use waka_api::SummaryParams;
// Fetch today's summary
let p = SummaryParams::today();
// Fetch the last 7 days, filtered to one project
use chrono::NaiveDate;
let p = SummaryParams::for_range(
NaiveDate::from_ymd_opt(2025, 1, 6).unwrap(),
NaiveDate::from_ymd_opt(2025, 1, 12).unwrap(),
)
.project("my-saas");Implementations§
Source§impl SummaryParams
impl SummaryParams
Sourcepub fn for_range(start: NaiveDate, end: NaiveDate) -> Self
pub fn for_range(start: NaiveDate, end: NaiveDate) -> Self
Creates params covering the given inclusive date range.
Sourcepub fn project(self, project: &str) -> Self
pub fn project(self, project: &str) -> Self
Filters results to the named project (builder, consumes self).
Sourcepub fn branches(self, branches: &str) -> Self
pub fn branches(self, branches: &str) -> Self
Filters results to the named branches, comma-separated (builder).
Sourcepub fn cache_key(&self) -> String
pub fn cache_key(&self) -> String
Returns a stable cache key string that uniquely identifies this set of parameters.
Format: summaries:{start}:{end} (with optional :project:{name} suffix).
§Example
use waka_api::SummaryParams;
use chrono::NaiveDate;
let p = SummaryParams::for_range(
NaiveDate::from_ymd_opt(2025, 1, 6).unwrap(),
NaiveDate::from_ymd_opt(2025, 1, 12).unwrap(),
).project("my-saas");
assert_eq!(p.cache_key(), "summaries:2025-01-06:2025-01-12:project:my-saas");Trait Implementations§
Source§impl Clone for SummaryParams
impl Clone for SummaryParams
Source§fn clone(&self) -> SummaryParams
fn clone(&self) -> SummaryParams
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SummaryParams
impl RefUnwindSafe for SummaryParams
impl Send for SummaryParams
impl Sync for SummaryParams
impl Unpin for SummaryParams
impl UnsafeUnpin for SummaryParams
impl UnwindSafe for SummaryParams
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more