n8n/packages/nodes-base/credentials/TwilioApi.credentials.ts
Iván Ovejero b03e358a12
refactor: Integrate consistent-type-imports in nodes-base (no-changelog) (#5267)
* 👕 Enable `consistent-type-imports` for nodes-base

* 👕 Apply to nodes-base

*  Undo unrelated changes

* 🚚 Move to `.eslintrc.js` in nodes-base

*  Revert "Enable `consistent-type-imports` for nodes-base"

This reverts commit 529ad72b05.

* 👕 Fix severity
2023-01-27 12:22:44 +01:00

83 lines
1.5 KiB
TypeScript

import type { IAuthenticateGeneric, ICredentialType, INodeProperties } from 'n8n-workflow';
export class TwilioApi implements ICredentialType {
name = 'twilioApi';
displayName = 'Twilio API';
documentationUrl = 'twilio';
properties: INodeProperties[] = [
{
displayName: 'Auth Type',
name: 'authType',
type: 'options',
default: 'authToken',
options: [
{
name: 'Auth Token',
value: 'authToken',
},
{
name: 'API Key',
value: 'apiKey',
},
],
},
{
displayName: 'Account SID',
name: 'accountSid',
type: 'string',
default: '',
},
{
displayName: 'Auth Token',
name: 'authToken',
type: 'string',
default: '',
displayOptions: {
show: {
authType: ['authToken'],
},
},
},
{
displayName: 'API Key SID',
name: 'apiKeySid',
type: 'string',
default: '',
displayOptions: {
show: {
authType: ['apiKey'],
},
},
},
{
displayName: 'API Key Secret',
name: 'apiKeySecret',
type: 'string',
typeOptions: {
password: true,
},
default: '',
displayOptions: {
show: {
authType: ['apiKey'],
},
},
},
];
authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
auth: {
username:
'={{ $credentials.authType === "apiKey" ? $credentials.apiKeySid : $credentials.accountSid }}',
password:
'={{ $credentials.authType === "apiKey" ? $credentials.apiKeySecret : $credentials.authToken }}',
},
},
};
}