+
Skip to content

Shadorain/gcal_rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


🗓️ 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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载