pub struct StatelessHttpClient { /* private fields */ }Expand description
A Streamable HTTP client that speaks the stateless lifecycle.
Implementations§
Source§impl StatelessHttpClient
impl StatelessHttpClient
Sourcepub fn new(
config: HttpClientConfig,
version: ProtocolVersion,
capabilities: Value,
) -> Result<Self, HttpClientError>
pub fn new( config: HttpClientConfig, version: ProtocolVersion, capabilities: Value, ) -> Result<Self, HttpClientError>
A client speaking version, declaring capabilities on every request.
capabilities is a ClientCapabilities object. It is sent on every
request because the server may not remember it: “Servers MUST NOT infer
capabilities from prior requests”.
§Errors
HttpClientError if the HTTP client cannot be built.
This client, authenticating through auth.
Sourcepub const fn version(&self) -> ProtocolVersion
pub const fn version(&self) -> ProtocolVersion
The revision every request is sent at.
Trait Implementations§
Source§impl ClientTransport for StatelessHttpClient
impl ClientTransport for StatelessHttpClient
Source§fn send(
&self,
method: &str,
params: &JsonObject,
) -> Pin<Box<dyn Future<Output = Result<JsonObject, TransportError>> + Send + '_>>
fn send( &self, method: &str, params: &JsonObject, ) -> Pin<Box<dyn Future<Output = Result<JsonObject, TransportError>> + Send + '_>>
POSTs one self-describing request and returns its result.
An InputRequiredResult is a result like any other and is returned as
one: answering the input requests it carries is the caller’s decision —
it may need a person — and a transport that answered on the caller’s
behalf would be inventing consent.
§Errors
TransportError::Unavailable for a frame that cannot be assembled, a
refused POST, or a reply carrying an error.
Source§fn notify(
&self,
method: &str,
params: &JsonObject,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + '_>>
fn notify( &self, method: &str, params: &JsonObject, ) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + '_>>
POSTs a notification. The core protocol defines none a client sends over this transport at this revision, but an extension may.
§Errors
TransportError::Unavailable if the frame cannot be assembled or the
POST is refused.