0.0.20241029 • Published 8 months ago

@maxim_mazurok/gapi.client.tasks-v1 v0.0.20241029

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

TypeScript typings for Google Tasks API v1

The Google Tasks API lets you manage your tasks and task lists. For detailed description please check documentation.

Installing

Install typings for Google Tasks API:

npm install @types/gapi.client.tasks-v1 --save-dev

Usage

You need to initialize Google API client in your code:

gapi.load('client', () => {
  // now we can use gapi.client
  // ...
});

Then load api client wrapper:

gapi.client.load(
  'https://tasks.googleapis.com/$discovery/rest?version=v1',
  () => {
    // now we can use:
    // gapi.client.tasks
  }
);
// Deprecated, use discovery document URL, see https://github.com/google/google-api-javascript-client/blob/master/docs/reference.md#----gapiclientloadname----version----callback--
gapi.client.load('tasks', 'v1', () => {
  // now we can use:
  // gapi.client.tasks
});

Don't forget to authenticate your client before sending any request to resources:

// declare client_id registered in Google Developers Console
var client_id = '',
  scope = [
    // Create, edit, organize, and delete all your tasks
    'https://www.googleapis.com/auth/tasks',

    // View your tasks
    'https://www.googleapis.com/auth/tasks.readonly',
  ],
  immediate = true;
// ...

gapi.auth.authorize(
  {client_id: client_id, scope: scope, immediate: immediate},
  authResult => {
    if (authResult && !authResult.error) {
      /* handle successful authorization */
    } else {
      /* handle authorization error */
    }
  }
);

After that you can use Google Tasks API resources:

/*
Deletes the authenticated user's specified task list. If the list contains assigned tasks, both the assigned tasks and the original tasks in the assignment surface (Docs, Chat Spaces) are deleted.
*/
await gapi.client.tasks.tasklists.delete({tasklist: 'tasklist'});

/*
Returns the authenticated user's specified task list.
*/
await gapi.client.tasks.tasklists.get({tasklist: 'tasklist'});

/*
Creates a new task list and adds it to the authenticated user's task lists. A user can have up to 2000 lists at a time.
*/
await gapi.client.tasks.tasklists.insert({});

/*
Returns all the authenticated user's task lists. A user can have up to 2000 lists at a time.
*/
await gapi.client.tasks.tasklists.list({});

/*
Updates the authenticated user's specified task list. This method supports patch semantics.
*/
await gapi.client.tasks.tasklists.patch({tasklist: 'tasklist'});

/*
Updates the authenticated user's specified task list.
*/
await gapi.client.tasks.tasklists.update({tasklist: 'tasklist'});

/*
Clears all completed tasks from the specified task list. The affected tasks will be marked as 'hidden' and no longer be returned by default when retrieving all tasks for a task list.
*/
await gapi.client.tasks.tasks.clear({tasklist: 'tasklist'});

/*
Deletes the specified task from the task list. If the task is assigned, both the assigned task and the original task (in Docs, Chat Spaces) are deleted. To delete the assigned task only, navigate to the assignment surface and unassign the task from there.
*/
await gapi.client.tasks.tasks.delete({task: 'task', tasklist: 'tasklist'});

/*
Returns the specified task.
*/
await gapi.client.tasks.tasks.get({task: 'task', tasklist: 'tasklist'});

/*
Creates a new task on the specified task list. Tasks assigned from Docs or Chat Spaces cannot be inserted from Tasks Public API; they can only be created by assigning them from Docs or Chat Spaces. A user can have up to 20,000 non-hidden tasks per list and up to 100,000 tasks in total at a time.
*/
await gapi.client.tasks.tasks.insert({tasklist: 'tasklist'});

/*
Returns all tasks in the specified task list. Does not return assigned tasks be default (from Docs, Chat Spaces). A user can have up to 20,000 non-hidden tasks per list and up to 100,000 tasks in total at a time.
*/
await gapi.client.tasks.tasks.list({tasklist: 'tasklist'});

/*
Moves the specified task to another position in the destination task list. If the destination list is not specified, the task is moved within its current list. This can include putting it as a child task under a new parent and/or move it to a different position among its sibling tasks. A user can have up to 2,000 subtasks per task.
*/
await gapi.client.tasks.tasks.move({task: 'task', tasklist: 'tasklist'});

/*
Updates the specified task. This method supports patch semantics.
*/
await gapi.client.tasks.tasks.patch({task: 'task', tasklist: 'tasklist'});

/*
Updates the specified task.
*/
await gapi.client.tasks.tasks.update({task: 'task', tasklist: 'tasklist'});
0.0.20241029

8 months ago

0.0.20241027

8 months ago

0.0.20241022

9 months ago

0.0.20241020

9 months ago

0.0.20241015

9 months ago

0.0.20240929

9 months ago

0.0.20241001

9 months ago

0.0.20241013

9 months ago

0.0.20241008

9 months ago

0.0.20241006

9 months ago

0.0.20240924

10 months ago

0.0.20240914

10 months ago

0.0.20240917

10 months ago

0.0.20240922

10 months ago

0.0.20240903

10 months ago

0.0.20240901

10 months ago

0.0.20240827

10 months ago

0.0.20240728

11 months ago

0.0.20240609

1 year ago

0.0.20240723

12 months ago

0.0.20240602

1 year ago

0.0.20240604

1 year ago

0.0.20240720

12 months ago

0.0.20240618

1 year ago

0.0.20240616

1 year ago

0.0.20240730

11 months ago

0.0.20240611

1 year ago

0.0.20240630

1 year ago

0.0.20240625

1 year ago

0.0.20240623

1 year ago

0.0.20240526

1 year ago

0.0.20240527

1 year ago

0.0.20240528

1 year ago

0.0.20240521

1 year ago

0.0.20240804

11 months ago

0.0.20240806

11 months ago

0.0.20240802

11 months ago

0.0.20240817

11 months ago

0.0.20240811

11 months ago

0.0.20240813

11 months ago

0.0.20240709

12 months ago

0.0.20240707

12 months ago

0.0.20240823

11 months ago

0.0.20240702

1 year ago

0.0.20240820

11 months ago

0.0.20240716

12 months ago

0.0.20240713

12 months ago

0.0.20240519

1 year ago

0.0.20240507

1 year ago

0.0.20240504

1 year ago

0.0.20240430

1 year ago

0.0.20240428

1 year ago

0.0.20240423

1 year ago

0.0.20240421

1 year ago

0.0.20240416

1 year ago

0.0.20240414

1 year ago

0.0.20240409

1 year ago

0.0.20240407

1 year ago

0.0.20240331

1 year ago

0.0.20240402

1 year ago

0.0.20240326

1 year ago

0.0.20240324

1 year ago

0.0.20240319

1 year ago

0.0.20240317

1 year ago

0.0.20240310

1 year ago

0.0.20240312

1 year ago

0.0.20240305

1 year ago

0.0.20240303

1 year ago

0.0.20240227

1 year ago

0.0.20240225

1 year ago

0.0.20240220

1 year ago

0.0.20240218

1 year ago

0.0.20240211

1 year ago

0.0.20240206

1 year ago

0.0.20240204

1 year ago

0.0.20240130

1 year ago

0.0.20240128

1 year ago

0.0.20240123

1 year ago

0.0.20240121

1 year ago

0.0.20240116

1 year ago

0.0.20240113

1 year ago

0.0.20240109

1 year ago

0.0.20240107

1 year ago

0.0.20240102

2 years ago

0.0.20231218

2 years ago

0.0.20231217

2 years ago

0.0.20231212

2 years ago

0.0.20231210

2 years ago

0.0.20231205

2 years ago

0.0.20231203

2 years ago

0.0.20231105

2 years ago

0.0.20231107

2 years ago

0.0.20230815

2 years ago

0.0.20230812

2 years ago

0.0.20231112

2 years ago

0.0.20231114

2 years ago

0.0.20230808

2 years ago

0.0.20230926

2 years ago

0.0.20230806

2 years ago

0.0.20230801

2 years ago

0.0.20230923

2 years ago

0.0.20230718

2 years ago

0.0.20231128

2 years ago

0.0.20230711

2 years ago

0.0.20231008

2 years ago

0.0.20230716

2 years ago

0.0.20231015

2 years ago

0.0.20230829

2 years ago

0.0.20230708

2 years ago

0.0.20230827

2 years ago

0.0.20230822

2 years ago

0.0.20230701

2 years ago

0.0.20231119

2 years ago

0.0.20230820

2 years ago

0.0.20230704

2 years ago

0.0.20231001

2 years ago

0.0.20231121

2 years ago

0.0.20231003

2 years ago

0.0.20231029

2 years ago

0.0.20231031

2 years ago

0.0.20230729

2 years ago

0.0.20231017

2 years ago

0.0.20230721

2 years ago

0.0.20230725

2 years ago

0.0.20231021

2 years ago

0.0.20231024

2 years ago

0.0.20230917

2 years ago

0.0.20230910

2 years ago

0.0.20230912

2 years ago

0.0.20230905

2 years ago

0.0.20230903

2 years ago

0.0.20230627

2 years ago

0.0.20230625

2 years ago

0.0.20230618

2 years ago

0.0.20230613

2 years ago

0.0.20230611

2 years ago

0.0.20230620

2 years ago

0.0.20230606

2 years ago

0.0.20230603

2 years ago

0.0.20230527

2 years ago

0.0.20230530

2 years ago

0.0.20230514

2 years ago

0.0.20230516

2 years ago

0.0.20230521

2 years ago

0.0.20230502

2 years ago

0.0.20230429

2 years ago

0.0.20230507

2 years ago

0.0.20230415

2 years ago

0.0.20230418

2 years ago

0.0.20230326

2 years ago

0.0.20230404

2 years ago

0.0.20230401

2 years ago

0.0.20230408

2 years ago

0.0.20230328

2 years ago

0.0.20230411

2 years ago

0.0.20230314

2 years ago

0.0.20230318

2 years ago

0.0.20230321

2 years ago

0.0.20230425

2 years ago

0.0.20230304

2 years ago

0.0.20230228

2 years ago

0.0.20230226

2 years ago

0.0.20230307

2 years ago

0.0.20230312

2 years ago

0.0.20230214

2 years ago

0.0.20230219

2 years ago

0.0.20230221

2 years ago

0.0.20230205

2 years ago

0.0.20230129

2 years ago

0.0.20230207

2 years ago

0.0.20230131

2 years ago

0.0.20230212

2 years ago

0.0.20230117

2 years ago

0.0.20230115

2 years ago

0.0.20221114

3 years ago

0.0.20221112

3 years ago

0.0.20221210

3 years ago

0.0.20230124

2 years ago

0.0.20230103

3 years ago

0.0.20221108

3 years ago

0.0.20230122

2 years ago

0.0.20221206

3 years ago

0.0.20221129

3 years ago

0.0.20221106

3 years ago

0.0.20230107

2 years ago

0.0.20221203

3 years ago

0.0.20221122

3 years ago

0.0.20221220

3 years ago

0.0.20221120

3 years ago

0.0.20230110

2 years ago

0.0.20221218

3 years ago

0.0.20221015

3 years ago

0.0.20221008

3 years ago

0.0.20221029

3 years ago

0.0.20221004

3 years ago

0.0.20221025

3 years ago

0.0.20221101

3 years ago

0.0.20221023

3 years ago

0.0.20221001

3 years ago

0.0.20220927

3 years ago

0.0.20221018

3 years ago

0.0.20220916

3 years ago

0.0.20220906

3 years ago

0.0.20220829

3 years ago

0.0.20220819

3 years ago

0.0.20220920

3 years ago

0.0.20220910

3 years ago

0.0.20220823

3 years ago

0.0.20220912

3 years ago

0.0.20220925

3 years ago

0.0.20220826

3 years ago

0.0.20220904

3 years ago

0.0.20220816

3 years ago

0.0.20220812

3 years ago

0.0.20220808

3 years ago