Documentation
¶
Overview ¶
Package client provides the public API for TaskKit.
Index ¶
- Variables
- type Client
- func (c *Client) Add(ctx context.Context, task *taskkit.Task) (*taskkit.Task, error)
- func (c *Client) AddBlockedBy(ctx context.Context, taskID, dependsOnID string) error
- func (c *Client) Close() error
- func (c *Client) Complete(ctx context.Context, id string) error
- func (c *Client) Delete(ctx context.Context, id string) error
- func (c *Client) Get(ctx context.Context, filters ...filter.Filter) ([]*taskkit.Task, error)
- func (c *Client) GetHistory(ctx context.Context, taskID string) ([]taskkit.HistoryEntry, error)
- func (c *Client) Import(ctx context.Context, tasks []*taskkit.Task) error
- func (c *Client) Modify(ctx context.Context, id string, mods ...Modification) error
- func (c *Client) Projects(ctx context.Context) ([]*taskkit.ProjectSummary, error)
- func (c *Client) RemoveBlockedBy(ctx context.Context, taskID, dependsOnID string) error
- func (c *Client) Undo(ctx context.Context) error
- func (c *Client) UrgencyBreakdown(task *taskkit.Task) []taskkit.UrgencyComponent
- type Modification
- func AddBlockedBy(dependsOnID string) Modification
- func AddTag(tag string) Modification
- func RemoveBlockedBy(dependsOnID string) Modification
- func RemoveTag(tag string) Modification
- func SetDeadline(t *time.Time) Modification
- func SetDescription(s string) Modification
- func SetProject(project string) Modification
- func SetScheduled(t *time.Time) Modification
- func SetStatus(s taskkit.Status) Modification
- func SetWait(t *time.Time) Modification
Constants ¶
This section is empty.
Variables ¶
var ErrCyclicDependency = engine.ErrCyclicDependency
ErrCyclicDependency is returned when adding a dependency would create a cycle.
var ErrNotFound = errors.New("task not found")
ErrNotFound is returned when a requested task does not exist.
var ErrNothingToUndo = engine.ErrNothingToUndo
ErrNothingToUndo is returned when there is no operation to undo.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the public API for TaskKit.
func NewClient ¶
NewClient initialises a Client using the provided configuration. Use config.Load or config.LoadFrom to obtain a Config.
func (*Client) AddBlockedBy ¶
AddBlockedBy records that taskID is blocked by dependsOnID. Returns ErrCyclicDependency if this would create a cycle, ErrNotFound if taskID does not exist.
func (*Client) Get ¶
Get returns tasks matching all provided filters. With no filters, all tasks are returned.
func (*Client) GetHistory ¶
GetHistory returns the full audit history for the task with the given ULID, grouped by operation and ordered oldest-first.
func (*Client) Import ¶
Import restores tasks from a previous export, preserving all IDs and status. Validation is skipped since the data is assumed to be from a prior valid state. Each task is imported atomically; if one fails the others are unaffected.
func (*Client) Projects ¶
Projects returns a summary of all projects that have at least one task, sorted by project name.
func (*Client) RemoveBlockedBy ¶
RemoveBlockedBy removes the dependency where taskID is blocked by dependsOnID. Returns ErrNotFound if the task does not exist.
func (*Client) UrgencyBreakdown ¶
func (c *Client) UrgencyBreakdown(task *taskkit.Task) []taskkit.UrgencyComponent
UrgencyBreakdown returns the per-component urgency breakdown for a task.
type Modification ¶
Modification is a function that, given the current task state, updates it in place and returns the engine mutations to apply. Multiple modifications can be passed to Modify and are applied atomically in a single transaction.
func AddBlockedBy ¶
func AddBlockedBy(dependsOnID string) Modification
AddBlockedBy records that the task is blocked by dependsOnID. Returns ErrCyclicDependency if the dependency would create a cycle.
func RemoveBlockedBy ¶
func RemoveBlockedBy(dependsOnID string) Modification
RemoveBlockedBy removes the dependency where the task is blocked by dependsOnID.
func SetDeadline ¶
func SetDeadline(t *time.Time) Modification
SetDeadline changes the task deadline. Pass nil to clear it.
func SetDescription ¶
func SetDescription(s string) Modification
SetDescription changes the task description.
func SetScheduled ¶
func SetScheduled(t *time.Time) Modification
SetScheduled changes the task scheduled date. Pass nil to clear it.
func SetStatus ¶
func SetStatus(s taskkit.Status) Modification
SetStatus changes the task status. If the new status closes the task (completed or removed), the display ID is also freed.
func SetWait ¶
func SetWait(t *time.Time) Modification
SetWait changes the task wait date. Pass nil to clear it.