7 releases
0.1.7 | Oct 16, 2024 |
---|---|
0.1.6 | Oct 13, 2024 |
0.1.5 | Sep 29, 2024 |
#682 in Asynchronous
545 downloads per month
48KB
1K
SLoC
🗓️ gcal_rs: Google Calendar API 🗓️
A blazingly fast, hand written Google calendar API in Rust.
Usage
•
Notes
•
Examples
•
Development
Docs
Summary
This is intended to be a solution to the current state of Google Calendar API's for Rust out there currently. There are a few out there but either are for specific projects usecases or just are horribly generated.
I'm not saying this is perfect but it attempts to be better and have some solidity.
Example
use gcal::*;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let client_id = std::env::var("GOOGLE_CLIENT_ID")?;
let client_secret = std::env::var("GOOGLE_CLIENT_SECRET")?;
let token = OAuth::new(client_id, client_secret, "http://localhost:5000/auth")
.naive()
.await?;
let (calendar_client, event_client) = GCalClient::new(token.access)?.clients();
let list = calendar_client
.list(true, CalendarAccessRole::Reader)
.await?;
let start = Local::now();
let end = Local::now().checked_add_signed(Duration::days(7)).unwrap();
let mut event_list = Vec::new();
for calendar in list {
event_list.extend(
event_client
.list(calendar.id.clone(), start, end)
.await?,
);
}
println!("Events: ");
for event in &event_list {
println!(" - {} : {}", event.summary, event.calendar_id);
}
}
Status
Currently working on updating documentation for each part of the code and structuring the best API.
Author
Shadorain shadorain7517@gmail.com
Original Authors
Erik Hollensbe erik+github@hollensbe.org : gcal
Dependencies
~8–24MB
~316K SLoC