gcal_rs

Crates.iogcal_rs
lib.rsgcal_rs
version0.1.7
sourcesrc
created_at2024-09-19 03:05:56.621782
updated_at2024-10-16 00:31:32.619865
descriptionA blazingly fast, hand written Google calendar API in Rust
homepagehttps://github.com/Shadorain/gcal_rs
repositoryhttps://github.com/Shadorain/gcal_rs
max_upload_size
id1379811
size135,938
Shadorain (Shadorain)

documentation

README


🗓️ gcal_rs: Google Calendar API 🗓️

A blazingly fast, hand written Google calendar API in Rust.

Docs Crate License Status

UsageNotesExamplesDevelopment
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

Commit count: 23

cargo fmt