Crate gcal_rs

source
Expand description

gcal_rs: Another Google Calendar API library for rust-lang

I wrote this by hand because I found other clients hard to use for my use-cases. This provides an API layer into the Google Calendar API that is very minimal but also mostly complete. Types are fully represented.

§Example

use gcal_rs::*;

#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
    let access_key = std::env::args().nth(1).expect("Provide an access key");
    let now = chrono::Local::now();
    let client = Client::new(access_key);
    let client = EventClient::new(client);
    let list = client.list(now - chrono::Duration::days(1), now).await?;

    for event in &list {
        eprintln!("{} {}", event.id, event.summary);
    }
}

Re-exports§

Modules§

  • Calendar List, the normal way to get at the list of calendars available.

Structs§

  • Calendar is a single calendar.
  • CalendarListClient is the method of accessing the calendar list. You must provide it with a Google Calendar client.
  • CalendarListItem is a single calendar returned by CalendarList, do not confuse this with Calendar.
  • Event is a single event.
  • EventClient is the method of managing events from a specific calendar. Requires a Google Calendar client.
  • Events is a listing of events on a per-page basis.
  • Client is a Google Calendar client. The access key must have already been fetched and the oauth negotiation should have already been completed. The client itself only implements HTTP verbs that accept Sendable implementations. You must use the decorated clients such as EventClient and CalendarListClient to do transactional work.

Enums§

Traits§

  • Sendable is the trait you must implement to interact with the Client. This object is received by the client and is used to construct the request URL as well as manage the (de)serialization of the object.

Type Aliases§