0.2.0 • Published 4 years ago

anydo-api v0.2.0

Weekly downloads
6
License
ISC
Repository
github
Last release
4 years ago

Any.do API (unofficial)

This API allows to list and add tasks and also get auth token

Installation

npm install anydo-api

Example

const Api = require('anydo-api');

const api = new Api('your_email', 'your_password');

const tasks = [
    {title: 'from api today'},
    {title: 'from api tomorrow', dueDate: 'tomorrow'},
    {title: 'from api upcoming', dueDate: 'upcoming'},
    {title: 'from api someday', dueDate: null},
    {title: 'from api to category', categoryId: 'yourCategoryId'}
];

// create then delete tasks
api.addTasks(tasks)
    .then(() => api.sync())
    .then(res => {
        const titlesToFind = tasks.map(t => t.title);
        const filteredList = res.models.task.items.filter(t => titlesToFind.includes(t.title));

        console.log(filteredList.length);

        filteredList.forEach(t => api.deleteTask({taskId: t.id}));
    });

Methods

Api

Kind: global class

api.login(options) ⇒ Promise

Get auth token

Kind: instance method of Api

ParamType
optionsobject
options.emailstring
options.passwordstring

api.sync(options) ⇒ Promise

Sync tasks If it is invoked without options, it just returns all undone and not deleted tasks

Kind: instance method of Api

ParamType
optionsobject
options.updateSincenumber
options.includeDoneboolean
options.includeDeletedboolean
options.modelsobject

api.setToken(token) ⇒ Promise

Set token for current API instance

Kind: instance method of Api

ParamType
tokenobject
token.tokenstring

api.addTask(options) ⇒ Promise~~

Deprecated

Add new task

Kind: instance method of Api

ParamType
optionsobject
options.titlestring
options.dueDatenumberstring
options.categoryIdstring

api.addTasks(tasks) ⇒ Promise

Add several tasks at once

Kind: instance method of Api

ParamType
tasksArray.<object>
tasks[].titlestring
[tasks[].dueDate]numberstring
[tasks[].categoryId]string

api.deleteTask(object) ⇒ Promise

Delete task

Kind: instance method of Api

ParamType
objectobject
object.taskIdstring

CLI

Any.DO CLI

0.2.0

4 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago