Skip to main content

Module api_client

Module api_client 

Source
Expand description

Shared transport core for Google REST APIs.

Extracted from crate::drive::client (issue #1589) so a second Google host — the Sheets API at sheets.googleapis.com, which Drive’s /drive/v3/...-on-www.googleapis.com base URL cannot reach — can reuse the OAuth session, the 401 refresh-and-retry, the quota/429 backoff, the request-log hook and the error-envelope parsing without duplicating any of it.

This module owns transport only. It has no notion of files, ranges or any API’s resource model; DriveClient and SheetsClient are thin typed wrappers that add a default host, an env override and their own façades. Keeping them as distinct types is deliberate: FilesApi::new takes a &DriveClient, so a Sheets-hosted client cannot be handed to it and silently issue /drive/v3/files against sheets.googleapis.com.

Gmail (crate::gmail::client::GmailClient) is a near-verbatim twin of the pre-extraction DriveClient and is deliberately not migrated here: it carries its own GmailSession, so sharing would need a TokenSource abstraction that nothing in issue #1589 requires.