Interface TaskOperations

  • All Known Implementing Classes:
    TaskTemplate

    public interface TaskOperations
    Defines operations for working with tasks and task lists of the authenticated user. Requires OAuth2 authentication with either "https://www.googleapis.com/auth/tasks" for read and write operations or "https://www.googleapis.com/auth/tasks.readonly" for read-only operations.
    Author:
    Gabriel Axel
    • Method Detail

      • getTaskLists

        TaskListsPage getTaskLists​(String pageToken)
        Retrieves task lists page
        Parameters:
        pageToken - page token or null
        Returns:
        TaskLists page
      • getTaskList

        TaskList getTaskList​(String id)
        Retrieves a task list by its ID.
        Parameters:
        id - the task list ID or "@default"
        Returns:
        the retrieved TaskList
      • saveTaskList

        TaskList saveTaskList​(TaskList taskList)
        Creates or updates a task list.
        Parameters:
        taskList - the task list to create or update
        Returns:
        the saved TaskList
      • deleteTaskList

        void deleteTaskList​(String taskListId)
        Deletes a task list.
        Parameters:
        taskListId - the ID of the task list to delete
      • deleteTaskList

        void deleteTaskList​(TaskList taskList)
        Deletes a task list.
        Parameters:
        taskList - the task list to delete
      • getTasks

        TasksPage getTasks()
        Retrieves up to 100 active tasks from the default task list.
        Returns:
        TasksPage with up to 100 items
      • getTasks

        TasksPage getTasks​(String taskListId,
                           String pageToken)
        Retrieved tasks from a task list
        Parameters:
        taskListId - ID of the task list
        pageToken - page token or null
        Returns:
        Tasks page
      • getTask

        Task getTask​(String id)
        Retrieves a task from the default task list by its ID.
        Parameters:
        id - the task ID
        Returns:
        the retrieved Task
      • getTask

        Task getTask​(String taskListId,
                     String id)
        Retrieves a task by its containing task list ID and by the task ID.
        Parameters:
        taskListId - the containing task list ID
        id - the task ID
        Returns:
        the retrieved Task
      • saveTask

        Task saveTask​(Task task)
        Creates or updates a task in the default task list.
        Parameters:
        task - the task to create or update
        Returns:
        the saved Task
      • saveTask

        Task saveTask​(String taskListId,
                      Task task)
        Creates or updates a task in a specified task list.
        Parameters:
        taskListId - the containing task list ID
        task - the task to create or update
        Returns:
        the saved Task
      • deleteTask

        void deleteTask​(String taskListId,
                        String taskId)
        Deletes a task from a task list. Deleted tasks can be retrieved using TaskQueryBuilder.includeDeleted(boolean).
        Parameters:
        taskListId - the containing task list ID
        taskId - the ID of the task to delete
      • deleteTask

        void deleteTask​(String taskListId,
                        Task task)
        Deletes a task from a task list. Deleted tasks can be retrieved using TaskQueryBuilder.includeDeleted(boolean).
        Parameters:
        taskListId - the containing task list ID
        task - the task to delete
      • createTaskAt

        Task createTaskAt​(String taskListId,
                          String parent,
                          String previous,
                          Task task)
        Creates a task at a specified position in a task list.
        Parameters:
        taskListId - the containing task list
        parent - task ID to become parent of the new task
        previous - the task ID after which the new task will be appended
        task - the task to create
        Returns:
        the created Task
      • moveTask

        Task moveTask​(String taskListId,
                      Task task,
                      String parent,
                      String previous)
        Moves a task to a new position in the task list.
        Parameters:
        taskListId - the containing task list ID
        task - the task to move
        parent - the task ID to become parent of the moved task
        previous - the task ID after which the moved task will be appended
        Returns:
        the moved Task
        Throws:
        IllegalStateException - if both 'parent' and 'previous' arguments are empty