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:
parent
f04ea8866f
commit
28e517289a
4 changed files with 409 additions and 1 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue