// ListTasks returns list of tasks, as tasks endpoint `/tasks` does not have
// enough information, we collects task list from state endpoint.
ListTasks returns list of tasks, as tasks endpoint `/tasks` does not have
enough information, we collects task list from state endpoint.
// ListTasks returns list of tasks as tasks endpoint ` / tasks ` does not have // enough information we collects task list from state endpoint .
func (c *Client) ListTasks() ([]Task, error) {
	body, err := c.doRequest(c.masterStateEndpoint())
	if err != nil {
		return []Task{}, err
	}
	var state State
	err = json.Unmarshal(body, &state)
	if err != nil {
		return []Task{}, err
	}
	var tasks []Task
	for _, framework := range state.Frameworks {
		for _, task := range framework.Tasks {
			tasks = append(tasks, task)
		}
	}
	return tasks, nil
}
func ( c * Client ) ListTasks ( ) ( [ ] Task , error ) { body , err := c . doRequest ( c . masterStateEndpoint ( ) ) if err != nil { return [ ] Task { } , err } var state State err = json . Unmarshal ( body , & state ) if err != nil { return [ ] Task { } , err } var tasks [ ] Task for _ , framework := range state . Frameworks { for _ , task := range framework . Tasks { tasks = append ( tasks , task ) } } return tasks , nil }
ListTasks returns list of tasks, as tasks endpoint `/tasks` does not have
enough information, we collects task list from state endpoint.
ListTasks returns list of tasks as tasks endpoint ` / tasks ` does not have enough information we collects task list from state endpoint .