pub struct HttpClient { /* private fields */ }Expand description
HTTP client for interacting with the A2A protocol via ConnectRPC
Implementations§
Source§impl HttpClient
impl HttpClient
Sourcepub fn with_auth(base_url: String, auth_token: String) -> Self
pub fn with_auth(base_url: String, auth_token: String) -> Self
Create a new HTTP client with authentication
Sourcepub fn with_timeout(self, timeout: u64) -> Self
pub fn with_timeout(self, timeout: u64) -> Self
Set the timeout for requests
Sourcepub async fn get_agent_card(&self) -> Result<AgentCard, A2AError>
pub async fn get_agent_card(&self) -> Result<AgentCard, A2AError>
Fetch the agent card from the agent’s /agent-card endpoint (plain HTTP GET)
Trait Implementations§
Source§impl Transport for HttpClient
impl Transport for HttpClient
Source§fn protocol(&self) -> &str
fn protocol(&self) -> &str
The wire protocol this transport speaks, matching an agent interface’s
protocol_binding (e.g. "JSONRPC", "CONNECTRPC", "GRPC").Source§fn send_task_message<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
message: &'life2 Message,
session_id: Option<&'life3 str>,
history_length: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn send_task_message<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
message: &'life2 Message,
session_id: Option<&'life3 str>,
history_length: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Send a message to a task
Source§fn get_task<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
history_length: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_task<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
history_length: Option<u32>,
) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get a task by ID
Source§fn cancel_task<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn cancel_task<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Task, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Cancel a task
Source§fn set_task_push_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 TaskPushNotificationConfig,
) -> Pin<Box<dyn Future<Output = Result<TaskPushNotificationConfig, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn set_task_push_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 TaskPushNotificationConfig,
) -> Pin<Box<dyn Future<Output = Result<TaskPushNotificationConfig, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Set up push notifications for a task
Source§fn get_task_push_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<TaskPushNotificationConfig, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_task_push_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<TaskPushNotificationConfig, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get push notification configuration for a task
Source§fn list_tasks<'life0, 'life1, 'async_trait>(
&'life0 self,
params: &'life1 ListTasksParams,
) -> Pin<Box<dyn Future<Output = Result<ListTasksResult, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_tasks<'life0, 'life1, 'async_trait>(
&'life0 self,
params: &'life1 ListTasksParams,
) -> Pin<Box<dyn Future<Output = Result<ListTasksResult, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List tasks with filtering and pagination (v1.0.0)
Source§fn list_push_notification_configs<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<TaskPushNotificationConfig>, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_push_notification_configs<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<TaskPushNotificationConfig>, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List all push notification configs for a task (v1.0.0)
Source§fn get_push_notification_config<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
config_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<TaskPushNotificationConfig, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_push_notification_config<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
config_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<TaskPushNotificationConfig, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Get a specific push notification config by ID (v1.0.0)
Source§fn delete_push_notification_config<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
config_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn delete_push_notification_config<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
config_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Delete a specific push notification config (v1.0.0)
Source§fn subscribe_to_task<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
_history_length: Option<u32>,
_last_event_id: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<StreamEvent, A2AError>> + Send>>, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn subscribe_to_task<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
_history_length: Option<u32>,
_last_event_id: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<StreamEvent, A2AError>> + Send>>, A2AError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Subscribe to task updates (for streaming). Read more
Auto Trait Implementations§
impl !Freeze for HttpClient
impl !RefUnwindSafe for HttpClient
impl !UnwindSafe for HttpClient
impl Send for HttpClient
impl Sync for HttpClient
impl Unpin for HttpClient
impl UnsafeUnpin for HttpClient
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
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>
Converts
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>
Converts
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