Crates.io | gcal_rs |
lib.rs | gcal_rs |
version | 0.1.7 |
source | src |
created_at | 2024-09-19 03:05:56.621782 |
updated_at | 2024-10-16 00:31:32.619865 |
description | A blazingly fast, hand written Google calendar API in Rust |
homepage | https://github.com/Shadorain/gcal_rs |
repository | https://github.com/Shadorain/gcal_rs |
max_upload_size | |
id | 1379811 |
size | 135,938 |
A blazingly fast, hand written Google calendar API in Rust.
Usage
•
Notes
•
Examples
•
Development
Docs
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.
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);
}
}
Currently working on updating documentation for each part of the code and structuring the best API.
Shadorain shadorain7517@gmail.com
Erik Hollensbe erik+github@hollensbe.org : gcal