pub struct A2aServiceClient<T> { /* private fields */ }Expand description
Client for this service.
Generic over T: ClientTransport. For gRPC (HTTP/2), use
Http2Connection — it has honest poll_ready and composes with
tower::balance for multi-connection load balancing. For Connect
over HTTP/1.1 (or unknown protocol), use HttpClient.
§Example (gRPC / HTTP/2)
use connectrpc::client::{Http2Connection, ClientConfig};
use connectrpc::Protocol;
let uri: http::Uri = "http://localhost:8080".parse()?;
let conn = Http2Connection::connect_plaintext(uri.clone()).await?.shared(1024);
let config = ClientConfig::new(uri).protocol(Protocol::Grpc);
let client = A2aServiceClient::new(conn, config);
let response = client.send_message(request).await?;§Example (Connect / HTTP/1.1 or ALPN)
use connectrpc::client::{HttpClient, ClientConfig};
let http = HttpClient::plaintext(); // cleartext http:// only
let config = ClientConfig::new("http://localhost:8080".parse()?);
let client = A2aServiceClient::new(http, config);
let response = client.send_message(request).await?;§Working with the response
Unary calls return UnaryResponse<OwnedView<FooView>>.
The OwnedView derefs to the view, so field access is zero-copy:
let resp = client.send_message(request).await?.into_view();
let name: &str = resp.name; // borrow into the response bufferIf you need the owned struct (e.g. to store or pass by value), use
into_owned():
let owned = client.send_message(request).await?.into_owned();Implementations§
Source§impl<T> A2aServiceClient<T>
impl<T> A2aServiceClient<T>
Sourcepub fn new(transport: T, config: ClientConfig) -> Self
pub fn new(transport: T, config: ClientConfig) -> Self
Create a new client with the given transport and configuration.
Sourcepub fn config(&self) -> &ClientConfig
pub fn config(&self) -> &ClientConfig
Get the client configuration.
Sourcepub fn config_mut(&mut self) -> &mut ClientConfig
pub fn config_mut(&mut self) -> &mut ClientConfig
Get a mutable reference to the client configuration.
Sourcepub async fn send_message(
&self,
request: SendMessageRequest,
) -> Result<UnaryResponse<OwnedView<SendMessageResponseView<'static>>>, ConnectError>
pub async fn send_message( &self, request: SendMessageRequest, ) -> Result<UnaryResponse<OwnedView<SendMessageResponseView<'static>>>, ConnectError>
Call the SendMessage RPC. Sends a request to /lf.a2a.v1.A2AService/SendMessage.
Sourcepub async fn send_message_with_options(
&self,
request: SendMessageRequest,
options: CallOptions,
) -> Result<UnaryResponse<OwnedView<SendMessageResponseView<'static>>>, ConnectError>
pub async fn send_message_with_options( &self, request: SendMessageRequest, options: CallOptions, ) -> Result<UnaryResponse<OwnedView<SendMessageResponseView<'static>>>, ConnectError>
Call the SendMessage RPC with explicit per-call options. Options override ClientConfig defaults.
Sourcepub async fn send_streaming_message(
&self,
request: SendMessageRequest,
) -> Result<ServerStream<T::ResponseBody, StreamResponseView<'static>>, ConnectError>
pub async fn send_streaming_message( &self, request: SendMessageRequest, ) -> Result<ServerStream<T::ResponseBody, StreamResponseView<'static>>, ConnectError>
Call the SendStreamingMessage RPC. Sends a request to /lf.a2a.v1.A2AService/SendStreamingMessage.
Sourcepub async fn send_streaming_message_with_options(
&self,
request: SendMessageRequest,
options: CallOptions,
) -> Result<ServerStream<T::ResponseBody, StreamResponseView<'static>>, ConnectError>
pub async fn send_streaming_message_with_options( &self, request: SendMessageRequest, options: CallOptions, ) -> Result<ServerStream<T::ResponseBody, StreamResponseView<'static>>, ConnectError>
Call the SendStreamingMessage RPC with explicit per-call options. Options override ClientConfig defaults.
Sourcepub async fn get_task(
&self,
request: GetTaskRequest,
) -> Result<UnaryResponse<OwnedView<TaskView<'static>>>, ConnectError>
pub async fn get_task( &self, request: GetTaskRequest, ) -> Result<UnaryResponse<OwnedView<TaskView<'static>>>, ConnectError>
Call the GetTask RPC. Sends a request to /lf.a2a.v1.A2AService/GetTask.
Sourcepub async fn get_task_with_options(
&self,
request: GetTaskRequest,
options: CallOptions,
) -> Result<UnaryResponse<OwnedView<TaskView<'static>>>, ConnectError>
pub async fn get_task_with_options( &self, request: GetTaskRequest, options: CallOptions, ) -> Result<UnaryResponse<OwnedView<TaskView<'static>>>, ConnectError>
Call the GetTask RPC with explicit per-call options. Options override ClientConfig defaults.
Sourcepub async fn list_tasks(
&self,
request: ListTasksRequest,
) -> Result<UnaryResponse<OwnedView<ListTasksResponseView<'static>>>, ConnectError>
pub async fn list_tasks( &self, request: ListTasksRequest, ) -> Result<UnaryResponse<OwnedView<ListTasksResponseView<'static>>>, ConnectError>
Call the ListTasks RPC. Sends a request to /lf.a2a.v1.A2AService/ListTasks.
Sourcepub async fn list_tasks_with_options(
&self,
request: ListTasksRequest,
options: CallOptions,
) -> Result<UnaryResponse<OwnedView<ListTasksResponseView<'static>>>, ConnectError>
pub async fn list_tasks_with_options( &self, request: ListTasksRequest, options: CallOptions, ) -> Result<UnaryResponse<OwnedView<ListTasksResponseView<'static>>>, ConnectError>
Call the ListTasks RPC with explicit per-call options. Options override ClientConfig defaults.
Sourcepub async fn cancel_task(
&self,
request: CancelTaskRequest,
) -> Result<UnaryResponse<OwnedView<TaskView<'static>>>, ConnectError>
pub async fn cancel_task( &self, request: CancelTaskRequest, ) -> Result<UnaryResponse<OwnedView<TaskView<'static>>>, ConnectError>
Call the CancelTask RPC. Sends a request to /lf.a2a.v1.A2AService/CancelTask.
Sourcepub async fn cancel_task_with_options(
&self,
request: CancelTaskRequest,
options: CallOptions,
) -> Result<UnaryResponse<OwnedView<TaskView<'static>>>, ConnectError>
pub async fn cancel_task_with_options( &self, request: CancelTaskRequest, options: CallOptions, ) -> Result<UnaryResponse<OwnedView<TaskView<'static>>>, ConnectError>
Call the CancelTask RPC with explicit per-call options. Options override ClientConfig defaults.
Sourcepub async fn subscribe_to_task(
&self,
request: SubscribeToTaskRequest,
) -> Result<ServerStream<T::ResponseBody, StreamResponseView<'static>>, ConnectError>
pub async fn subscribe_to_task( &self, request: SubscribeToTaskRequest, ) -> Result<ServerStream<T::ResponseBody, StreamResponseView<'static>>, ConnectError>
Call the SubscribeToTask RPC. Sends a request to /lf.a2a.v1.A2AService/SubscribeToTask.
Sourcepub async fn subscribe_to_task_with_options(
&self,
request: SubscribeToTaskRequest,
options: CallOptions,
) -> Result<ServerStream<T::ResponseBody, StreamResponseView<'static>>, ConnectError>
pub async fn subscribe_to_task_with_options( &self, request: SubscribeToTaskRequest, options: CallOptions, ) -> Result<ServerStream<T::ResponseBody, StreamResponseView<'static>>, ConnectError>
Call the SubscribeToTask RPC with explicit per-call options. Options override ClientConfig defaults.
Sourcepub async fn create_task_push_notification_config(
&self,
request: TaskPushNotificationConfig,
) -> Result<UnaryResponse<OwnedView<TaskPushNotificationConfigView<'static>>>, ConnectError>
pub async fn create_task_push_notification_config( &self, request: TaskPushNotificationConfig, ) -> Result<UnaryResponse<OwnedView<TaskPushNotificationConfigView<'static>>>, ConnectError>
Call the CreateTaskPushNotificationConfig RPC. Sends a request to /lf.a2a.v1.A2AService/CreateTaskPushNotificationConfig.
Sourcepub async fn create_task_push_notification_config_with_options(
&self,
request: TaskPushNotificationConfig,
options: CallOptions,
) -> Result<UnaryResponse<OwnedView<TaskPushNotificationConfigView<'static>>>, ConnectError>
pub async fn create_task_push_notification_config_with_options( &self, request: TaskPushNotificationConfig, options: CallOptions, ) -> Result<UnaryResponse<OwnedView<TaskPushNotificationConfigView<'static>>>, ConnectError>
Call the CreateTaskPushNotificationConfig RPC with explicit per-call options. Options override ClientConfig defaults.
Sourcepub async fn get_task_push_notification_config(
&self,
request: GetTaskPushNotificationConfigRequest,
) -> Result<UnaryResponse<OwnedView<TaskPushNotificationConfigView<'static>>>, ConnectError>
pub async fn get_task_push_notification_config( &self, request: GetTaskPushNotificationConfigRequest, ) -> Result<UnaryResponse<OwnedView<TaskPushNotificationConfigView<'static>>>, ConnectError>
Call the GetTaskPushNotificationConfig RPC. Sends a request to /lf.a2a.v1.A2AService/GetTaskPushNotificationConfig.
Sourcepub async fn get_task_push_notification_config_with_options(
&self,
request: GetTaskPushNotificationConfigRequest,
options: CallOptions,
) -> Result<UnaryResponse<OwnedView<TaskPushNotificationConfigView<'static>>>, ConnectError>
pub async fn get_task_push_notification_config_with_options( &self, request: GetTaskPushNotificationConfigRequest, options: CallOptions, ) -> Result<UnaryResponse<OwnedView<TaskPushNotificationConfigView<'static>>>, ConnectError>
Call the GetTaskPushNotificationConfig RPC with explicit per-call options. Options override ClientConfig defaults.
Sourcepub async fn list_task_push_notification_configs(
&self,
request: ListTaskPushNotificationConfigsRequest,
) -> Result<UnaryResponse<OwnedView<ListTaskPushNotificationConfigsResponseView<'static>>>, ConnectError>
pub async fn list_task_push_notification_configs( &self, request: ListTaskPushNotificationConfigsRequest, ) -> Result<UnaryResponse<OwnedView<ListTaskPushNotificationConfigsResponseView<'static>>>, ConnectError>
Call the ListTaskPushNotificationConfigs RPC. Sends a request to /lf.a2a.v1.A2AService/ListTaskPushNotificationConfigs.
Sourcepub async fn list_task_push_notification_configs_with_options(
&self,
request: ListTaskPushNotificationConfigsRequest,
options: CallOptions,
) -> Result<UnaryResponse<OwnedView<ListTaskPushNotificationConfigsResponseView<'static>>>, ConnectError>
pub async fn list_task_push_notification_configs_with_options( &self, request: ListTaskPushNotificationConfigsRequest, options: CallOptions, ) -> Result<UnaryResponse<OwnedView<ListTaskPushNotificationConfigsResponseView<'static>>>, ConnectError>
Call the ListTaskPushNotificationConfigs RPC with explicit per-call options. Options override ClientConfig defaults.
Sourcepub async fn get_extended_agent_card(
&self,
request: GetExtendedAgentCardRequest,
) -> Result<UnaryResponse<OwnedView<AgentCardView<'static>>>, ConnectError>
pub async fn get_extended_agent_card( &self, request: GetExtendedAgentCardRequest, ) -> Result<UnaryResponse<OwnedView<AgentCardView<'static>>>, ConnectError>
Call the GetExtendedAgentCard RPC. Sends a request to /lf.a2a.v1.A2AService/GetExtendedAgentCard.
Sourcepub async fn get_extended_agent_card_with_options(
&self,
request: GetExtendedAgentCardRequest,
options: CallOptions,
) -> Result<UnaryResponse<OwnedView<AgentCardView<'static>>>, ConnectError>
pub async fn get_extended_agent_card_with_options( &self, request: GetExtendedAgentCardRequest, options: CallOptions, ) -> Result<UnaryResponse<OwnedView<AgentCardView<'static>>>, ConnectError>
Call the GetExtendedAgentCard RPC with explicit per-call options. Options override ClientConfig defaults.
Sourcepub async fn delete_task_push_notification_config(
&self,
request: DeleteTaskPushNotificationConfigRequest,
) -> Result<UnaryResponse<OwnedView<EmptyView<'static>>>, ConnectError>
pub async fn delete_task_push_notification_config( &self, request: DeleteTaskPushNotificationConfigRequest, ) -> Result<UnaryResponse<OwnedView<EmptyView<'static>>>, ConnectError>
Call the DeleteTaskPushNotificationConfig RPC. Sends a request to /lf.a2a.v1.A2AService/DeleteTaskPushNotificationConfig.
Sourcepub async fn delete_task_push_notification_config_with_options(
&self,
request: DeleteTaskPushNotificationConfigRequest,
options: CallOptions,
) -> Result<UnaryResponse<OwnedView<EmptyView<'static>>>, ConnectError>
pub async fn delete_task_push_notification_config_with_options( &self, request: DeleteTaskPushNotificationConfigRequest, options: CallOptions, ) -> Result<UnaryResponse<OwnedView<EmptyView<'static>>>, ConnectError>
Call the DeleteTaskPushNotificationConfig RPC with explicit per-call options. Options override ClientConfig defaults.
Trait Implementations§
Source§impl<T: Clone> Clone for A2aServiceClient<T>
impl<T: Clone> Clone for A2aServiceClient<T>
Source§fn clone(&self) -> A2aServiceClient<T>
fn clone(&self) -> A2aServiceClient<T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<T> !Freeze for A2aServiceClient<T>
impl<T> !RefUnwindSafe for A2aServiceClient<T>
impl<T> !UnwindSafe for A2aServiceClient<T>
impl<T> Send for A2aServiceClient<T>where
T: Send,
impl<T> Sync for A2aServiceClient<T>where
T: Sync,
impl<T> Unpin for A2aServiceClient<T>where
T: Unpin,
impl<T> UnsafeUnpin for A2aServiceClient<T>where
T: UnsafeUnpin,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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