Skip to content

Commit

Permalink
Merge pull request #2 from bhushankumarl/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
Bhushankumar Lilapara authored Dec 6, 2017
2 parents 993e18f + 79d3fca commit b53fe84
Show file tree
Hide file tree
Showing 88 changed files with 1,670 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
0.0.4 December 06, 2017
- Add JavaScript examples : Card, Action, Labels, Webhook etc
- Add TypeScript examples : Boards, Card, Action, Labels, Webhook etc

0.0.3 December 02, 2017
- Add support for TypeScript
- Add JavaScript examples
Expand Down
20 changes: 19 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1 +1,19 @@
Copyright (C) 2017 Bhushankumar Lilapara
Copyright (C) 2017 Bhushankumar Lilapara

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# trello-node-api (Trello REST API)
[![Build Status](https://travis-ci.org/bhushankumarl/trello-node-api.svg?branch=master)](https://travis-ci.org/bhushankumarl/trello-node-api)

This API supported Trello's standard REST-style API that accepts/returns JSON requests and Here is the [API reference] (https://developers.trello.com/v1.0/reference)

Expand Down
14 changes: 14 additions & 0 deletions examples/javascript/actions/deleteAction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var apiKey = process.env.TRELLO_API_KEY || 'YOUR_API_KEY';
var oauthToken = process.env.TRELLO_OAUTH_TOKEN || 'OAUTH_TOKEN';

var Trello = require('../../../lib/trello-node-api')(apiKey, oauthToken);

var actionRequest = function () {
Trello.action.del('ACTION_ID').then(function (response) {
console.log('response ', response);
}).catch(function (error) {
console.log('error', error);
});
};

actionRequest();
14 changes: 14 additions & 0 deletions examples/javascript/actions/searchAction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var apiKey = process.env.TRELLO_API_KEY || 'YOUR_API_KEY';
var oauthToken = process.env.TRELLO_OAUTH_TOKEN || 'OAUTH_TOKEN';

var Trello = require('../../../lib/trello-node-api')(apiKey, oauthToken);

var actionRequest = function () {
Trello.action.search('ACTION_ID').then(function (response) {
console.log('response ', response);
}).catch(function (error) {
console.log('error', error);
});
};

actionRequest();
14 changes: 14 additions & 0 deletions examples/javascript/actions/searchFieldAction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var apiKey = process.env.TRELLO_API_KEY || 'YOUR_API_KEY';
var oauthToken = process.env.TRELLO_OAUTH_TOKEN || 'OAUTH_TOKEN';

var Trello = require('../../../lib/trello-node-api')(apiKey, oauthToken);

var actionRequest = function () {
Trello.action.searchField('ACTION_ID', 'FIELD_NAME').then(function (response) {
console.log('response ', response);
}).catch(function (error) {
console.log('error', error);
});
};

actionRequest();
17 changes: 17 additions & 0 deletions examples/javascript/actions/updateAction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
var apiKey = process.env.TRELLO_API_KEY || 'YOUR_API_KEY';
var oauthToken = process.env.TRELLO_OAUTH_TOKEN || 'OAUTH_TOKEN';

var Trello = require('../../../lib/trello-node-api')(apiKey, oauthToken);

var actionRequest = function () {
var id = 'ACTION_ID';
var data = {text: 'text'};

Trello.action.update(id, data).then(function (response) {
console.log('response ', response);
}).catch(function (error) {
console.log('error', error);
});
};

actionRequest();
23 changes: 22 additions & 1 deletion examples/javascript/boards/updateBoard.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,28 @@ var Trello = require('../../../lib/trello-node-api')(apiKey, oauthToken);

var boardRequest = function () {
var id = 'BOARD_ID';
var data = {name: 'BOARD'};
var data = {
name: 'BOARD',
desc: 'Board descriptions',
closed: false,
subscribed: false,
idOrganization: '',
prefs_permissionLevel: 'private',
prefs_selfJoin: true,
prefs_cardCovers: true,
prefs_invitations: 'members',
prefs_voting: 'disabled',
prefs_comments: 'members',
prefs_background: 'blue',
prefs_cardAging: 'regular',
prefs_calendarFeedEnabled: false,
labelNames_green: '',
labelNames_yellow: '',
labelNames_orange: '',
labelNames_red: '',
labelNames_purple: '',
labelNames_blue: ''
};

Trello.board.update(id, data).then(function (response) {
console.log('response ', response);
Expand Down
28 changes: 28 additions & 0 deletions examples/javascript/cards/createCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
var apiKey = process.env.TRELLO_API_KEY || 'YOUR_API_KEY';
var oauthToken = process.env.TRELLO_OAUTH_TOKEN || 'OAUTH_TOKEN';

var Trello = require('../../../lib/trello-node-api')(apiKey, oauthToken);

var cardRequest = function () {
var data = {
name: 'CARD_NAME',
desc: 'Card description',
pos: 'top',
idList: 'LIST_ID', //required
due: false,
dueComplete: false,
idMembers: ['MEMBER_ID', 'MEMBER_ID', 'MEMBER_ID'],
idLabels: ['LABEL_ID', 'LABEL_ID', 'LABEL_ID'],
urlSource: '',
fileSource: '',
idCardSource: '',
keepFromSource: '',
};
Trello.card.create(data).then(function (response) {
console.log('response ', response);
}).catch(function (error) {
console.log('error', error);
});
};

cardRequest();
15 changes: 15 additions & 0 deletions examples/javascript/cards/deleteCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
var apiKey = process.env.TRELLO_API_KEY || 'YOUR_API_KEY';
var oauthToken = process.env.TRELLO_OAUTH_TOKEN || 'OAUTH_TOKEN';

var Trello = require('../../../lib/trello-node-api')(apiKey, oauthToken);

var cardRequest = function () {
var id = 'CARD_ID';
Trello.card.del(id).then(function (response) {
console.log('response ', response);
}).catch(function (error) {
console.log('error', error);
});
};

cardRequest();
14 changes: 14 additions & 0 deletions examples/javascript/cards/searchCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var apiKey = process.env.TRELLO_API_KEY || 'YOUR_API_KEY';
var oauthToken = process.env.TRELLO_OAUTH_TOKEN || 'OAUTH_TOKEN';

var Trello = require('../../../lib/trello-node-api')(apiKey, oauthToken);

var cardRequest = function () {
Trello.card.search('CARD_ID').then(function (response) {
console.log('response ', response);
}).catch(function (error) {
console.log('error', error);
});
};

cardRequest();
14 changes: 14 additions & 0 deletions examples/javascript/cards/searchFieldCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var apiKey = process.env.TRELLO_API_KEY || 'YOUR_API_KEY';
var oauthToken = process.env.TRELLO_OAUTH_TOKEN || 'OAUTH_TOKEN';

var Trello = require('../../../lib/trello-node-api')(apiKey, oauthToken);

var cardRequest = function () {
Trello.card.searchField('CARD_ID', 'FIELD_NAME').then(function (response) {
console.log('response ', response);
}).catch(function (error) {
console.log('error', error);
});
};

cardRequest();
30 changes: 30 additions & 0 deletions examples/javascript/cards/updateCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
var apiKey = process.env.TRELLO_API_KEY || 'YOUR_API_KEY';
var oauthToken = process.env.TRELLO_OAUTH_TOKEN || 'OAUTH_TOKEN';

var Trello = require('../../../lib/trello-node-api')(apiKey, oauthToken);

var cardRequest = function () {
var id = 'CARD_ID';
var data = {
name: 'CARD_NAME_TEST',
desc: 'Card description',
closed: false,
idMembers: 'MEMBER_ID,MEMBER_ID,MEMBER_ID',
idAttachmentCover: '',
idList: '',
idLabels: 'LABEL_ID, LABEL_ID, LABEL_ID',
idBoard: false,
pos: 'top',
due: null,
dueComplete: false,
subscribed: false,
};

Trello.card.update(id, data).then(function (response) {
console.log('response ', response);
}).catch(function (error) {
console.log('error', error);
});
};

cardRequest();
20 changes: 20 additions & 0 deletions examples/javascript/checklists/createChecklist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
var apiKey = process.env.TRELLO_API_KEY || 'YOUR_API_KEY';
var oauthToken = process.env.TRELLO_OAUTH_TOKEN || 'OAUTH_TOKEN';

var Trello = require('../../../lib/trello-node-api')(apiKey, oauthToken);

var checklistRequest = function () {
var data = {
idCard: 'CARD_ID', // required
name: 'CHECKLIST_NAME',
pos: 1
};

Trello.checklist.create(data).then(function (response) {
console.log('response ', response);
}).catch(function (error) {
console.log('error', error);
});
};

checklistRequest();
15 changes: 15 additions & 0 deletions examples/javascript/checklists/deleteChecklist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
var apiKey = process.env.TRELLO_API_KEY || 'YOUR_API_KEY';
var oauthToken = process.env.TRELLO_OAUTH_TOKEN || 'OAUTH_TOKEN';

var Trello = require('../../../lib/trello-node-api')(apiKey, oauthToken);

var checklistRequest = function () {
var id = 'CHECKLIST_ID';
Trello.checklist.del(id).then(function (response) {
console.log('response ', response);
}).catch(function (error) {
console.log('error', error);
});
};

checklistRequest();
14 changes: 14 additions & 0 deletions examples/javascript/checklists/searchChecklist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var apiKey = process.env.TRELLO_API_KEY || 'YOUR_API_KEY';
var oauthToken = process.env.TRELLO_OAUTH_TOKEN || 'OAUTH_TOKEN';

var Trello = require('../../../lib/trello-node-api')(apiKey, oauthToken);

var checklistRequest = function () {
Trello.checklist.search('CHECKLIST_ID').then(function (response) {
console.log('response ', response);
}).catch(function (error) {
console.log('error', error);
});
};

checklistRequest();
14 changes: 14 additions & 0 deletions examples/javascript/checklists/searchFieldChecklist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var apiKey = process.env.TRELLO_API_KEY || 'YOUR_API_KEY';
var oauthToken = process.env.TRELLO_OAUTH_TOKEN || 'OAUTH_TOKEN';

var Trello = require('../../../lib/trello-node-api')(apiKey, oauthToken);

var checklistRequest = function () {
Trello.checklist.searchField('CHECKLIST_ID', 'FIELD_NAME').then(function (response) {
console.log('response ', response);
}).catch(function (error) {
console.log('error', error);
});
};

checklistRequest();
20 changes: 20 additions & 0 deletions examples/javascript/checklists/updateChecklist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
var apiKey = process.env.TRELLO_API_KEY || 'YOUR_API_KEY';
var oauthToken = process.env.TRELLO_OAUTH_TOKEN || 'OAUTH_TOKEN';

var Trello = require('../../../lib/trello-node-api')(apiKey, oauthToken);

var checklistRequest = function () {
var id = 'CHECKLIST_ID';
var data = {
name: 'CHECKLIST_NAME',
pos: 'top'
};

Trello.checklist.update(id, data).then(function (response) {
console.log('response ', response);
}).catch(function (error) {
console.log('error', error);
});
};

checklistRequest();
14 changes: 14 additions & 0 deletions examples/javascript/enterprises/searchEnterprises.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var apiKey = process.env.TRELLO_API_KEY || 'YOUR_API_KEY';
var oauthToken = process.env.TRELLO_OAUTH_TOKEN || 'OAUTH_TOKEN';

var Trello = require('../../../lib/trello-node-api')(apiKey, oauthToken);

var enterpriseRequest = function () {
Trello.enterprise.search('ENTERPRISE_ID').then(function (response) {
console.log('response ', response);
}).catch(function (error) {
console.log('error', error);
});
};

enterpriseRequest();
19 changes: 19 additions & 0 deletions examples/javascript/labels/createLabel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
var apiKey = process.env.TRELLO_API_KEY || 'YOUR_API_KEY';
var oauthToken = process.env.TRELLO_OAUTH_TOKEN || 'OAUTH_TOKEN';

var Trello = require('../../../lib/trello-node-api')(apiKey, oauthToken);

var labelRequest = function () {
var data = {
name: 'LABEL_NAME',
color: 'orange',
idBoard: 'BOARD_ID'
};
Trello.label.create(data).then(function (response) {
console.log('response ', response);
}).catch(function (error) {
console.log('error', error);
});
};

labelRequest();
15 changes: 15 additions & 0 deletions examples/javascript/labels/deleteLabel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
var apiKey = process.env.TRELLO_API_KEY || 'YOUR_API_KEY';
var oauthToken = process.env.TRELLO_OAUTH_TOKEN || 'OAUTH_TOKEN';

var Trello = require('../../../lib/trello-node-api')(apiKey, oauthToken);

var labelRequest = function () {
var id = 'LABEL_ID';
Trello.label.del(id).then(function (response) {
console.log('response ', response);
}).catch(function (error) {
console.log('error', error);
});
};

labelRequest();
Loading

0 comments on commit b53fe84

Please sign in to comment.