Skip to main content

A2aMockBuilder

Struct A2aMockBuilder 

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

Fluent builder producing the expectations for a mocked A2A agent.

Implementations§

Source§

impl A2aMockBuilder

Source

pub fn with_agent_name(self, name: impl Into<String>) -> Self

Set the advertised agent name (default "MockAgent").

Source

pub fn with_agent_description(self, description: impl Into<String>) -> Self

Set the advertised agent description (default "A mock A2A agent").

Source

pub fn with_agent_version(self, version: impl Into<String>) -> Self

Set the advertised agent version (default "1.0.0").

Source

pub fn with_agent_url(self, url: impl Into<String>) -> Self

Set the advertised agent URL. Defaults to http://localhost<path>.

Source

pub fn with_agent_card_path(self, path: impl Into<String>) -> Self

Set the agent-card discovery path (default /.well-known/agent.json).

Source

pub fn with_default_task_response(self, response: impl Into<String>) -> Self

Set the default task response text used by tasks/send / tasks/get.

Source

pub fn with_streaming(self) -> Self

Advertise and mock the A2A streaming capability. The agent card reports capabilities.streaming: true and the streaming method (default message/stream) returns an SSE stream of status/artifact update events.

Source

pub fn with_streaming_method(self, method: impl Into<String>) -> Self

Override the JSON-RPC method that triggers the streaming response (the A2A spec uses message/stream; the legacy name is tasks/sendSubscribe). Implies with_streaming.

Source

pub fn with_push_notifications(self, webhook_url: impl Into<String>) -> Self

Advertise and mock A2A push notifications. The agent card reports capabilities.pushNotifications: true, tasks/pushNotificationConfig/set echoes the registered config, and each tasks/send additionally POSTs the completed task to the supplied webhook URL while still returning the JSON-RPC task response to the caller.

Source

pub fn with_skill(self, id: impl Into<String>) -> A2aSkillBuilder

Start defining a skill. Finish with A2aSkillBuilder::and.

Source

pub fn on_task_send(self) -> A2aTaskHandlerBuilder

Start defining a custom tasks/send handler. Finish with A2aTaskHandlerBuilder::and.

Source

pub fn build(&self) -> Vec<Value>

Build the full ordered list of A2A expectations.

§Panics

Panics if with_push_notifications was given a webhook URL that cannot be parsed. Use try_build for a fallible variant.

Source

pub fn try_build(&self) -> Result<Vec<Value>>

Fallible variant of build. Returns an error only when a configured push-notification webhook URL cannot be parsed.

Source

pub fn apply_to(&self, client: &MockServerClient) -> Result<Value>

Build and register the expectations on the given client.

Trait Implementations§

Source§

impl Clone for A2aMockBuilder

Source§

fn clone(&self) -> A2aMockBuilder

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for A2aMockBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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: Sized + 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: Sized + 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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