tapes_client/lib.rs
1#![doc = include_str!("../README.md")]
2//!
3//! # Module map
4//!
5//! The README above is the manual: the design rule, the two surfaces, the
6//! feature table, how to authenticate, and the migration tables from the two
7//! crates this one absorbed. This is the same set of seams as links.
8//!
9//! **The floor**, one implementation each and shared by both surfaces:
10//! [`transport`] (the seam), [`error`] (one taxonomy), [`decode`] (one policy),
11//! [`page`] (one cursor convention), [`path`] (one join, two modes).
12//!
13//! **The two surfaces:** [`core`] is the sealed contract — [`core::contract`]
14//! reduces the vendored document to an operation table, [`core::coverage`]
15//! gates operations, [`core::models`] holds the shapes with
16//! [`core::models::coverage`] gating them, and [`core::CoreClient`] is the call
17//! surface. [`cassettes`] is the discovered equivalent.
18//!
19//! **Behind features:** [`cli`] synthesizes clap commands from a discovered
20//! surface; [`http`] is the HTTP engine plus [`http::HttpAuth`], the credential
21//! hook that replaced whole-transport implementations.
22//!
23//! Two gates are easy to conflate and fail differently. [`core::coverage`]
24//! gates *operations*: it fails a build when a contract bump adds an operation
25//! the client neither exposes nor allow-lists. [`core::models::coverage`] gates
26//! *shapes*: it synthesises a document from each schema, round-trips it through
27//! the model, and names by path anything the model drops. An operation gap is a
28//! call you cannot make; a shape gap is a field you silently lose.
29//!
30//! # Names
31//!
32//! The repository is `tapes-crates`; this crate is one of its four members.
33//! `tapes` is a different repository entirely — the server this client reads
34//! from. Note also that [`core`](mod@crate::core) is a module here as well as a
35//! Rust crate, and that [`cassettes::invoke`](mod@crate::cassettes::invoke)
36//! names both a module and a function inside it.
37
38#![forbid(unsafe_code)]
39#![warn(missing_docs)]
40
41pub mod cassettes;
42pub mod core;
43pub mod decode;
44pub mod error;
45pub mod page;
46pub mod path;
47pub mod transport;
48
49#[cfg(feature = "cli")]
50pub mod cli;
51
52#[cfg(feature = "direct-http")]
53pub mod http;
54
55pub use error::{Error, Result};
56pub use page::Page;
57pub use path::{PathMode, call_url};
58pub use transport::{
59 Call, SpecFetch, SpecTransport, StreamingTransport, TapesTransport, TransportError, Wire,
60 WireRequest, WireResponse,
61};
62
63pub use crate::cassettes::{
64 CacheConfig, Cassette, Discovery, DiscoveryEntry, Location, Method, Param, ReducerConfig,
65 Surface,
66};
67pub use crate::core::{ContractModel, CoreClient, CoreSurface, TAPES_API_YAML, models, ops};
68
69#[cfg(feature = "direct-http")]
70pub use http::{DirectHttp, HttpAuth, HttpEngine, NoAuth, Rejected, Unauthorized};