feat(Trello Node) Add support for board members and credential tests (#3201)

* adds support for trello board member operations: inviteMemberByEmail, addMember, removeMember, getMembers

* lintfix

* format fixes

* remove unnecessary variable and assign to qs on same line

* fix description

* Moved Board Members to their own resource

* Removed members from board resource...

* Added return all limits to get members

* adds info about Trello premium feature in description

* Improvements from internal review

*  Improvements

* Changed credentials to use new system and implemented test

*  Improvements

* fix(core): Fix issue with fixedCollection having all default values

* 👕 Fix lint issue

Co-authored-by: Jonathan Bennetts <jonathan.bennetts@gmail.com>
Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
Cristobal Schlaubitz Garcia
2022-05-15 19:48:17 +02:00
committed by GitHub
parent 7ced65484f
commit d8870ecbff
7 changed files with 440 additions and 18 deletions

View File

@@ -25,6 +25,11 @@ import {
boardOperations,
} from './BoardDescription';
import {
boardMemberFields,
boardMemberOperations,
} from './BoardMemberDescription';
import {
cardFields,
cardOperations,
@@ -84,6 +89,10 @@ export class Trello implements INodeType {
name: 'Board',
value: 'board',
},
{
name: 'Board Member',
value: 'boardMember',
},
{
name: 'Card',
value: 'card',
@@ -114,6 +123,7 @@ export class Trello implements INodeType {
// ----------------------------------
...attachmentOperations,
...boardOperations,
...boardMemberOperations,
...cardOperations,
...cardCommentOperations,
...checklistOperations,
@@ -125,6 +135,7 @@ export class Trello implements INodeType {
// ----------------------------------
...attachmentFields,
...boardFields,
...boardMemberFields,
...cardFields,
...cardCommentFields,
...checklistFields,
@@ -216,7 +227,68 @@ export class Trello implements INodeType {
} else {
throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`);
}
} else if (resource === 'boardMember') {
if (operation === 'getAll') {
// ----------------------------------
// getAll
// ----------------------------------
requestMethod = 'GET';
const id = this.getNodeParameter('id', i) as string;
returnAll = this.getNodeParameter('returnAll', i) as boolean;
if (returnAll === false) {
qs.limit = this.getNodeParameter('limit', i) as number;
}
endpoint = `boards/${id}/members`;
} else if (operation === 'add') {
// ----------------------------------
// add
// ----------------------------------
requestMethod = 'PUT';
const id = this.getNodeParameter('id', i) as string;
const idMember = this.getNodeParameter('idMember', i) as string;
endpoint = `boards/${id}/members/${idMember}`;
qs.type = this.getNodeParameter('type', i) as string;
qs.allowBillableGuest = this.getNodeParameter('additionalFields.allowBillableGuest', i, false) as boolean;
} else if (operation === 'invite') {
// ----------------------------------
// invite
// ----------------------------------
requestMethod = 'PUT';
const id = this.getNodeParameter('id', i) as string;
endpoint = `boards/${id}/members`;
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
qs.email = this.getNodeParameter('email', i) as string;
qs.type = additionalFields.type as string;
body.fullName = additionalFields.fullName as string;
} else if (operation === 'remove') {
// ----------------------------------
// remove
// ----------------------------------
requestMethod = 'DELETE';
const id = this.getNodeParameter('id', i) as string;
const idMember = this.getNodeParameter('idMember', i) as string;
endpoint = `boards/${id}/members/${idMember}`;
} else {
throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`);
}
} else if (resource === 'card') {
if (operation === 'create') {