n8n/packages/nodes-base/credentials/TrelloApi.credentials.ts
Cristobal Schlaubitz Garcia d8870ecbff
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>
2022-05-15 19:48:17 +02:00

51 lines
1 KiB
TypeScript

import {
ICredentialDataDecryptedObject,
ICredentialTestRequest,
ICredentialType,
IHttpRequestOptions,
INodeProperties,
} from 'n8n-workflow';
export class TrelloApi implements ICredentialType {
name = 'trelloApi';
displayName = 'Trello API';
documentationUrl = 'trello';
properties: INodeProperties[] = [
{
displayName: 'API Key',
name: 'apiKey',
type: 'string',
required: true,
default: '',
},
{
displayName: 'API Token',
name: 'apiToken',
type: 'string',
required: true,
default: '',
},
{
displayName: 'OAuth Secret',
name: 'oauthSecret',
type: 'hidden',
default: '',
},
];
async authenticate(credentials: ICredentialDataDecryptedObject, requestOptions: IHttpRequestOptions): Promise<IHttpRequestOptions> {
requestOptions.qs = {
...requestOptions.qs,
'key': credentials.apiKey,
'token': credentials.apiToken,
};
return requestOptions;
}
test: ICredentialTestRequest = {
request: {
baseURL: 'https://api.trello.com',
url: '=/1/tokens/{{$credentials.apiToken}}/member',
},
};
}