Implement Link API methods

- GetAllTaskLinks: retrieve all links for a task
- CreateTaskLink: create link between two tasks
- RemoveTaskLink: delete a task link
- TaskScope.GetLinks and LinkTo for fluent API
- Link types include "blocks", "is blocked by", etc.
- Comprehensive test coverage
This commit is contained in:
Oliver Jakoubek 2026-01-15 18:43:35 +01:00
commit 39ff0a90c8
4 changed files with 336 additions and 1 deletions

View file

@ -254,3 +254,15 @@ func (t *TaskScope) GetComments(ctx context.Context) ([]Comment, error) {
func (t *TaskScope) AddComment(ctx context.Context, userID int, content string) (*Comment, error) {
return t.client.CreateComment(ctx, t.taskID, userID, content)
}
// GetLinks returns all links for this task.
func (t *TaskScope) GetLinks(ctx context.Context) ([]TaskLink, error) {
return t.client.GetAllTaskLinks(ctx, t.taskID)
}
// LinkTo creates a link from this task to another task.
// The linkID specifies the type of relationship (e.g., "blocks", "is blocked by").
func (t *TaskScope) LinkTo(ctx context.Context, oppositeTaskID, linkID int) error {
_, err := t.client.CreateTaskLink(ctx, t.taskID, oppositeTaskID, linkID)
return err
}