Expand description
The Rust client for the HEY API.
Types, routes and service methods are generated from the Smithy model in the
repository’s spec/ directory; everything else in this crate is the plumbing they
share: authentication, retries, redirects, the response cache, pagination and account
scope. All of it sends through one http::HttpClient, which an application may
replace with its own; the reqwest feature, on by default, ships one.
use hey_sdk::{Client, Config, StaticTokenProvider};
let client = Client::new(Config::default(), StaticTokenProvider::new(std::env::var("HEY_TOKEN").unwrap()))?;
for mailbox in client.boxes().list().await?.iter() {
println!("{} ({})", mailbox.name, mailbox.kind);
}Re-exports§
pub use auth::AuthStrategy;pub use auth::BearerAuth;pub use auth::StaticTokenProvider;pub use auth::TokenProvider;pub use client::Client;pub use client::ClientBuilder;pub use client::Response;pub use config::Config;pub use error::Error;pub use error::ErrorCode;pub use form::FormResponse;pub use http::HttpClient;pub use operation::Operation;pub use pagination::Page;pub use types::Date;pub use types::DateTime;pub use types::SensitiveString;pub use version::API_VERSION;pub use version::VERSION;
Modules§
- auth
- Who a request goes out as: the token it carries and the strategy that puts it on.
- cache
- The response cache: JSON reads kept by
ETag, so a repeated one is answered from a 304. - client
- The client, how it is built, and the send every call goes through.
- config
- What a client needs to know before it can talk to HEY, and where that is read from.
- error
- The error every call can answer with, its categories, and the exit status each maps to.
- form
- Talking to HEY’s form-backed endpoints, and what they answer with. Several parts of HEY have no JSON surface: a workflow is created by posting a form and reading the record back out of the redirect the browser would have followed.
- http
- The HTTP layer the client sends on, and the seam for replacing it.
- models
- The request and response types HEY speaks, generated from the model.
- oauth
- Signing in to HEY over OAuth 2.0: discovery, the authorization code flow with PKCE, and refresh.
- observability
- What the SDK tells an application about the calls it makes: which operation is running, which HTTP requests it takes, and what each one answered.
- operation
- A request the client has not sent yet, and everything a caller may say about it first.
- pagination
- Paginated reads: one page with the cursor for the next, and the walks that follow it.
- resilience
- Three ways to stop a struggling HEY from taking the caller down with it: a circuit breaker that gives up on an operation that keeps failing, a bulkhead that caps how many calls of one kind run at once, and a rate limiter that keeps the caller inside a budget of its own.
- route
- What the model says about an operation: its method, its path template and how it behaves.
- routes
- Every modelled route, generated from the model.
- security
- The checks that keep credentials on the HEY origin, and the redaction that keeps them out of logs.
- services
- The service handles a
crate::Clienthands out, one per resource. Their methods are generated from the model; the modules here add the hand-written conveniences on top and re-export the generated service they extend. - types
- The scalars HEY’s records are made of: dates, instants, and strings that must not be logged.
- url
- Recognizing HEY paths and URLs as pasted from the web app, offline.
- version
- The SDK’s version, the API contract it was built against, and the
User-Agentnaming both.