pub struct CoreClient<T> { /* private fields */ }Expand description
The sealed read surface, bound to one transport.
Implementations§
Source§impl<T> CoreClient<T>
impl<T> CoreClient<T>
Source§impl<T: TapesTransport> CoreClient<T>
impl<T: TapesTransport> CoreClient<T>
Sourcepub async fn call<R: DeserializeOwned>(
&self,
operation_id: &str,
values: Vec<(&str, String)>,
) -> Result<R>
pub async fn call<R: DeserializeOwned>( &self, operation_id: &str, values: Vec<(&str, String)>, ) -> Result<R>
Resolve one operation in the sealed contract and call it, decoding into a type the caller names.
The escape hatch — see the module docs. Equivalent to
CoreClient::call_with_body with no body, which is what every read
operation wants. An operation whose requestBody the contract marks
required is refused rather than sent without one.
§Errors
Any contract, transport, status, or decode failure; see crate::Error.
Sourcepub async fn call_with_body<R: DeserializeOwned>(
&self,
operation_id: &str,
values: Vec<(&str, String)>,
body: Option<String>,
) -> Result<R>
pub async fn call_with_body<R: DeserializeOwned>( &self, operation_id: &str, values: Vec<(&str, String)>, body: Option<String>, ) -> Result<R>
Resolve one operation and call it with a request body.
The body travels the same route as every other value: the contract decides whether the operation accepts one, requires one, or takes none, and a disagreement in either direction is refused before anything is sent. Without this the capability would exist one layer down and be unreachable from the facade callers actually use — which is exactly where a payload goes missing quietly.
§Errors
Any contract, transport, status, or decode failure; see crate::Error.
Sourcepub async fn call_with_claimed<R: DeserializeOwned>(
&self,
operation_id: &str,
values: Vec<(&str, String)>,
claimed: &[(String, String)],
) -> Result<R>
pub async fn call_with_claimed<R: DeserializeOwned>( &self, operation_id: &str, values: Vec<(&str, String)>, claimed: &[(String, String)], ) -> Result<R>
Resolve one operation and call it with claimed filter params appended to the query.
The claimed-param variant of CoreClient::call, for a consumer that
decodes into its own type — a CLI passing the server’s document
through verbatim, say. The typed sessions listing routes
SessionListParams::claimed
through the identical path, so the two spellings cannot drift.
The pairs travel exactly as given: appended to the query after the
declared parameters, repeats and order preserved, names as data. See
CoreClient::call_shaped for why they bypass the declared-parameter
refusal without loosening it.
The channel exists only where the sealed contract documents the claim
extension (ops::CLAIM_BEARING_OPS): a non-empty claimed set on
any other operation is refused before anything is sent, and an empty
set is equivalent to CoreClient::call everywhere.
§Errors
Any contract, transport, status, or decode failure; see crate::Error.
Sourcepub fn request_for(
&self,
operation_id: &str,
values: Vec<(&str, String)>,
) -> Result<WireRequest<'static>>
pub fn request_for( &self, operation_id: &str, values: Vec<(&str, String)>, ) -> Result<WireRequest<'static>>
Build the request for one operation without sending it.
For a caller that needs to inspect or decorate a request — a page walk setting cursors, a test asserting a URL — without a second route to the wire that could route values differently.
§Errors
Any contract failure; see crate::Error.
Sourcepub async fn list_sessions(
&self,
params: &SessionListParams,
) -> Result<SessionListResponse>
pub async fn list_sessions( &self, params: &SessionListParams, ) -> Result<SessionListResponse>
GET /v1/sessions — one page of the sessions listing.
§Errors
Any contract, transport, status, or decode failure; see crate::Error.
Sourcepub async fn list_all_sessions(
&self,
params: &SessionListParams,
) -> Result<Vec<SessionItem>>
pub async fn list_all_sessions( &self, params: &SessionListParams, ) -> Result<Vec<SessionItem>>
Every session the listing matches, following next_cursor to the end.
The cursor convention is crate::page’s, so this walk and a cassette
listing’s stop on the same three spellings of “no more pages” and share
the guard against a server that repeats a cursor.
§Errors
Any contract, transport, status, or decode failure; see crate::Error.
Sourcepub async fn get_session(&self, id: &str) -> Result<SessionDetailResponse>
pub async fn get_session(&self, id: &str) -> Result<SessionDetailResponse>
GET /v1/sessions/{id} — one session record.
§Errors
Any contract, transport, status, or decode failure; see crate::Error.
Sourcepub async fn update_session(
&self,
id: &str,
body: &SessionUpdateRequest,
) -> Result<SessionDetailResponse>
pub async fn update_session( &self, id: &str, body: &SessionUpdateRequest, ) -> Result<SessionDetailResponse>
PATCH /v1/sessions/{id} — rename a session.
§Errors
Any contract, transport, status, or decode failure; see crate::Error.
Sourcepub async fn delete_session(&self, id: &str) -> Result<()>
pub async fn delete_session(&self, id: &str) -> Result<()>
DELETE /v1/sessions/{id} — delete a session and its subtree.
§Errors
Any contract, transport, status, or decode failure; see crate::Error.
Sourcepub async fn get_session_traces(
&self,
id: &str,
params: &SessionTracesParams,
) -> Result<SessionTracesResponse>
pub async fn get_session_traces( &self, id: &str, params: &SessionTracesParams, ) -> Result<SessionTracesResponse>
GET /v1/sessions/{id}/traces — one page of the derived span read
model.
The page is the first limit traces in turn order, closed early on
its byte budget; session and links are whole on every page. A page
shorter than limit is not the end — an empty next_cursor is. For
the whole session in one envelope, see
CoreClient::get_whole_session_traces.
§Errors
Any contract, transport, status, or decode failure; see crate::Error.
Sourcepub async fn get_whole_session_traces(
&self,
id: &str,
params: &SessionTracesParams,
) -> Result<SessionTracesResponse>
pub async fn get_whole_session_traces( &self, id: &str, params: &SessionTracesParams, ) -> Result<SessionTracesResponse>
The whole composite view of one session, following next_cursor to
the end.
The first page’s envelope — session, links, schema — with every
page’s traces appended in order and next_cursor cleared: what the
unpaged response used to be. The cursor convention is
crate::page’s, so this walk stops on the same three spellings of
“no more pages” and shares the guard against a server that repeats a
cursor. params.cursor is the walk’s to set; a value passed in is
replaced.
§Errors
Any contract, transport, status, or decode failure; see crate::Error.
Sourcepub async fn list_raw_turns(
&self,
id: &str,
params: &RawTurnListParams,
) -> Result<RawTurnListResponse>
pub async fn list_raw_turns( &self, id: &str, params: &RawTurnListParams, ) -> Result<RawTurnListResponse>
GET /v1/sessions/{id}/raw_turns — one page of the wire log behind a
derivation.
The page is the next limit headers in raw turn id order; an empty
next_cursor is the end. For every header, see
CoreClient::list_all_raw_turns.
§Errors
Any contract, transport, status, or decode failure; see crate::Error.
Sourcepub async fn list_all_raw_turns(
&self,
id: &str,
params: &RawTurnListParams,
) -> Result<Vec<RawTurnHeaderItem>>
pub async fn list_all_raw_turns( &self, id: &str, params: &RawTurnListParams, ) -> Result<Vec<RawTurnHeaderItem>>
Every raw turn header of one session, following next_cursor to the
end.
The cursor convention is crate::page’s, so this walk and every
other listing’s stop on the same three spellings of “no more pages”
and share the guard against a server that repeats a cursor.
params.cursor is the walk’s to set; a value passed in is replaced.
§Errors
Any contract, transport, status, or decode failure; see crate::Error.
Sourcepub async fn list_traces(
&self,
params: &TraceListParams,
) -> Result<TraceListResponse>
pub async fn list_traces( &self, params: &TraceListParams, ) -> Result<TraceListResponse>
GET /v1/traces — the trace summaries for one session.
§Errors
Any contract, transport, status, or decode failure; see crate::Error.
Sourcepub async fn get_trace(
&self,
trace_id: &str,
params: &TraceParams,
) -> Result<StandaloneTraceDetail>
pub async fn get_trace( &self, trace_id: &str, params: &TraceParams, ) -> Result<StandaloneTraceDetail>
GET /v1/traces/{trace_id} — one page of a trace’s spans, with its
header, links, and owning session.
Only spans is paged; trace, links, schema, and session_id
are whole on every page. A page shorter than limit is not the end —
an empty next_cursor is. For the whole trace in one envelope, see
CoreClient::get_whole_trace.
§Errors
Any contract, transport, status, or decode failure; see crate::Error.
Sourcepub async fn get_whole_trace(
&self,
trace_id: &str,
params: &TraceParams,
) -> Result<StandaloneTraceDetail>
pub async fn get_whole_trace( &self, trace_id: &str, params: &TraceParams, ) -> Result<StandaloneTraceDetail>
One whole trace, following next_cursor to its last span.
The first page’s envelope — trace, links, schema, session_id —
with every page’s spans appended in order and next_cursor cleared:
what the unpaged response used to be. The cursor convention is
crate::page’s, so this walk stops on the same three spellings of
“no more pages” and shares the guard against a server that repeats a
cursor. params.cursor is the walk’s to set; a value passed in is
replaced.
§Errors
Any contract, transport, status, or decode failure; see crate::Error.
Sourcepub async fn get_span(&self, trace_id: &str, span_id: &str) -> Result<SpanItem>
pub async fn get_span(&self, trace_id: &str, span_id: &str) -> Result<SpanItem>
GET /v1/traces/{trace_id}/spans/{span_id} — one span, in full.
§Errors
Any contract, transport, status, or decode failure; see crate::Error.
Sourcepub async fn get_stats(&self, params: &StatsParams) -> Result<StatsResponse>
pub async fn get_stats(&self, params: &StatsParams) -> Result<StatsResponse>
GET /v1/stats — the aggregate rollups.
§Errors
Any contract, transport, status, or decode failure; see crate::Error.
Sourcepub async fn list_cassettes(&self) -> Result<Discovery>
pub async fn list_cassettes(&self) -> Result<Discovery>
GET /v1/cassettes — what this deployment serves.
Decodes into the cassette surface’s own model rather than a second copy
of it: crate::cassettes::discovery reads the fields the generated
command surface acts on, and modelling the document twice is the
duplication this crate exists to end.
§Errors
Any contract, transport, status, or decode failure; see crate::Error.
Sourcepub async fn seed_demo(&self, body: &SeedDemoRequest) -> Result<SeedResult>
pub async fn seed_demo(&self, body: &SeedDemoRequest) -> Result<SeedResult>
POST /v1/admin/seed/demo — replay the demo corpora.
§Errors
Any contract, transport, status, or decode failure; see crate::Error.
Source§impl<T: StreamingTransport> CoreClient<T>
impl<T: StreamingTransport> CoreClient<T>
Sourcepub async fn stream(
&self,
operation_id: &str,
values: Vec<(&str, String)>,
) -> Result<T::Body>
pub async fn stream( &self, operation_id: &str, values: Vec<(&str, String)>, ) -> Result<T::Body>
Resolve one operation and stream its response.
Bodyless, and deliberately so: nothing in this contract both streams a response and takes a request body. That is an observation about the document rather than a rule, so it is not enforced here — an operation that did take a required body would be refused with the same loud error as anywhere else, which is a signal to add the body-bearing sibling rather than a payload going missing.
§Errors
Any contract or transport failure; see crate::Error.