diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-01-23 16:10:52 -1000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-01-23 16:10:52 -1000 |
| commit | 7828e19501b3ca8b2e86ca7297f580c659e5c9b8 (patch) | |
| tree | e3113af67fcecc459d81b213d7f043630dccae98 /internal/api/todoist.go | |
| parent | d11334c0999efb670a8eab93527a50f644fdfceb (diff) | |
Fix bugs #24-27: calendar dedup, uncomplete tasks, planning view
Bug fixes:
- #24: Deduplicate calendar events across multiple calendars using
summary + start time as key
- #25: Change event icon from calendar to clock to avoid confusion
with date display
- #26: Add task uncomplete functionality via ReopenTask API for
Todoist and closed=false for Trello
- #27: Restructure planning view with sections for Scheduled (timed
events/tasks), Today (unscheduled), Quick Add, and Upcoming (3 days)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'internal/api/todoist.go')
| -rw-r--r-- | internal/api/todoist.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/internal/api/todoist.go b/internal/api/todoist.go index 689bf10..b3d4579 100644 --- a/internal/api/todoist.go +++ b/internal/api/todoist.go @@ -442,3 +442,26 @@ func (c *TodoistClient) CompleteTask(ctx context.Context, taskID string) error { return nil } + +// ReopenTask marks a completed task as active in Todoist +func (c *TodoistClient) ReopenTask(ctx context.Context, taskID string) error { + url := fmt.Sprintf("%s/tasks/%s/reopen", c.baseURL, taskID) + req, err := http.NewRequestWithContext(ctx, "POST", url, nil) + if err != nil { + return fmt.Errorf("failed to create request: %w", err) + } + req.Header.Set("Authorization", "Bearer "+c.apiKey) + + resp, err := c.httpClient.Do(req) + if err != nil { + return fmt.Errorf("failed to reopen task: %w", err) + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusNoContent && resp.StatusCode != http.StatusOK { + body, _ := io.ReadAll(resp.Body) + return fmt.Errorf("todoist API error (status %d): %s", resp.StatusCode, string(body)) + } + + return nil +} |
