Skip to content

struct

Google

pub struct Google {
    /* private fields */
}

Google's APIs (Sheets, YouTube, Calendar, Places, Maps), with an API key or an OAuth access token.

Methods

with_key

pub fn with_key(api_key: &str) -> Google

Requests authorised with an API key (for public data).

with_token

pub fn with_token(access_token: &str) -> Google

Requests authorised with an OAuth access token (for a user's data).

get

pub fn get(&self, url: &str, params: &[(&str, &str)]) -> Request

A GET to any Google API URL, authorised.

sheet_values

pub fn sheet_values(&self, spreadsheet_id: &str, range: &str) -> Request

Cell values of a range ("Sheet1!A1:D20", or a sheet name). The sheet must be shared "anyone with the link" for API-key access.

sheet_append

pub fn sheet_append(&self, spreadsheet_id: &str, range: &str, rows: &[Vec<String>]) -> Request

Append rows to a sheet (OAuth token with the Sheets scope required).

pub fn youtube_search(&self, query: &str, max: usize) -> Request

YouTube videos matching query, at most max.

youtube_playlist

pub fn youtube_playlist(&self, playlist_id: &str, max: usize) -> Request

The videos in a YouTube playlist, at most max.

youtube_videos

pub fn youtube_videos(&self, ids: &[&str]) -> Request

Details of the YouTube videos with ids.

calendar_events

pub fn calendar_events(&self, calendar_id: &str, time_min: &str, max: usize) -> Request

Upcoming events of a (public) calendar, from time_min (RFC 3339).

pub fn places_search(&self, text: &str, max: usize) -> Request

Places API (New) text search: "coffee near Fitzroy".

maps_embed_url

pub fn maps_embed_url(&self, mode: &str, query: &str) -> String

A Maps Embed API URL for an iframe (mode: place, search, …).

static_map_url

pub fn static_map_url(&self, center: &str, zoom: u8, width: u32, height: u32, markers: &[&str]) -> String

A Maps Static API image URL.

Trait implementations