package grocy import ( "context" "fmt" "net/http" ) type Chore struct { ID int `json:"id"` ChoreID int `json:"chore_id"` ChoreName string `json:"chore_name"` LastTrackedTime string `json:"last_tracked_time"` NextEstimatedExecutionTime string `json:"next_estimated_execution_time"` TrackDateOnly int `json:"track_date_only"` NextExecutionAssignedToUserID int `json:"next_execution_assigned_to_user_id"` IsRescheduled int `json:"is_rescheduled"` IsReassigned int `json:"is_reassigned"` NextExecutionAssignedUser User `json:"next_execution_assigned_user"` } type ChoreList []Chore func (c *Client) GetChores(ctx context.Context) (ChoreList, error) { req, err := http.NewRequest("GET", fmt.Sprintf("%s/chores", c.BaseUrl), nil) if err != nil { return nil, err } req.WithContext(ctx) var res ChoreList if err := c.sendRequest(req, &res); err != nil { return nil, err } return res, nil } func (c *Client) GetChore(ctx context.Context, choreId int) (Chore, error) { req, err := http.NewRequest("GET", fmt.Sprintf("%s/chores/%d", c.BaseUrl, choreId), nil) if err != nil { return *new(Chore), err } req.WithContext(ctx) var res Chore if err := c.sendRequest(req, &res); err != nil { return *new(Chore), err } return res, nil }