This crate is an unofficial opinionated library that unifies the Google Workspace API clients. The current workspace crate landscape is highly fragmented, with each API employing a distinct approach. This library aims to provide a unified interface for all Google Workspace APIs.
Current supported APIs include: Google Tasks, Google Calendar, and Gmail.
// If the last parameter is set to true the client
// will automatically refresh the access token if it expires
// The access token is retrieved by the Google auth callback
// See the axum_calendar_example.rs example for a full example
let new_client = GoogleClient::new(client_credentials, access_token, true);
// Insert a task
match TasksClient::new(client)
.insert_task("{TASKLIST_ID}")
.set_task_title("test api")
.set_task_notes("hello")
.request()
.await;
//Get a list of events from the primary calendar
let events = CalendarEventsClient::new(client)
.get_events("primary")
.single_events(true)
.event_type(EventType::Birthday)
.max_results(10)
.order_by(google_workspace_apis::calendar::events::requests::EventOrderBy::StartTime)
//To avoid retrieving past events we set the time_min to now
.time_min(chrono::Utc::now())
//Since we retrieve single events add all birthdays for the next year
.time_max(chrono::Utc::now() + chrono::Duration::days(365))
.request()
.await
.unwrap();I'm currently working on the following APIs (more will be added soon):
- Get OAuth url
- Get Access token
- Refresh token
For the API documentation, see the Calender API documentation.
The actions that are currently supported by this crate are:
- Get
- List
- Patch
- Delete
For the API documentation, see the Tasks API documentation.
The actions that are currently supported by this crate are:
- Insert
- List
- Delete
- Patch
- Get
For the API documentation, see the Gmail API documentation.
The actions that are currently supported by this crate are:
- Get
- List
- Delete
- Trash
- Untrash
- Complete a task
To include the correct API client,
you need to define the feature in your Cargo.toml file:
google-workspaces-api = { version: "1.2", features = ["calendar", "tasks", "gmail"] }