googol

Crates.iogoogol
lib.rsgoogol
version0.2.0
sourcesrc
created_at2024-03-16 21:21:52.418829
updated_at2024-07-07 13:52:54.270795
descriptionA generic library to call Google APIs
homepagehttps://vanu.dev/projects/googol
repositoryhttps://github.com/VanuPhantom/googol
max_upload_size
id1175986
size5,447
Tess Ellenoir Duursma (VanuPhantom)

documentation

README

googol

TLDR

A library to reduce the boilerplate needed to call Google APIs.

Example usage

const SCOPES: &'static [&'static str] = &["https://www.googleapis.com/auth/firebase.messaging"];

#[cfg(debug_assertions)]
static GCP_AUTHENTICATION_CLIENT: googol::Client =
    googol::Client::from_file("credentials.json", SCOPES);
#[cfg(not(debug_assertions))]
static GCP_AUTHENTICATION_CLIENT: googol::Client = googol::Client::from_environment(SCOPES);

async fn get_auth_token() -> Result<Token, Error> {
    GCP_AUTHENTICATION_CLIENT
        .get_token()
        .await
        .or(Err(Error::AuthError))
}
Commit count: 15

cargo fmt