pub struct TaskManager { /* private fields */ }Expand description
A2A Task Manager - handles task creation, updates, and queries
Implementations§
Source§impl TaskManager
impl TaskManager
Sourcepub fn with_capacity(max_tasks: usize) -> Self
pub fn with_capacity(max_tasks: usize) -> Self
Create a new task manager with custom capacity
Sourcepub async fn create_task(&self, context_id: Option<String>) -> Task
pub async fn create_task(&self, context_id: Option<String>) -> Task
Create a new task
Sourcepub async fn get_task_or_error(&self, task_id: &str) -> A2aResult<Task>
pub async fn get_task_or_error(&self, task_id: &str) -> A2aResult<Task>
Get a task by ID, returning an error if not found
Sourcepub async fn update_status(
&self,
task_id: &str,
state: TaskState,
message: Option<Message>,
) -> A2aResult<Task>
pub async fn update_status( &self, task_id: &str, state: TaskState, message: Option<Message>, ) -> A2aResult<Task>
Update task status
Sourcepub async fn add_artifact(
&self,
task_id: &str,
artifact: Artifact,
) -> A2aResult<Task>
pub async fn add_artifact( &self, task_id: &str, artifact: Artifact, ) -> A2aResult<Task>
Add an artifact to a task
Sourcepub async fn add_message(
&self,
task_id: &str,
message: Message,
) -> A2aResult<Task>
pub async fn add_message( &self, task_id: &str, message: Message, ) -> A2aResult<Task>
Add a message to task history
Sourcepub async fn cancel_task(&self, task_id: &str) -> A2aResult<Task>
pub async fn cancel_task(&self, task_id: &str) -> A2aResult<Task>
Cancel a task
Sourcepub async fn list_tasks(&self, params: ListTasksParams) -> ListTasksResult
pub async fn list_tasks(&self, params: ListTasksParams) -> ListTasksResult
List tasks with optional filtering
Sourcepub async fn get_tasks_by_context(&self, context_id: &str) -> Vec<Task>
pub async fn get_tasks_by_context(&self, context_id: &str) -> Vec<Task>
Get tasks by context ID
Sourcepub async fn task_count(&self) -> usize
pub async fn task_count(&self) -> usize
Get the number of tasks
Sourcepub async fn set_webhook_config(
&self,
config: TaskPushNotificationConfig,
) -> A2aResult<()>
pub async fn set_webhook_config( &self, config: TaskPushNotificationConfig, ) -> A2aResult<()>
Set webhook configuration for a task
Sourcepub async fn get_webhook_config(
&self,
task_id: &str,
) -> Option<TaskPushNotificationConfig>
pub async fn get_webhook_config( &self, task_id: &str, ) -> Option<TaskPushNotificationConfig>
Get webhook configuration for a task
Sourcepub async fn remove_webhook_config(&self, task_id: &str)
pub async fn remove_webhook_config(&self, task_id: &str)
Remove webhook configuration for a task
Trait Implementations§
Source§impl Clone for TaskManager
impl Clone for TaskManager
Source§fn clone(&self) -> TaskManager
fn clone(&self) -> TaskManager
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TaskManager
impl Debug for TaskManager
Auto Trait Implementations§
impl !RefUnwindSafe for TaskManager
impl !UnwindSafe for TaskManager
impl Freeze for TaskManager
impl Send for TaskManager
impl Sync for TaskManager
impl Unpin for TaskManager
impl UnsafeUnpin for TaskManager
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
Mutably borrows from an owned value. Read more