NAME

Google::RestApi::TasksApi1 - API to Google Tasks API V1.

SYNOPSIS

Basic Setup

use Google::RestApi;
use Google::RestApi::TasksApi1;

# Create the REST API instance
my $rest_api = Google::RestApi->new(
  config_file => '/path/to/config.yaml',
);

# Create the Tasks API instance
my $tasks_api = Google::RestApi::TasksApi1->new(api => $rest_api);

Working with Task Lists

# Create a new task list
my $task_list = $tasks_api->create_task_list(title => 'My Task List');

# Get an existing task list
my $tl = $tasks_api->task_list(id => 'task_list_id');
my $metadata = $tl->get();

# Update task list title
$tl->update(title => 'Updated Name');

# List all task lists
my @lists = $tasks_api->list_task_lists();

Working with Tasks

my $tl = $tasks_api->task_list(id => 'task_list_id');

# Create a task
my $task = $tl->create_task(
  title => 'Buy groceries',
  notes => 'Milk, eggs, bread',
  due   => '2026-03-01T00:00:00.000Z',
);

# Get/update/delete a task
my $details = $task->get();
$task->update(title => 'Buy groceries and snacks');
$task->delete();

# Complete/uncomplete a task
$task->complete();
$task->uncomplete();

# Move a task (make it a subtask or reorder)
$task->move(parent => 'parent_task_id');
$task->move(previous => 'sibling_task_id');

# List tasks
my @tasks = $tl->tasks();

# Clear completed tasks
$tl->clear();

DESCRIPTION

Google::RestApi::TasksApi1 provides a Perl interface to the Google Tasks API V1. It enables task management including:

  • Task list CRUD operations (create, get, update, delete)

  • Task management (create, get, update, delete)

  • Task completion tracking (complete, uncomplete)

  • Task organization (move for subtasks and reordering)

  • Clear completed tasks from a list

It is assumed that you are familiar with the Google Tasks API: https://developers.google.com/tasks/reference/rest

Architecture

The API uses a hierarchical object model where child objects delegate API calls to their parent:

TasksApi1 (top-level)
  |-- task_list(id => ...)       -> TaskList
  |     |-- task(id => ...)      -> Task
  |     |-- tasks()              -> list of task hashrefs
  |     |-- create_task()        -> Task
  |     |-- clear()              -> clears completed

Each object provides CRUD operations appropriate to its resource type.

NAVIGATION

SUBROUTINES

new(%args)

Creates a new TasksApi1 instance.

my $tasks_api = Google::RestApi::TasksApi1->new(api => $rest_api);

%args consists of:

  • api Google::RestApi: Required. A configured RestApi instance.

  • endpoint <string>: Optional. Override the default Tasks API endpoint.

api(%args)

Low-level method to make API calls. You would not normally call this directly unless making a Google API call not currently supported by this framework.

%args consists of:

  • uri <string>: Path segments to append to the Tasks endpoint.

  • %args: Additional arguments passed to Google::RestApi's api() (content, params, method, etc).

Returns the response hash from the Google API.

task_list(%args)

Returns a TaskList object for the given task list ID.

my $tl = $tasks_api->task_list(id => 'task_list_id');

%args consists of:

  • id <string>: Optional. The task list ID. Required for get/update/delete.

create_task_list(%args)

Creates a new task list.

my $tl = $tasks_api->create_task_list(title => 'My Tasks');

%args consists of:

  • title <string>: Required. The name for the task list.

Returns a TaskList object for the created task list.

list_task_lists(%args)

Lists all task lists for the user.

my @lists = $tasks_api->list_task_lists();
my @lists = $tasks_api->list_task_lists(max_pages => 2);

max_pages limits the number of pages fetched (default 0 = unlimited). Supports page_callback, see "PAGE CALLBACKS" in Google::RestApi.

Returns a list of task list hashrefs with id and title.

rest_api()

Returns the underlying Google::RestApi object.

SEE ALSO

AUTHORS

  • Robin Murray mvsjes@cpan.org

COPYRIGHT

Copyright (c) 2019-2026 Robin Murray. All rights reserved.

This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.