1 unstable release
0.1.0 | Jul 7, 2023 |
---|
#44 in #coding
24KB
393 lines
WakaTime client for Rust
A client to fetch your coding statistics from WakaTime given your API key.
use std::error::Error;
use waka::WakaTimeClientBuilder;
#[tokio::main]
pub async fn main() -> Result<(), Box<dyn Error>> {
dotenvy::dotenv().ok();
let api_key = std::env::var("WAKATIME_API_KEY").expect("Missing WAKATIME_API_KEY variable");
let client = WakaTimeClientBuilder::with_api_key(api_key)
.with_user("sunside")
.build()?;
let summary = client
.summaries(
"2023-01-01",
"2023-01-08",
None,
None,
None,
None,
None,
None,
)
.await?;
println!("{summary:?}");
Ok(())
}
lib.rs
:
WakaTime API client
A client to fetch your coding statistics from WakaTime given your API key.
This is a work in progress and the API may change over time.
use waka::WakaTimeClientBuilder;
let api_key = std::env::var("WAKATIME_API_KEY")?;
let client = WakaTimeClientBuilder::with_api_key(api_key)
.with_user("current")
.build()?;
let summary = client
.summaries(
"2023-01-01",
"2023-01-08",
None,
None,
None,
None,
None,
None,
).await?;
Dependencies
~4–16MB
~220K SLoC