Crate wakapi

Source
Expand description

§Wakapi : wakatime API client

This crate is a Work In Progress API client for the Wakatime API. It is NOT ready for production.

The following endpoints are implemented, only in read mode (GET requests), as blocking or async depending on the feature flag blocking:

The structures are based on the official documentation at 2024-10-01 with a few modifications to correct some errors / inconsistencies.

§Usage

§Async mode

use wakapi::{WakapiClient, CommitsParams};
let client = wakapi::WakapiClient::new(
    "https://api.wakatime.com",
    "YOUR_WAKATIME_API_KEY",
);
let res = wakapi::Summaries::fetch(&client,
   wakapi::SummariesParams::from_interval("2024-01-01", "2024-01-05"),
).await.unwrap();
println!("{:?}", res);
```

## Blocking mode
```rust
use wakapi::{WakapiClient, CommitsParams};
let client = wakapi::WakapiClient::new(
    "https://api.wakatime.com",
    "YOUR_WAKATIME_API_KEY",
);
let res = wakapi::Summaries::fetch(&client,
   wakapi::SummariesParams::from_interval("2024-01-01", "2024-01-05"),
).unwrap();
println!("{:?}", res);

§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§

AllTimeSinceTodayParams
Request parameters for the AllTimeSinceToday endpoint.
Commit
Commit endpoint
CommitParams
Request parameters for the Commit endpoint.
Commits
Commits endpoint
CommitsParams
Request parameters for the Commits endpoint.
Durations
Durations endpoint
DurationsParams
Request parameters for the Durations endpoint.
ErrorMessage
Heartbeats
Heartbeats endpoint
HeartbeatsParams
Request parameters for the Heartbeats endpoint.
Projects
Projects endpoint.
ProjectsParams
Request parameters for the Projects endpoint.
Stats
Stats endpoint.
StatsParams
Request parameters for the Stats endpoint.
Summaries
Summaries endpoint body
SummariesParams
Request parameters for the Summaries endpoint.
WakapiClient
WakatimeConfig
Wakatime INI config file.

Enums§

AllTimeSinceToday
Successful response from the AllTimeSinceToday endpoint, with two possible states :
SummaryRange
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”.
WakapiError