Expand description
§Wakapi : wakatime API client
Read-only API client for the Wakatime API, supporting all GET endpoints as blocking or async depending on the blocking feature flag.
The following endpoints are implemented:
- All Time Since Today : AllTimeSinceToday, AllTimeSinceTodayParams, AllTimeSinceToday::fetch
- Commit : Commit, CommitParams, Commit::fetch
- Commits : Commits, CommitsParams, Commits::fetch
- Durations : Durations, DurationsParams, Durations::fetch
- Heartbeats : Heartbeats, HeartbeatsParams, Heartbeats::fetch
- Projects : Projects, ProjectsParams, Projects::fetch
- Stats : Stats, StatsParams, Stats::fetch
- Summaries : Summaries, SummariesParams, Summaries::fetch
The structures are based on the official documentation last checked 2026-05-15.
§Known inconsistencies with the official documentation
projects—repositoryandbadgefields are documented as strings but the API returns objects (RepositoryDetailsandProjectBadgerespectively). The struct types match the actual API response.projects— The response includes pagination fields (page,total,total_pages,prev_page,next_page) not shown in the documentation.commits— The response includes apagefield not shown in the documentation.stats— The response includes anis_up_to_date_pending_futureboolean field not present in the documentation.heartbeats—project_root_countis present in the response but not documented.
§Usage
§Async mode
use wakapi::WakapiClient;
let client = WakapiClient::new(
"https://wakatime.com",
"YOUR_WAKATIME_API_KEY",
);
let res = wakapi::Summaries::fetch(
&client,
wakapi::SummariesParams::from_interval("2026-01-01", "2026-01-05"),
).await.unwrap();
println!("{:?}", res);§Blocking mode
use wakapi::WakapiClient;
let client = WakapiClient::new(
"https://wakatime.com",
"YOUR_WAKATIME_API_KEY",
);
let res = wakapi::Summaries::fetch(
&client,
wakapi::SummariesParams::from_interval("2026-01-01", "2026-01-05"),
).unwrap();
println!("{:?}", res);§Integration tests
Integration tests hit the real Wakatime API and require two environment variables:
| Variable | Description |
|---|---|
WAKAPI_URL | Base URL of the server, e.g. https://wakatime.com |
WAKAPI_KEY | Plain-text API key (the client Base64-encodes it) |
# Async (default)
WAKAPI_URL=https://wakatime.com WAKAPI_KEY=<key> cargo test --test integration
# Blocking
WAKAPI_URL=https://wakatime.com WAKAPI_KEY=<key> cargo test --features blocking --test integrationIf the environment variables are not set, all tests are silently skipped.
§License
This project is licensed under the MIT License.
Modules§
- atst
- All time since today endpoint.
- commit
- Commit endpoint
- commits
- Commits endpoint
- durations
- Durations endpoint
- heartbeats
- Heartbeats endpoint
- projects
- Projects endpoint.
- stats
- Stats endpoint.
- summaries
- Summaries endpoint.
Structs§
- AllTime
Since Today Params - Request parameters for the AllTimeSinceToday endpoint.
- Commit
- Commit endpoint
- Commit
Params - Request parameters for the Commit endpoint.
- Commits
- Commits endpoint
- Commits
Params - Request parameters for the Commits endpoint.
- Durations
- Durations endpoint
- Durations
Params - Request parameters for the Durations endpoint.
- Error
Message - Heartbeats
- Heartbeats endpoint
- Heartbeats
Params - Request parameters for the Heartbeats endpoint.
- Projects
- Projects endpoint.
- Projects
Params - Request parameters for the Projects endpoint.
- Stats
- Stats endpoint.
- Stats
Params - Request parameters for the Stats endpoint.
- Summaries
- Summaries endpoint body
- Summaries
Params - Request parameters for the Summaries endpoint.
- Wakapi
Client - Wakatime
Config - Wakatime INI config file.
Enums§
- AllTime
Since Today - Successful response from the AllTimeSinceToday endpoint, with two possible states :
- Summary
Range - Summary range : https://wakatime.com/developers#summaries Alternative way to supply start and end dates. Can be one of “Today”, “Yesterday”, “Last 7 Days”, “Last 7 Days from Yesterday”, “Last 14 Days”, “Last 30 Days”, “This Week”, “Last Week”, “This Month”, or “Last Month”.
- Wakapi
Error