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-09-19.
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—dependenciesis documented as a comma separated string but the API returns a list; both are accepted and exposed asOption<Vec<String>>.heartbeats—id,user_id,user_agent_idandcreated_atare present in the response but not documented.stats/all_time_since_today— While stats are being calculated (202 response code), the body is partial and includes a top-levelmessage. Stats totals, averages, dates and lists are therefore optional (or empty).summaries— Whenprojectis set, the response includes top-levelavailable_branches,branchesandcolorfields not shown in the documentation.durations— The response includesai_model_line_changesandcolorfields not shown in the documentation.- AI stats — Most AI-related objects include an undocumented
ai_cached_input_tokensfield;editorsstats also includeai_additions,ai_deletions,human_additionsandhuman_deletions.
Usage
Async mode
use WakapiClient;
let client = new;
let res = fetch.await.unwrap;
println!;
Blocking mode
use WakapiClient;
let client = new;
let res = fetch.unwrap;
println!;
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 |
# Async (default)
WAKAPI_URL=https://wakatime.com WAKAPI_KEY=<key> cargo
# Blocking
WAKAPI_URL=https://wakatime.com WAKAPI_KEY=<key> cargo
If the environment variables are not set, all tests are silently skipped.
License
This project is licensed under the MIT License.