Expand description
Rust client for canopy’s public API.
The wire types and the per-endpoint methods in schema are generated from
canopy’s OpenAPI document, which lives in the same repository as this crate,
so they are the types canopy declares rather than a separate description of
them. The document and this crate carry the same version.
§Calling canopy
CanopyClient has one method per operation, taking and returning the
generated types. The method name comes from the path (/backup-credentials
becomes backup_credentials), with the verb prefixed where a path is served
by more than one verb.
How a request reaches canopy is the consumer’s to decide: this crate depends
on no HTTP client, and a consumer supplies a CanopyTransport which
resolves the host, the scheme, and the authentication itself. Any status
outside the success range surfaces as CanopyHttpError, since endpoints
give particular statuses a meaning only the caller can read.
§What the generated types carry
Timestamp fields are jiff::Timestamp rather than text, and credential
secrets are wrapped in Redacted so they stay out of Debug output and
logs; read them through the inner value. Schemas that carry arbitrary further
keys alongside their declared fields generate a map field holding the rest, so
those keys can be both sent and read.
Generated structs are #[non_exhaustive] and carry a builder, so a schema
gaining a field leaves construction working for a consumer that does not set
it.
Re-exports§
Modules§
- schema
- Wire types and per-endpoint methods generated from canopy’s OpenAPI document.
Structs§
- Canopy
Client - Typed client for canopy’s public API.
- Canopy
Http Error - A non-2xx response from a canopy endpoint.
- Redacted
- Wraps a sensitive value so its
Debugoutput doesn’t leak the contents.
Enums§
- Error
- Anything that can go wrong calling canopy.
Traits§
- Canopy
Transport - The HTTP transport a
CanopyClientsends through.
Type Aliases§
- Canopy
Request - A request built by
CanopyClient, ready for aCanopyTransportto send. - Canopy
Response - A response handed back to
CanopyClientby aCanopyTransport, with its body buffered. - Result
- Result alias used throughout the crate.