pub struct A2AClient { /* private fields */ }Expand description
HTTP client for discovery, unary calls, and SSE streams against a remote agent.
Implementations§
Source§impl A2AClient
impl A2AClient
Sourcepub fn new(base_url: &str) -> Result<Self, A2AError>
pub fn new(base_url: &str) -> Result<Self, A2AError>
Create a client with default configuration and a default reqwest client.
Sourcepub fn with_config(
base_url: &str,
config: A2AClientConfig,
) -> Result<Self, A2AError>
pub fn with_config( base_url: &str, config: A2AClientConfig, ) -> Result<Self, A2AError>
Create a client with explicit SDK configuration.
Sourcepub fn with_http_client(
base_url: &str,
client: Client,
config: A2AClientConfig,
) -> Result<Self, A2AError>
pub fn with_http_client( base_url: &str, client: Client, config: A2AClientConfig, ) -> Result<Self, A2AError>
Create a client with an explicit reqwest client and SDK configuration.
Sourcepub async fn discover_agent_card(&self) -> Result<AgentCard, A2AError>
pub async fn discover_agent_card(&self) -> Result<AgentCard, A2AError>
Discover the remote agent card, using the discovery cache when fresh.
Sourcepub async fn refresh_agent_card(&self) -> Result<AgentCard, A2AError>
pub async fn refresh_agent_card(&self) -> Result<AgentCard, A2AError>
Refresh the remote agent card and replace any cached copy.
Sourcepub async fn send_message(
&self,
request: SendMessageRequest,
) -> Result<SendMessageResponse, A2AError>
pub async fn send_message( &self, request: SendMessageRequest, ) -> Result<SendMessageResponse, A2AError>
Invoke SendMessage over the server’s preferred unary transport.
Sourcepub async fn send_streaming_message(
&self,
request: SendMessageRequest,
) -> Result<A2AClientStream, A2AError>
pub async fn send_streaming_message( &self, request: SendMessageRequest, ) -> Result<A2AClientStream, A2AError>
Invoke SendStreamingMessage over HTTP+JSON SSE.
Sourcepub async fn get_task(&self, request: GetTaskRequest) -> Result<Task, A2AError>
pub async fn get_task(&self, request: GetTaskRequest) -> Result<Task, A2AError>
Fetch a task by identifier.
Sourcepub async fn list_tasks(
&self,
request: ListTasksRequest,
) -> Result<ListTasksResponse, A2AError>
pub async fn list_tasks( &self, request: ListTasksRequest, ) -> Result<ListTasksResponse, A2AError>
List tasks using the server’s preferred unary transport.
Sourcepub async fn cancel_task(
&self,
request: CancelTaskRequest,
) -> Result<Task, A2AError>
pub async fn cancel_task( &self, request: CancelTaskRequest, ) -> Result<Task, A2AError>
Request cancellation of a task.
Sourcepub async fn get_extended_agent_card(
&self,
request: GetExtendedAgentCardRequest,
) -> Result<AgentCard, A2AError>
pub async fn get_extended_agent_card( &self, request: GetExtendedAgentCardRequest, ) -> Result<AgentCard, A2AError>
Fetch the extended agent card when the remote agent advertises it.
Sourcepub async fn create_task_push_notification_config(
&self,
request: TaskPushNotificationConfig,
) -> Result<TaskPushNotificationConfig, A2AError>
pub async fn create_task_push_notification_config( &self, request: TaskPushNotificationConfig, ) -> Result<TaskPushNotificationConfig, A2AError>
Create or replace a push-notification configuration for a task.
Sourcepub async fn get_task_push_notification_config(
&self,
request: GetTaskPushNotificationConfigRequest,
) -> Result<TaskPushNotificationConfig, A2AError>
pub async fn get_task_push_notification_config( &self, request: GetTaskPushNotificationConfigRequest, ) -> Result<TaskPushNotificationConfig, A2AError>
Fetch a single push-notification configuration by identifier.
Sourcepub async fn list_task_push_notification_configs(
&self,
request: ListTaskPushNotificationConfigsRequest,
) -> Result<ListTaskPushNotificationConfigsResponse, A2AError>
pub async fn list_task_push_notification_configs( &self, request: ListTaskPushNotificationConfigsRequest, ) -> Result<ListTaskPushNotificationConfigsResponse, A2AError>
List push-notification configurations for a task.
Sourcepub async fn delete_task_push_notification_config(
&self,
request: DeleteTaskPushNotificationConfigRequest,
) -> Result<(), A2AError>
pub async fn delete_task_push_notification_config( &self, request: DeleteTaskPushNotificationConfigRequest, ) -> Result<(), A2AError>
Delete a push-notification configuration by identifier.
Sourcepub async fn subscribe_to_task(
&self,
request: SubscribeToTaskRequest,
) -> Result<A2AClientStream, A2AError>
pub async fn subscribe_to_task( &self, request: SubscribeToTaskRequest, ) -> Result<A2AClientStream, A2AError>
Subscribe to task updates over HTTP+JSON SSE.