mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 12:44:07 -08:00
57afd480ab
* Apply Prettier to all credentials * Fix quotes for lint * 👕 Remove `quotemark` rule * 👕 Run Prettier to take over quotes * ⬆️ Upgrade `eslint-plugin-n8n-nodes-base` * 📦 Update `package-lock.json` Co-authored-by: Omar Ajoue <krynble@gmail.com> Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
87 lines
1.5 KiB
TypeScript
87 lines
1.5 KiB
TypeScript
import {
|
|
IAuthenticateGeneric,
|
|
ICredentialDataDecryptedObject,
|
|
ICredentialTestRequest,
|
|
ICredentialType,
|
|
IHttpRequestOptions,
|
|
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 }}',
|
|
},
|
|
},
|
|
};
|
|
}
|