1 unstable release
0.1.0 | Mar 3, 2021 |
---|
#7 in #toggl
30KB
787 lines
toggl-report-rs
A rust wrapper for Toggl Reports API v2.
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
lib.rs
:
A library to call Toggl Reports API v2 in Rust.
This library provide makes it easier to call Toggl Reports API v2 from Rust codes.
examples
To get summary reports of Toggl Track,
create struct Query
and pass it to Toggl.get_summary_report()
.
use toggl_reports::{Toggl, query::Query, query::GroupingKind, query::OrderKind};
use chrono::Utc;
#[tokio::main]
async fn main() {
let api_token: &str = "00000000000000000000000000000000"; // your api token
let workspace_id: u64 = 264; // your workspace id
let toggl = Toggl::new(api_token);
let query = Query::new(workspace_id)
.grouping(GroupingKind::Projects)
.order_field(OrderKind::Description)
.since(Utc::today());
let res = toggl.get_summary_report(&query).await.unwrap();
println!("TOTAL: {}s", res.total_grand.num_seconds());
}
For more details about query parameters and response formst, see Toggl Reports API v2.
Dependencies
~5–18MB
~263K SLoC