pub struct JsonRpcTransport { /* private fields */ }Expand description
JSON-RPC 2.0 transport: HTTP POST to a single endpoint.
Create via JsonRpcTransport::new or let crate::ClientBuilder
construct one automatically from the agent card.
Implementations§
Source§impl JsonRpcTransport
impl JsonRpcTransport
Sourcepub fn new(endpoint: impl Into<String>) -> Result<JsonRpcTransport, ClientError>
pub fn new(endpoint: impl Into<String>) -> Result<JsonRpcTransport, ClientError>
Creates a new transport targeting the given endpoint URL.
The endpoint is typically the url field from an a2a_protocol_types::AgentCard.
§Errors
Returns ClientError::InvalidEndpoint if the URL is malformed.
Sourcepub fn with_timeout(
endpoint: impl Into<String>,
request_timeout: Duration,
) -> Result<JsonRpcTransport, ClientError>
pub fn with_timeout( endpoint: impl Into<String>, request_timeout: Duration, ) -> Result<JsonRpcTransport, ClientError>
Creates a new transport with a custom request timeout.
§Errors
Returns ClientError::InvalidEndpoint if the URL is malformed.
Sourcepub fn with_timeouts(
endpoint: impl Into<String>,
request_timeout: Duration,
stream_connect_timeout: Duration,
) -> Result<JsonRpcTransport, ClientError>
pub fn with_timeouts( endpoint: impl Into<String>, request_timeout: Duration, stream_connect_timeout: Duration, ) -> Result<JsonRpcTransport, ClientError>
Creates a new transport with separate request and stream connect timeouts.
§Errors
Returns ClientError::InvalidEndpoint if the URL is malformed.
Trait Implementations§
Source§impl Clone for JsonRpcTransport
impl Clone for JsonRpcTransport
Source§fn clone(&self) -> JsonRpcTransport
fn clone(&self) -> JsonRpcTransport
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for JsonRpcTransport
impl Debug for JsonRpcTransport
Source§impl Transport for JsonRpcTransport
impl Transport for JsonRpcTransport
Source§fn send_request<'a>(
&'a self,
method: &'a str,
params: Value,
extra_headers: &'a HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<Value, ClientError>> + Send + 'a>>
fn send_request<'a>( &'a self, method: &'a str, params: Value, extra_headers: &'a HashMap<String, String>, ) -> Pin<Box<dyn Future<Output = Result<Value, ClientError>> + Send + 'a>>
Sends a non-streaming JSON-RPC or REST request. Read more
Source§fn send_streaming_request<'a>(
&'a self,
method: &'a str,
params: Value,
extra_headers: &'a HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<EventStream, ClientError>> + Send + 'a>>
fn send_streaming_request<'a>( &'a self, method: &'a str, params: Value, extra_headers: &'a HashMap<String, String>, ) -> Pin<Box<dyn Future<Output = Result<EventStream, ClientError>> + Send + 'a>>
Sends a streaming request and returns an
EventStream. Read moreAuto Trait Implementations§
impl Freeze for JsonRpcTransport
impl !RefUnwindSafe for JsonRpcTransport
impl Send for JsonRpcTransport
impl Sync for JsonRpcTransport
impl Unpin for JsonRpcTransport
impl UnsafeUnpin for JsonRpcTransport
impl !UnwindSafe for JsonRpcTransport
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
Mutably borrows from an owned value. Read more