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 — 308 methods across ten services in ~350 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:
- Least privilege. Each method carries its own scope list, and grr authorises only the scopes the requested method needs. Asking for all 97 Workspace scopes up front would exceed the ~25-scope ceiling Google applies to unverified apps in testing mode, and would fail at consent; per-method authorisation sidesteps that entirely.
- 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. - Service
Functions§
- 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