diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-03-04 11:20:05 -1000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-03-04 11:20:05 -1000 |
| commit | 2be0b6a90cd83c8052ee13a172217e4a355c7df7 (patch) | |
| tree | ab884de1991a926447adacad5e0e78b844bbd891 /internal/api | |
| parent | 0fd54eddc40f517cf491310d4f8a60b0d79dc937 (diff) | |
fix: migrate Todoist client from deprecated REST v2 to API v1
REST v2 (https://api.todoist.com/rest/v2) is being sunset — the /close
endpoint was returning HTTP 410 in production, breaking task completion.
Update base URL to https://api.todoist.com/api/v1; endpoint paths are
unchanged (/tasks/{id}/close, /tasks/{id}/reopen, etc.).
Test: TestTodoistClient_UsesAPIv1BaseURL asserts the correct base URL.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/api')
| -rw-r--r-- | internal/api/todoist.go | 2 | ||||
| -rw-r--r-- | internal/api/todoist_test.go | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/internal/api/todoist.go b/internal/api/todoist.go index 6068d2e..2745e3e 100644 --- a/internal/api/todoist.go +++ b/internal/api/todoist.go @@ -10,7 +10,7 @@ import ( ) const ( - todoistBaseURL = "https://api.todoist.com/rest/v2" + todoistBaseURL = "https://api.todoist.com/api/v1" todoistSyncBaseURL = "https://api.todoist.com/sync/v9" ) diff --git a/internal/api/todoist_test.go b/internal/api/todoist_test.go index f7ca719..159be61 100644 --- a/internal/api/todoist_test.go +++ b/internal/api/todoist_test.go @@ -143,6 +143,14 @@ func TestTodoistClient_CreateTask_WithDueDate(t *testing.T) { } } +func TestTodoistClient_UsesAPIv1BaseURL(t *testing.T) { + client := NewTodoistClient("test-key") + const want = "https://api.todoist.com/api/v1" + if client.BaseURL != want { + t.Errorf("expected base URL %q, got %q — Todoist REST v2 is deprecated (HTTP 410)", want, client.BaseURL) + } +} + func TestTodoistClient_CompleteTask(t *testing.T) { // Mock server server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
