Skip to main content

A2aClient

Struct A2aClient 

Source
pub struct A2aClient { /* private fields */ }
Expand description

Unified A2A client.

Implementations§

Source§

impl A2aClient

Source

pub fn new_jsonrpc(base_url: Url) -> Self

Create a client using JSON-RPC transport.

Source

pub fn new_rest(base_url: Url) -> Self

Create a client using REST transport.

Source

pub fn with_bearer_token(self, token: &str) -> Self

Set a bearer token for authentication.

Returns a new client with the token applied to the active transport.

Source

pub async fn discover(base_url: &str) -> Result<AgentCard, A2aError>

Discover an agent card from a well-known URL.

Source

pub async fn send_message( &self, req: SendMessageRequest, ) -> Result<SendMessageResponse, A2aError>

Send a message.

Source

pub fn stream_message( &self, req: SendMessageRequest, ) -> Pin<Box<dyn Stream<Item = Result<StreamResponse, A2aError>> + Send>>

Stream a message (returns SSE events).

Source

pub async fn get_task(&self, req: GetTaskRequest) -> Result<Task, A2aError>

Get a task by ID.

Source

pub async fn list_tasks( &self, req: ListTasksRequest, ) -> Result<ListTasksResponse, A2aError>

List tasks.

Source

pub async fn cancel_task( &self, req: CancelTaskRequest, ) -> Result<Task, A2aError>

Cancel a task.

Source

pub fn subscribe_to_task( &self, req: SubscribeToTaskRequest, ) -> Pin<Box<dyn Stream<Item = Result<StreamResponse, A2aError>> + Send>>

Subscribe to task updates.

Source

pub async fn set_push_config( &self, config: TaskPushNotificationConfig, ) -> Result<TaskPushNotificationConfig, A2aError>

Set push notification config.

Source

pub async fn get_push_config( &self, req: GetTaskPushNotificationConfigRequest, ) -> Result<TaskPushNotificationConfig, A2aError>

Get push notification config.

Source

pub async fn delete_push_config( &self, req: DeleteTaskPushNotificationConfigRequest, ) -> Result<(), A2aError>

Delete push notification config.

Source

pub async fn list_push_configs( &self, req: ListTaskPushNotificationConfigsRequest, ) -> Result<ListTaskPushNotificationConfigsResponse, A2aError>

List push notification configs.

Source

pub async fn get_authenticated_extended_card( &self, req: GetExtendedAgentCardRequest, ) -> Result<AgentCard, A2aError>

Get the authenticated extended agent card.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,