0.0.20241029 • Published 10 months ago

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

Weekly downloads
-
License
MIT
Repository
github
Last release
10 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

10 months ago

0.0.20241027

10 months ago

0.0.20241022

10 months ago

0.0.20241020

10 months ago

0.0.20241015

10 months ago

0.0.20240929

11 months ago

0.0.20241001

11 months ago

0.0.20241013

10 months ago

0.0.20241008

11 months ago

0.0.20241006

11 months ago

0.0.20240924

11 months ago

0.0.20240914

11 months ago

0.0.20240917

11 months ago

0.0.20240922

11 months ago

0.0.20240903

12 months ago

0.0.20240901

12 months ago

0.0.20240827

12 months ago

0.0.20240728

1 year ago

0.0.20240609

1 year ago

0.0.20240723

1 year ago

0.0.20240602

1 year ago

0.0.20240604

1 year ago

0.0.20240720

1 year ago

0.0.20240618

1 year ago

0.0.20240616

1 year ago

0.0.20240730

1 year 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

1 year ago

0.0.20240806

1 year ago

0.0.20240802

1 year ago

0.0.20240817

1 year ago

0.0.20240811

1 year ago

0.0.20240813

1 year ago

0.0.20240709

1 year ago

0.0.20240707

1 year ago

0.0.20240823

12 months ago

0.0.20240702

1 year ago

0.0.20240820

1 year ago

0.0.20240716

1 year ago

0.0.20240713

1 year 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

2 years ago

0.0.20240218

2 years ago

0.0.20240211

2 years ago

0.0.20240206

2 years ago

0.0.20240204

2 years ago

0.0.20240130

2 years ago

0.0.20240128

2 years ago

0.0.20240123

2 years ago

0.0.20240121

2 years ago

0.0.20240116

2 years ago

0.0.20240113

2 years ago

0.0.20240109

2 years ago

0.0.20240107

2 years 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

3 years ago

0.0.20230219

3 years ago

0.0.20230221

2 years ago

0.0.20230205

3 years ago

0.0.20230129

3 years ago

0.0.20230207

3 years ago

0.0.20230131

3 years ago

0.0.20230212

3 years ago

0.0.20230117

3 years ago

0.0.20230115

3 years ago

0.0.20221114

3 years ago

0.0.20221112

3 years ago

0.0.20221210

3 years ago

0.0.20230124

3 years ago

0.0.20230103

3 years ago

0.0.20221108

3 years ago

0.0.20230122

3 years ago

0.0.20221206

3 years ago

0.0.20221129

3 years ago

0.0.20221106

3 years ago

0.0.20230107

3 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

3 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