pub struct A2aMockBuilder { /* private fields */ }Expand description
Fluent builder producing the expectations for a mocked A2A agent.
Implementations§
Source§impl A2aMockBuilder
impl A2aMockBuilder
Sourcepub fn with_agent_name(self, name: impl Into<String>) -> Self
pub fn with_agent_name(self, name: impl Into<String>) -> Self
Set the advertised agent name (default "MockAgent").
Sourcepub fn with_agent_description(self, description: impl Into<String>) -> Self
pub fn with_agent_description(self, description: impl Into<String>) -> Self
Set the advertised agent description (default "A mock A2A agent").
Sourcepub fn with_agent_version(self, version: impl Into<String>) -> Self
pub fn with_agent_version(self, version: impl Into<String>) -> Self
Set the advertised agent version (default "1.0.0").
Sourcepub fn with_agent_url(self, url: impl Into<String>) -> Self
pub fn with_agent_url(self, url: impl Into<String>) -> Self
Set the advertised agent URL. Defaults to http://localhost<path>.
Sourcepub fn with_agent_card_path(self, path: impl Into<String>) -> Self
pub fn with_agent_card_path(self, path: impl Into<String>) -> Self
Set the agent-card discovery path (default /.well-known/agent.json).
Sourcepub fn with_default_task_response(self, response: impl Into<String>) -> Self
pub fn with_default_task_response(self, response: impl Into<String>) -> Self
Set the default task response text used by tasks/send / tasks/get.
Sourcepub fn with_streaming(self) -> Self
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.
Sourcepub fn with_streaming_method(self, method: impl Into<String>) -> Self
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.
Sourcepub fn with_push_notifications(self, webhook_url: impl Into<String>) -> Self
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.
Sourcepub fn with_skill(self, id: impl Into<String>) -> A2aSkillBuilder
pub fn with_skill(self, id: impl Into<String>) -> A2aSkillBuilder
Start defining a skill. Finish with A2aSkillBuilder::and.
Sourcepub fn on_task_send(self) -> A2aTaskHandlerBuilder
pub fn on_task_send(self) -> A2aTaskHandlerBuilder
Start defining a custom tasks/send handler. Finish with
A2aTaskHandlerBuilder::and.
Sourcepub fn build(&self) -> Vec<Value>
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.
Sourcepub fn try_build(&self) -> Result<Vec<Value>>
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.
Sourcepub fn apply_to(&self, client: &MockServerClient) -> Result<Value>
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
impl Clone for A2aMockBuilder
Source§fn clone(&self) -> A2aMockBuilder
fn clone(&self) -> A2aMockBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more