pub struct Api { /* private fields */ }Expand description
Everything the routes need.
Implementations§
Source§impl Api
impl Api
Sourcepub const DEFAULT_LIMIT: usize = 100
pub const DEFAULT_LIMIT: usize = 100
Default worklist page size.
Sourcepub const DEFAULT_HISTORY_LIMIT: usize = 200
pub const DEFAULT_HISTORY_LIMIT: usize = 200
Default bound on how much of a matter’s history one case view returns.
Bounded because a case can run for months and an operator page is not a bulk export. The response says when it truncated, because a shortened list is shaped exactly like a complete one and a reader who cannot tell will read absence as evidence.
Sourcepub fn new(
planes: impl Into<Planes>,
auth: Arc<dyn Authenticator>,
) -> Result<Self, ApiSetupError>
pub fn new( planes: impl Into<Planes>, auth: Arc<dyn Authenticator>, ) -> Result<Self, ApiSetupError>
Build the surface over one plane, or several.
Takes anything that becomes Planes, so a single-tenant deployment
still passes its runtime and reads the same as before.
§Errors
ApiSetupError::NoPolicy if any plane has no policy engine — one
ungoverned tenant among governed ones is the one an attacker looks for.
ApiSetupError::NoPlanes if none was registered, which would serve
nobody while starting cleanly.
Sourcepub const fn limit(self, limit: usize) -> Self
pub const fn limit(self, limit: usize) -> Self
How many entries one listing page returns.
Every listing reads one past this and truncates, so there is more is a fact rather than an inference from a full page. The read is saturating: a ceiling set at the type’s own maximum would otherwise wrap the request to zero, and a backlog that answers empty is the one failure a listing must not have.
Sourcepub const fn history_limit(self, limit: usize) -> Self
pub const fn history_limit(self, limit: usize) -> Self
How much history one view returns — a matter’s, or a run’s.
Its own knob rather than limit, because the two bound
different readings: a list page is scanned, a history is followed — and
an operator who widens the worklist page should not silently deepen
every case view with it.
One knob for both histories rather than two, because they are the same
reading: a page of records a caller continues from a cursor. A run’s is
the one that keeps going — ?from=<seq> picks up where the last page
stopped — while a matter’s is bounded by the matter.
Sourcepub fn router(self) -> Router
pub fn router(self) -> Router
The router.
Every route authenticates and then authorizes. There is no
unauthenticated one to forget about and no “internal” path that skips
either gate — tests/wire/api.rs walks the route table and asserts it.
The routes are openapi::ROUTES, the table the published document is
generated from, so a route is added in one place and is documented by
being served.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Api
impl !UnwindSafe for Api
impl Freeze for Api
impl Send for Api
impl Sync for Api
impl Unpin for Api
impl UnsafeUnpin for Api
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more