Skip to main content

Crate sendra_core

Crate sendra_core 

Source
Expand description

Core model for Sendra: request/response types, YAML loading, HTTP execution.

This crate is deliberately free of CLI concerns (argument parsing, terminal colouring, exit codes). A future sendra-tui crate will depend on it directly, so everything here returns typed SendraError values that a front-end can match on rather than pre-formatted strings.

Re-exports§

pub use assertions::AssertionKind;
pub use assertions::AssertionReport;
pub use assertions::AssertionResult;
pub use assertions::Assertions;
pub use assertions::NotAssertions;
pub use capture::CaptureFailure;
pub use capture::CaptureReport;
pub use capture::CaptureResult;
pub use capture::CaptureSource;
pub use capture::Captures;
pub use collection::Collection;
pub use collection::Document;
pub use config::Config;
pub use environment::Environment;
pub use http::client::build_client;
pub use http::client::HttpClient;
pub use http::response::RedirectHop;
pub use http::response::Response;
pub use http::send;
pub use http::send_prepared;
pub use oauth::build_authorization_url;
pub use oauth::exchange_authorization_code;
pub use oauth::generate_pkce;
pub use oauth::generate_state;
pub use oauth::OAuthTokenCache;
pub use oauth::PkcePair;
pub use request::auth::ApiKeyAuth;
pub use request::auth::ApiKeyLocation;
pub use request::auth::Auth;
pub use request::auth::BasicAuth;
pub use request::auth::OAuthAuth;
pub use request::auth::OAuthGrantType;
pub use request::multipart::MultipartPart;
pub use request::Method;
pub use request::Request;
pub use request::RetryConfig;
pub use script::Hook;
pub use script::Script;
pub use script::ScriptOutcome;
pub use script::ScriptOutput;
pub use script::Scripts;

Modules§

assertions
Declarative checks a request makes against the response it gets back.
capture
Values a request pulls out of its response and hands to the requests after it.
collection
Collection and Document: a named group of requests in one YAML file, and the two shapes a Sendra file can hold.
config
Tool-wide configuration: where Sendra’s config files live, how a project config overrides a global one, and what the result does to a request.
environment
Environments: named files of variables, and the substitution pass that puts them into a request.
http
Sending a crate::Request over the wire: send and send_prepared, the client that carries them (client), and what comes back (response).
oauth
OAuth token acquisition for auth.oauth’s three supported grants — client_credentials, password, and authorization_code — and OAuthTokenCache, the in-run, in-memory cache that lets many requests sharing one oauth: config reuse one token instead of re-authenticating per request.
request
Request: the on-disk shape of one request, its parsing/validation, and Method. The three “structured input becomes the final wire form” passes — Request::resolve_query, Request::resolve_body, Request::resolve_auth — live in resolve, each field’s own type lives in multipart/auth, and the repeated-header (de)serializers live in headers (private: only Request’s own #[serde(...)] attributes need them).
script
The pre_request and post_request hooks: compiling them, running them, and the closed surface a script can see.

Enums§

SendraError
Every way loading or sending a request can fail.