Expand description
Discovery-driven API surface.
Google’s Discovery Service publishes a machine-readable description of
every Workspace method: HTTP verb, path template, parameters and OAuth
scopes. scripts/fetch-discovery.mjs distils those documents into a
compact index (method id, verb, path, scopes, parameters) which this
module embeds — 401 methods across 14 services in ~430 KiB, versus
several megabytes for the raw documents.
This is the escape hatch that makes the curated commands unnecessary for
coverage: grr api call <service>.<resource>.<method> reaches every
method Google publishes, including ones that did not exist when grr was
written, with no code change and no release.
Two properties matter more than the coverage:
- The index is the scope ceiling. Every method carries its own scope
list —
grr api describereports it and a 403 names it — so whatever Google publishes next is reachable the day the discovery PR lands. The login requests only a small default set (core::auth::login_scopes), not the union; a method outside the current grant answers 403 untilgrr auth login --service …/--all-scopeswidens it. - Offline. The index is compiled in, so
grr api listanddescribework with no network and no cache directory.
Structs§
- Method
- Parameter
- Refresh
Report - One service’s refresh outcome, for the
grr api refreshreport. - Schema
- A pruned response schema: field names, types, array/enum shapes, and required markers — deliberately without descriptions (that is the bulk of the raw size, and the shape is what an outputSchema consumer needs).
- Service
Functions§
- all_
scopes - Every distinct scope the index names, sorted and deduped. The consent set
is built from this (
core::auth::scopes) instead of from a hand-typed list, so a scope Google adds arrives with the daily discovery PR rather than waiting for someone to notice a 403. Sorted, because the consent string must be byte-stable across runs. - build_
path - Expand a discovery path template into a URL path, substituting
{...}placeholders from the supplied parameters. - build_
query - Render a parameter map as a query string, skipping path parameters
(already substituted) and honouring
repeated: truefor multi-valued params such as Gmail’slabelIds. - cache_
dir - Where
grr api refreshstores fetched indexes, and whereservices()looks for a copy fresher than the embedded baseline. - refresh
- Fetch fresh Discovery documents and write them to the cache directory.
- resolve
- Resolve
service.resource.method(orservice..methodfor the few top-level methods that have no resource). - services
- Every service, keyed by name: the embedded baseline overlaid with any fresher on-disk cache. Parsed once, on first use.
- value_
to_ string