cadrumo.adapters.outbound.google.api module

Shared Google API request execution with typed-error translation.

Both adapters.outbound.google.calc_sheets_apply and adapters.outbound.google.calc_sheets_pull issue google-api-python-client requests. This module provides the single execute_request() boundary they route through so transport failures, HTTP failures, and quota responses become the typed OutboundStorageError hierarchy instead of endpoint-specific HttpError strings.

execute_request(request, *, action)[source]

Execute a google-api-python-client request, translating failures.

Runs request.execute(num_retries=3) and returns the decoded JSON payload unchanged. HTTP 401/403 responses become OutboundStoragePermissionError, HTTP 404 responses become OutboundStorageNotFoundError, HTTP 429 responses and recognised Google quota markers become OutboundStorageQuotaError, and every other transport or unmapped HTTP failure becomes OutboundStorageNetworkError. A typed OutboundStorageError raised by a nested call is re-raised unchanged so ownership and validation refusals are never re-wrapped as network errors.

Parameters:
  • request (_ExecutableRequest[TypeVar(ResponseBodyT)]) – A google-api-python-client request object exposing execute().

  • action (str) – Stable action label used in error messages and context.

Return type:

TypeVar(ResponseBodyT)

Returns:

The deserialised API response payload.

Raises: