0

我目前以这种方式在我的 Android 应用程序中使用 Tasks API Java 客户端:

List<Task> tasks = client.tasks()
    .list("@default")
    .setFields("items(title,notes,status,due)")
    .execute()
    .getItems();

但这只会返回“默认”任务列表中的任务。有没有办法从所有任务列表中获取任务,而不必从中获取列表client.tasklists()并遍历它们?

4

1 回答 1

1

Short answer: No.

As the documentation specifies, the list action "Returns all tasks in the specified task list".

The "restful" style is that all resources belong to a collection. As such, using list for Tasks requires acting it on a TaskList. As you noted, it's very simple to list all TaskLists, then list all Tasks from each TaskList and collect them in a list. Note that one might even argue that in many circumstances, a Task is meaningless when separated from the context of the list it was created in.

You can see the full Api Reference for Tasks API here.

于 2013-10-23T19:02:47.340 回答