A Node.js wrapper for Lista REST API. Easily interact with Lista REST API using this library.
npm install --save lista-api
const Lista = require('lista-api');
const lista = new Lista({
baseURL: 'http://example.com',
encoding: 'utf-8'
});
Fetching user lists:
lista.getUserLists({userEmail: "some@example.com"})
.then(function (response) {
// handle success
console.log(response);
})
.catch(function (error) {
// handle error
console.log(error);
})
.then(function () {
// always executed
});
With async/await:
async function getUserLists() {
try {
const response = await lista.getUserLists({userEmail: "some@example.com"});
console.log(response);
} catch (error) {
console.error(error);
}
}
.getUser({userEmail})
.getList({listId})
.getItem({itemId})
.getUserLists({userEmail})
.getListItems({listId})
.getListUsers({listId})
.createUser({userEmail, userName})
.createList({listName})
.createItem({itemName})
.createUserList({userEmail, listName})
.createListItem({listId, itemName})
.addListUser({userEmail, listId})
.checkItem({itemId, checkedBy})
.uncheckItem({itemId})
.deleteList({listId})
.removeListUser({userEmail, listId})