4 releases

0.1.3 Mar 18, 2024
0.1.2 Mar 16, 2024
0.1.1 Mar 16, 2024
0.1.0 Mar 16, 2024

#484 in HTTP client

Download history 283/week @ 2024-03-13 31/week @ 2024-03-20 15/week @ 2024-03-27 30/week @ 2024-04-03

359 downloads per month

MIT license

6KB
63 lines

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))
}

Dependencies

~18–32MB
~593K SLoC