diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-01-13 14:18:24 -1000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-01-13 14:18:24 -1000 |
| commit | e107192be5efb65807c7da3b6aa99ce3555944d0 (patch) | |
| tree | 12f9a03a0586ec79c13b3461d960ccb27d0ae117 /internal/api/interfaces.go | |
| parent | 2fee76ea41f37e3a068273c05a98b892ab29228c (diff) | |
Implement Todoist write operations - API layer (Part 1)
Add CreateTask and CompleteTask methods to Todoist API client:
Models:
- Add Project struct (ID, Name) to types.go
- Add Projects []Project field to DashboardData
API Interface:
- Change GetProjects signature to return []models.Project
- Ensure CreateTask and CompleteTask are defined
Todoist Client:
- Add baseURL field for testability
- Refactor GetProjects to return []models.Project
- Update GetTasks to build project map from new GetProjects
- Implement CreateTask with JSON payload support
- Implement CompleteTask using POST to /tasks/{id}/close
Tests:
- Create comprehensive todoist_test.go
- Test CreateTask, CreateTask with due date, CompleteTask
- Test error handling and GetProjects
- Update mock client in handlers tests
All tests pass. Ready for handlers and UI integration.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'internal/api/interfaces.go')
| -rw-r--r-- | internal/api/interfaces.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/api/interfaces.go b/internal/api/interfaces.go index 31da0a8..db7e6c0 100644 --- a/internal/api/interfaces.go +++ b/internal/api/interfaces.go @@ -10,7 +10,7 @@ import ( // TodoistAPI defines the interface for Todoist operations type TodoistAPI interface { GetTasks(ctx context.Context) ([]models.Task, error) - GetProjects(ctx context.Context) (map[string]string, error) + GetProjects(ctx context.Context) ([]models.Project, error) CreateTask(ctx context.Context, content, projectID string, dueDate *time.Time, priority int) (*models.Task, error) CompleteTask(ctx context.Context, taskID string) error } |
