summaryrefslogtreecommitdiff
path: root/internal/models/widget.go
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-06-29 00:35:17 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-06-29 00:35:17 +0000
commit6c2df12903bb9e4688866e30a446c69e91283c84 (patch)
tree031732aa231c459b3240ae0b06a66d5c90488f73 /internal/models/widget.go
parent9e1b838a67c868cba3b1e148bf4211c23b3dbc00 (diff)
feat: add WidgetToken config + WidgetItem model for Android widget API
- Add WidgetToken field to Config struct to store bearer token for /api/widget endpoint - Load WidgetToken from WIDGET_TOKEN environment variable (optional) - Create WidgetItem and WidgetResponse models for widget API responses - Widget token authentication is optional; endpoint won't authenticate if token is empty Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/models/widget.go')
-rw-r--r--internal/models/widget.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/internal/models/widget.go b/internal/models/widget.go
new file mode 100644
index 0000000..94deec7
--- /dev/null
+++ b/internal/models/widget.go
@@ -0,0 +1,24 @@
+package models
+
+import "time"
+
+// WidgetItem is a single item in the widget API response.
+// Source values: "todoist", "trello", "plantoeat", "calendar", "gtasks"
+// Type values: "task", "event"
+type WidgetItem struct {
+ ID string `json:"id"`
+ Title string `json:"title"`
+ Source string `json:"source"`
+ Type string `json:"type"`
+ Start *time.Time `json:"start,omitempty"` // nil = no specific time (floating task)
+ End *time.Time `json:"end,omitempty"`
+ IsAllDay bool `json:"is_all_day"`
+ URL string `json:"url,omitempty"`
+ Completable bool `json:"completable"` // true = todoist task (checkbox shown)
+}
+
+// WidgetResponse is the full /api/widget response body.
+type WidgetResponse struct {
+ Now time.Time `json:"now"`
+ Items []WidgetItem `json:"items"`
+}