Implement TaskParams builder (Options Pattern)

- TaskParams struct with fluent setter methods
- NewTask(title) constructor
- Setters: WithDescription, InColumn, WithCategory, WithOwner, WithCreator,
  WithColor, WithPriority, WithScore, WithDueDate, WithStartDate,
  InSwimlane, WithReference, WithTags
- toCreateTaskRequest for conversion to CreateTaskRequest
- BoardScope.CreateTaskFromParams for fluent task creation
- Comprehensive test coverage for all setters and chaining
This commit is contained in:
Oliver Jakoubek 2026-01-15 18:31:13 +01:00
commit 28e517289a
4 changed files with 409 additions and 1 deletions

View file

@ -42,3 +42,10 @@ func (b *BoardScope) CreateTask(ctx context.Context, req CreateTaskRequest) (*Ta
req.ProjectID = b.projectID
return b.client.CreateTask(ctx, req)
}
// CreateTaskFromParams creates a new task in the project using TaskParams.
// This provides a fluent interface for task creation.
func (b *BoardScope) CreateTaskFromParams(ctx context.Context, params *TaskParams) (*Task, error) {
req := params.toCreateTaskRequest(b.projectID)
return b.client.CreateTask(ctx, req)
}