1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
package api
import (
"context"
"time"
"task-dashboard/internal/models"
)
// TodoistAPI defines the interface for Todoist operations
type TodoistAPI interface {
GetTasks(ctx context.Context) ([]models.Task, error)
GetProjects(ctx context.Context) ([]models.Project, error)
CreateTask(ctx context.Context, content, projectID string, dueDate *time.Time, priority int) (*models.Task, error)
UpdateTask(ctx context.Context, taskID string, updates map[string]interface{}) error
CompleteTask(ctx context.Context, taskID string) error
ReopenTask(ctx context.Context, taskID string) error
Sync(ctx context.Context, syncToken string) (*TodoistSyncResponse, error)
}
// TrelloAPI defines the interface for Trello operations
type TrelloAPI interface {
GetBoards(ctx context.Context) ([]models.Board, error)
GetCards(ctx context.Context, boardID string) ([]models.Card, error)
GetLists(ctx context.Context, boardID string) ([]models.List, error)
GetBoardsWithCards(ctx context.Context) ([]models.Board, error)
CreateCard(ctx context.Context, listID, name, description string, dueDate *time.Time) (*models.Card, error)
UpdateCard(ctx context.Context, cardID string, updates map[string]interface{}) error
}
// PlanToEatAPI defines the interface for PlanToEat operations
type PlanToEatAPI interface {
GetUpcomingMeals(ctx context.Context, days int) ([]models.Meal, error)
GetShoppingList(ctx context.Context) ([]models.ShoppingItem, error)
GetRecipes(ctx context.Context) error
AddMealToPlanner(ctx context.Context, recipeID string, date time.Time, mealType string) error
}
// GoogleCalendarAPI defines the interface for Google Calendar operations
type GoogleCalendarAPI interface {
GetUpcomingEvents(ctx context.Context, maxResults int) ([]models.CalendarEvent, error)
GetEventsByDateRange(ctx context.Context, start, end time.Time) ([]models.CalendarEvent, error)
}
// GoogleTasksAPI defines the interface for Google Tasks operations
type GoogleTasksAPI interface {
GetTasks(ctx context.Context) ([]models.GoogleTask, error)
GetTasksByDateRange(ctx context.Context, start, end time.Time) ([]models.GoogleTask, error)
CompleteTask(ctx context.Context, listID, taskID string) error
UncompleteTask(ctx context.Context, listID, taskID string) error
}
// Ensure concrete types implement interfaces
var (
_ TodoistAPI = (*TodoistClient)(nil)
_ TrelloAPI = (*TrelloClient)(nil)
_ PlanToEatAPI = (*PlanToEatClient)(nil)
_ GoogleCalendarAPI = (*GoogleCalendarClient)(nil)
_ GoogleTasksAPI = (*GoogleTasksClient)(nil)
)
|