-
-
Notifications
You must be signed in to change notification settings - Fork 25
Organizations 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 = {
displayName: 'ORGANIZATION_NAME', // REQUIRED
desc: 'Organization description',
name: 'NAME',
website: 'https://example.com'
};
let response;
try {
response = await Trello.organization.create(data)
} catch (error) {
if (error) {
console.log('error ', error);
}
}
console.log('response', response);
let response;
try {
response = await Trello.organization.search('ORGANIZATION_ID');
} catch (error) {
if (error) {
console.log('error ', error);
}
}
console.log('response', response);
let response;
try {
response = await Trello.organization.searchField('ORGANIZATION_ID', 'FIELD_NAME');
} catch (error) {
if (error) {
console.log('error ', error);
}
}
console.log('response', response);
let id = 'ORGANIZATION_ID'; // REQUIRED
let data = {
name: 'or123',
displayName: 'ORGANIZATION_DISPLAY_NAME',
desc: 'Organization descriptions',
website: 'https://example.com',
prefs_associatedDomain: 'trello.com',
prefs_externalMembersDisabled: false,
prefs_googleAppsVersion: 1,
prefs_boardVisibilityRestrict_org: 'none',
prefs_boardVisibilityRestrict_private: 'none',
prefs_boardVisibilityRestrict_public: 'none',
prefs_orgInviteRestrict: '*.test.com',
prefs_permissionLevel: 'public'
};
let response;
try {
response = await Trello.organization.update(id, data);
} catch (error) {
if (error) {
console.log('error ', error);
}
}
console.log('response', response);
let response;
try {
response = await Trello.organization.del('ORGANIZATION_ID');
} catch (error) {
if (error) {
console.log('error ', error);
}
}
console.log('response', response);