pub struct TaskService<'a> { /* private fields */ }Expand description
Service for managing development tasks.
TaskService provides operations for creating, retrieving, updating, and archiving tasks. It handles task lifecycle management, ticket linking, and task switching.
Implementations§
Source§impl<'a> TaskService<'a>
impl<'a> TaskService<'a>
Sourcepub fn create_task(
&self,
name: &str,
description: Option<&str>,
ticket_id: Option<&str>,
ticket_url: Option<&str>,
) -> Result<Task>
pub fn create_task( &self, name: &str, description: Option<&str>, ticket_id: Option<&str>, ticket_url: Option<&str>, ) -> Result<Task>
Creates a new task and sets it as the current task.
§Arguments
name- Name of the task (cannot be empty)description- Optional task descriptionticket_id- Optional ticket ID (e.g., “PROJ-123” or “owner/repo/456”)ticket_url- Optional URL to the ticket
§Errors
Returns an error if:
- The task name is empty
- The ticket ID format is invalid
- A task with the same ticket ID already exists
Sourcepub fn switch_task(&self, task_id: i64) -> Result<Task>
pub fn switch_task(&self, task_id: i64) -> Result<Task>
Sourcepub fn archive_task(&self, task_id: i64) -> Result<()>
pub fn archive_task(&self, task_id: i64) -> Result<()>
Archives a task, marking it as completed or abandoned.
If the archived task is the current task, the current task is cleared.
§Arguments
task_id- The ID of the task to archive
Sourcepub fn resolve_task_id(&self, reference: &str) -> Result<i64>
pub fn resolve_task_id(&self, reference: &str) -> Result<i64>
Resolves a task reference to a task ID.
Accepts a numeric task ID, a ticket reference prefixed with “t:”, or an alias.
§Arguments
reference- Either a task ID (e.g., “1”), ticket reference (e.g., “t:PROJ-123”), or alias (e.g., “daily-work”)
§Returns
The resolved task ID.
§Errors
Returns an error if the reference is invalid or no matching task is found.
Sourcepub fn set_alias(&self, task_id: i64, alias: &str, force: bool) -> Result<()>
pub fn set_alias(&self, task_id: i64, alias: &str, force: bool) -> Result<()>
Sets an alias for a task.
§Arguments
task_id- The ID of the task to set the alias foralias- The alias to set (must be unique and valid)force- If true, removes the alias from any existing task before setting it
§Errors
Returns an error if:
- The alias format is invalid
- The alias is already in use by another task (when force is false)
- The task does not exist
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for TaskService<'a>
impl<'a> !Send for TaskService<'a>
impl<'a> !Sync for TaskService<'a>
impl<'a> !UnwindSafe for TaskService<'a>
impl<'a> Freeze for TaskService<'a>
impl<'a> Unpin for TaskService<'a>
impl<'a> UnsafeUnpin for TaskService<'a>
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