diff options
Diffstat (limited to 'internal/api/plantoeat.go')
| -rw-r--r-- | internal/api/plantoeat.go | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/internal/api/plantoeat.go b/internal/api/plantoeat.go index a7fdf58..5c24cc1 100644 --- a/internal/api/plantoeat.go +++ b/internal/api/plantoeat.go @@ -39,27 +39,6 @@ func (c *PlanToEatClient) SetSessionCookie(cookie string) { c.sessionCookie = cookie } -func (c *PlanToEatClient) authHeaders() map[string]string { - return map[string]string{"Authorization": "Bearer " + c.apiKey} -} - -// planToEatPlannerItem represents a planner item from the API -type planToEatPlannerItem struct { - ID int `json:"id"` - Date string `json:"date"` - MealType string `json:"meal_type"` - Recipe struct { - ID int `json:"id"` - Title string `json:"title"` - URL string `json:"url"` - } `json:"recipe"` -} - -// planToEatResponse wraps the API response -type planToEatResponse struct { - Items []planToEatPlannerItem `json:"items"` -} - // GetUpcomingMeals fetches meals by scraping the planner web interface // Requires a valid session cookie set via SetSessionCookie func (c *PlanToEatClient) GetUpcomingMeals(ctx context.Context, days int) ([]models.Meal, error) { @@ -84,7 +63,7 @@ func (c *PlanToEatClient) GetUpcomingMeals(ctx context.Context, days int) ([]mod if err != nil { return nil, fmt.Errorf("request failed: %w", err) } - defer resp.Body.Close() + defer func() { _ = resp.Body.Close() }() log.Printf("DEBUG [PlanToEat/Meals]: Response status %d", resp.StatusCode) @@ -238,7 +217,7 @@ func (c *PlanToEatClient) GetShoppingList(ctx context.Context) ([]models.Shoppin if err != nil { return nil, fmt.Errorf("request failed: %w", err) } - defer resp.Body.Close() + defer func() { _ = resp.Body.Close() }() log.Printf("DEBUG [PlanToEat/Shopping]: Response status %d", resp.StatusCode) |
