summaryrefslogtreecommitdiff
path: root/internal/handlers/handlers.go
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-01-26 20:55:50 -1000
committerPeter Stone <thepeterstone@gmail.com>2026-01-26 20:55:50 -1000
commita3156a2f399ea03c645ee23b0099d9d722ce7e1e (patch)
tree03c813717e77ae27d8aee9e676f1b75a6a01648c /internal/handlers/handlers.go
parent70e6e51b6781a3986c51e3496b81c88665286872 (diff)
Add Google Tasks integration (#43)
- New GoogleTasksClient for fetching and managing Google Tasks - Tasks appear in Timeline view with yellow indicator dot - Tap checkbox to complete/uncomplete tasks via Google API - Shares credentials file with Google Calendar (GOOGLE_CREDENTIALS_FILE) - Configure task list via GOOGLE_TASKS_LIST_ID env var (default: @default) - Supports comma-separated list IDs for multiple lists New files: - internal/api/google_tasks.go - Google Tasks API client Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'internal/handlers/handlers.go')
-rw-r--r--internal/handlers/handlers.go20
1 files changed, 19 insertions, 1 deletions
diff --git a/internal/handlers/handlers.go b/internal/handlers/handlers.go
index 115d903..0424e40 100644
--- a/internal/handlers/handlers.go
+++ b/internal/handlers/handlers.go
@@ -29,12 +29,13 @@ type Handler struct {
trelloClient api.TrelloAPI
planToEatClient api.PlanToEatAPI
googleCalendarClient api.GoogleCalendarAPI
+ googleTasksClient api.GoogleTasksAPI
config *config.Config
templates *template.Template
}
// New creates a new Handler instance
-func New(s *store.Store, todoist api.TodoistAPI, trello api.TrelloAPI, planToEat api.PlanToEatAPI, googleCalendar api.GoogleCalendarAPI, cfg *config.Config) *Handler {
+func New(s *store.Store, todoist api.TodoistAPI, trello api.TrelloAPI, planToEat api.PlanToEatAPI, googleCalendar api.GoogleCalendarAPI, googleTasks api.GoogleTasksAPI, cfg *config.Config) *Handler {
// Parse templates including partials
tmpl, err := template.ParseGlob(filepath.Join(cfg.TemplateDir, "*.html"))
if err != nil {
@@ -53,6 +54,7 @@ func New(s *store.Store, todoist api.TodoistAPI, trello api.TrelloAPI, planToEat
trelloClient: trello,
planToEatClient: planToEat,
googleCalendarClient: googleCalendar,
+ googleTasksClient: googleTasks,
config: cfg,
templates: tmpl,
}
@@ -640,6 +642,22 @@ func (h *Handler) handleAtomToggle(w http.ResponseWriter, r *http.Request, compl
} else {
err = h.store.UnresolveBug(bugID)
}
+ case "gtasks":
+ // Google Tasks - need list ID from form or use default
+ listID := r.FormValue("listId")
+ if listID == "" {
+ listID = "@default"
+ }
+ if h.googleTasksClient != nil {
+ if complete {
+ err = h.googleTasksClient.CompleteTask(ctx, listID, id)
+ } else {
+ err = h.googleTasksClient.UncompleteTask(ctx, listID, id)
+ }
+ } else {
+ JSONError(w, http.StatusServiceUnavailable, "Google Tasks not configured", nil)
+ return
+ }
default:
JSONError(w, http.StatusBadRequest, "Unknown source: "+source, nil)
return