-
-
Notifications
You must be signed in to change notification settings - Fork 25
Lists TypeScript
BL edited this page Jun 8, 2018
·
2 revisions
export TRELLO_API_KEY=KEY
export TRELLO_OAUTH_TOKEN=TOKEN
Set your Trello Api Key and Trello Auth Token.
import * as TrelloNodeAPI from 'trello-node-api';
const Trello = new TrelloNodeAPI();
Trello.setApiKey(apiKey);
Trello.setOauthToken(oauthToken);
let data = {
name: 'LIST_NAME', // REQUIRED
idBoard: 'BOARD_ID', // REQUIRED
idListSource: 'LIST_ID',
pos: 'top'
};
let response;
try {
response = await Trello.list.create(data);
} catch (error) {
if (error) {
console.log('error ', error);
}
}
console.log('response', response);
let response;
try {
response = await Trello.list.search('LIST_ID');
} catch (error) {
if (error) {
console.log('error ', error);
}
}
console.log('response', response);
let response;
try {
response = await Trello.list.searchField('LIST_ID', 'FIELD_NAME');
} catch (error) {
if (error) {
console.log('error ', error);
}
}
console.log('response', response);
let id = 'LIST_ID'; // REQUIRED
let data = {
name: 'LIST_NAME',
closed: false,
pos: 'top',
subscribed: false
};
let response;
try {
response = await Trello.list.update(id, data);
} catch (error) {
if (error) {
console.log('error ', error);
}
}
console.log('response', response);