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 — the derived span read model.
§Errors
Any contract, transport, status, or decode failure; see crate::Error.
Sourcepub async fn list_raw_turns(&self, id: &str) -> Result<RawTurnListResponse>
pub async fn list_raw_turns(&self, id: &str) -> Result<RawTurnListResponse>
GET /v1/sessions/{id}/raw_turns — the wire log behind a derivation.
§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<TraceDetail>
pub async fn get_trace( &self, trace_id: &str, params: &TraceParams, ) -> Result<TraceDetail>
GET /v1/traces/{trace_id} — one trace with its spans.
§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.
Trait Implementations§
Source§impl<T: Clone> Clone for CoreClient<T>
impl<T: Clone> Clone for CoreClient<T>
Source§fn clone(&self) -> CoreClient<T>
fn clone(&self) -> CoreClient<T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more