Skip to content

Commit c6a09b4

Browse files
committed
feat: add reference documentation links to tasks/simpleTasks/simpleTasks.gs and update advanced service check in tasks/quickstart/quickstart.gs
1 parent 4e891b4 commit c6a09b4

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

tasks/quickstart/quickstart.gs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,8 @@ function listTaskLists() {
2424
maxResults: 10,
2525
};
2626

27-
if (!Tasks.Tasklists) {
28-
// This check is necessary to prevent type errors. In a real application,
29-
// the Tasks service should be enabled in the Apps Script project.
30-
console.log(
31-
'Tasks API has an issue. Please enable it in your Apps Script project.');
32-
return;
27+
if (!Tasks) {
28+
throw new Error('Enable the Tasks Advanced Service.');
3329
}
3430
// Returns all the authenticated user's task lists.
3531
const response = Tasks.Tasklists.list(optionalArgs);

tasks/simpleTasks/simpleTasks.gs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ function doGet() {
4444
/**
4545
* Returns the ID and name of every task list in the user's account.
4646
* @return {TaskListInfo[]} The task list data.
47+
* @see https://developers.google.com/workspace/tasks/reference/rest/v1/tasklists/list
4748
*/
4849
function getTaskLists() {
4950
if (!Tasks.Tasklists) {
@@ -66,6 +67,7 @@ function getTaskLists() {
6667
* Returns information about the tasks within a given task list.
6768
* @param {string} taskListId The ID of the task list.
6869
* @return {TaskInfo[]} The task data.
70+
* @see https://developers.google.com/workspace/tasks/reference/rest/v1/tasks/list
6971
*/
7072
function getTasks(taskListId) {
7173
if (!Tasks.Tasks) {
@@ -94,6 +96,8 @@ function getTasks(taskListId) {
9496
* @param {string} taskListId The ID of the task list.
9597
* @param {string} taskId The ID of the task.
9698
* @param {boolean} completed True if the task should be marked as complete, false otherwise.
99+
* @see https://developers.google.com/apps-script/advanced/tasks
100+
* @see https://developers.google.com/workspace/tasks/reference/rest/v1/tasks/patch
97101
*/
98102
function setCompleted(taskListId, taskId, completed) {
99103
const task = Tasks.newTask();
@@ -113,6 +117,8 @@ function setCompleted(taskListId, taskId, completed) {
113117
* Adds a new task to the task list.
114118
* @param {string} taskListId The ID of the task list.
115119
* @param {string} title The title of the new task.
120+
* @see https://developers.google.com/apps-script/advanced/tasks
121+
* @see https://developers.google.com/workspace/tasks/reference/rest/v1/tasks/insert
116122
*/
117123
function addTask(taskListId, title) {
118124
const task = Tasks.newTask();

0 commit comments

Comments
 (0)