n8n/packages/nodes-base/credentials/TrelloApi.credentials.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

61 lines
1.2 KiB
TypeScript
Raw Normal View History

import type {
ICredentialDataDecryptedObject,
ICredentialTestRequest,
2019-07-12 08:54:15 -07:00
ICredentialType,
IHttpRequestOptions,
INodeProperties,
2019-07-12 08:54:15 -07:00
} from 'n8n-workflow';
export class TrelloApi implements ICredentialType {
name = 'trelloApi';
2019-07-12 08:54:15 -07:00
displayName = 'Trello API';
documentationUrl = 'trello';
properties: INodeProperties[] = [
2019-07-12 08:54:15 -07:00
{
displayName: 'API Key',
name: 'apiKey',
type: 'string',
typeOptions: { password: true },
required: true,
2019-07-12 08:54:15 -07:00
default: '',
},
{
displayName: 'API Token',
name: 'apiToken',
type: 'string',
typeOptions: { password: true },
required: true,
2019-07-12 08:54:15 -07:00
default: '',
},
{
displayName: 'OAuth Secret',
name: 'oauthSecret',
type: 'hidden',
typeOptions: { password: true },
2019-07-12 08:54:15 -07:00
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',
},
};
2019-07-12 08:54:15 -07:00
}