Implement Comment API methods
- GetAllComments: retrieve all comments for a task - GetComment: retrieve single comment by ID - CreateComment: create comment and return the created comment - UpdateComment: update comment content - RemoveComment: delete a comment - TaskScope.GetComments and AddComment for fluent API - Returns ErrCommentNotFound when appropriate - Comprehensive test coverage
This commit is contained in:
parent
c8eea853e5
commit
87adebd798
4 changed files with 518 additions and 1 deletions
|
|
@ -163,3 +163,14 @@ func (t *TaskScope) HasTag(ctx context.Context, tag string) (bool, error) {
|
|||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// GetComments returns all comments for this task.
|
||||
func (t *TaskScope) GetComments(ctx context.Context) ([]Comment, error) {
|
||||
return t.client.GetAllComments(ctx, t.taskID)
|
||||
}
|
||||
|
||||
// AddComment adds a comment to this task and returns the created comment.
|
||||
// The userID is the ID of the user creating the comment.
|
||||
func (t *TaskScope) AddComment(ctx context.Context, userID int, content string) (*Comment, error) {
|
||||
return t.client.CreateComment(ctx, t.taskID, userID, content)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue