Fixed formatting issues on Google Calendar and MessageBird

This commit is contained in:
ricardo 2020-06-17 17:46:34 -04:00
parent d261eb5a12
commit b4da818dbd
4 changed files with 394 additions and 308 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,6 @@
import { IDataObject } from "n8n-workflow"; import {
IDataObject,
} from 'n8n-workflow';
export interface IReminder { export interface IReminder {
useDefault?: boolean; useDefault?: boolean;

View file

@ -1,4 +1,6 @@
import { IExecuteFunctions } from 'n8n-core'; import {
IExecuteFunctions,
} from 'n8n-core';
import { import {
IDataObject, IDataObject,
@ -6,14 +8,22 @@ import {
INodeTypeDescription, INodeTypeDescription,
INodeType, INodeType,
ILoadOptionsFunctions, ILoadOptionsFunctions,
INodePropertyOptions INodePropertyOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { googleApiRequest, googleApiRequestAllItems } from './GenericFunctions'; import {
googleApiRequest,
googleApiRequestAllItems,
} from './GenericFunctions';
import { eventOperations, eventFields } from './EventDescription'; import {
eventOperations,
eventFields,
} from './EventDescription';
import { IEvent } from './EventInterface'; import {
IEvent,
} from './EventInterface';
import * as moment from 'moment-timezone'; import * as moment from 'moment-timezone';
@ -28,14 +38,14 @@ export class GoogleCalendar implements INodeType {
description: 'Consume Google Calendar API.', description: 'Consume Google Calendar API.',
defaults: { defaults: {
name: 'Google Calendar', name: 'Google Calendar',
color: '#3E87E4' color: '#3E87E4',
}, },
inputs: ['main'], inputs: ['main'],
outputs: ['main'], outputs: ['main'],
credentials: [ credentials: [
{ {
name: 'googleCalendarOAuth2Api', name: 'googleCalendarOAuth2Api',
required: true required: true,
} }
], ],
properties: [ properties: [
@ -46,15 +56,15 @@ export class GoogleCalendar implements INodeType {
options: [ options: [
{ {
name: 'Event', name: 'Event',
value: 'event' value: 'event',
} },
], ],
default: 'event', default: 'event',
description: 'The resource to operate on.' description: 'The resource to operate on.'
}, },
...eventOperations, ...eventOperations,
...eventFields ...eventFields,
] ],
}; };
methods = { methods = {

View file

@ -1,13 +1,17 @@
import { IExecuteFunctions } from 'n8n-core'; import {
IExecuteFunctions,
} from 'n8n-core';
import { import {
IDataObject, IDataObject,
INodeTypeDescription, INodeTypeDescription,
INodeExecutionData, INodeExecutionData,
INodeType INodeType,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { messageBirdApiRequest } from './GenericFunctions'; import {
messageBirdApiRequest,
} from './GenericFunctions';
export class MessageBird implements INodeType { export class MessageBird implements INodeType {
description: INodeTypeDescription = { description: INodeTypeDescription = {
@ -20,15 +24,15 @@ export class MessageBird implements INodeType {
description: 'Sending SMS', description: 'Sending SMS',
defaults: { defaults: {
name: 'MessageBird', name: 'MessageBird',
color: '#2481d7' color: '#2481d7',
}, },
inputs: ['main'], inputs: ['main'],
outputs: ['main'], outputs: ['main'],
credentials: [ credentials: [
{ {
name: 'messageBirdApi', name: 'messageBirdApi',
required: true required: true,
} },
], ],
properties: [ properties: [
{ {
@ -38,31 +42,32 @@ export class MessageBird implements INodeType {
options: [ options: [
{ {
name: 'SMS', name: 'SMS',
value: 'sms' value: 'sms',
} },
], ],
default: 'sms', default: 'sms',
description: 'The resource to operate on.' description: 'The resource to operate on.',
}, },
{ {
displayName: 'Operation', displayName: 'Operation',
name: 'operation', name: 'operation',
type: 'options', type: 'options',
displayOptions: { displayOptions: {
show: { show: {
resource: ['sms'] resource: [
} 'sms',
],
},
}, },
options: [ options: [
{ {
name: 'Send', name: 'Send',
value: 'send', value: 'send',
description: 'Send text messages (SMS)' description: 'Send text messages (SMS)',
} },
], ],
default: 'send', default: 'send',
description: 'The operation to perform.' description: 'The operation to perform.',
}, },
// ---------------------------------- // ----------------------------------
@ -77,11 +82,15 @@ export class MessageBird implements INodeType {
required: true, required: true,
displayOptions: { displayOptions: {
show: { show: {
operation: ['send'], operation: [
resource: ['sms'] 'send',
} ],
resource: [
'sms',
],
},
}, },
description: 'The number from which to send the message.' description: 'The number from which to send the message.',
}, },
{ {
displayName: 'To', displayName: 'To',
@ -92,13 +101,16 @@ export class MessageBird implements INodeType {
required: true, required: true,
displayOptions: { displayOptions: {
show: { show: {
operation: ['send'], operation: [
resource: ['sms'] 'send',
} ],
resource: [
'sms',
],
},
}, },
description: 'All recipients separated by commas.' description: 'All recipients separated by commas.',
}, },
{ {
displayName: 'Message', displayName: 'Message',
name: 'message', name: 'message',
@ -107,11 +119,15 @@ export class MessageBird implements INodeType {
required: true, required: true,
displayOptions: { displayOptions: {
show: { show: {
operation: ['send'], operation: [
resource: ['sms'] 'send',
} ],
resource: [
'sms',
],
},
}, },
description: 'The message to be send.' description: 'The message to be send.',
}, },
{ {
displayName: 'Additional Fields', displayName: 'Additional Fields',
@ -125,8 +141,7 @@ export class MessageBird implements INodeType {
name: 'createdDatetime', name: 'createdDatetime',
type: 'dateTime', type: 'dateTime',
default: '', default: '',
description: description: 'The date and time of the creation of the message in RFC3339 format (Y-m-dTH:i:sP).',
'The date and time of the creation of the message in RFC3339 format (Y-m-dTH:i:sP).'
}, },
{ {
displayName: 'Datacoding', displayName: 'Datacoding',
@ -135,27 +150,26 @@ export class MessageBird implements INodeType {
options: [ options: [
{ {
name: 'Auto', name: 'Auto',
value: 'auto' value: 'auto',
}, },
{ {
name: 'Plain', name: 'Plain',
value: 'plain' value: 'plain',
}, },
{ {
name: 'Unicode', name: 'Unicode',
value: 'unicode' value: 'unicode',
} },
], ],
default: '', default: '',
description: description: 'Using unicode will limit the maximum number of characters to 70 instead of 160.',
'Using unicode will limit the maximum number of characters to 70 instead of 160.'
}, },
{ {
displayName: 'Gateway', displayName: 'Gateway',
name: 'gateway', name: 'gateway',
type: 'number', type: 'number',
default: '', default: '',
description: 'The SMS route that is used to send the message.' description: 'The SMS route that is used to send the message.',
}, },
{ {
displayName: 'Group IDs', displayName: 'Group IDs',
@ -163,8 +177,7 @@ export class MessageBird implements INodeType {
placeholder: '1,2', placeholder: '1,2',
type: 'string', type: 'string',
default: '', default: '',
description: description: 'Group IDs separated by commas, If provided recipients can be omitted.',
'Group IDs separated by commas, If provided recipients can be omitted.'
}, },
{ {
displayName: 'Message Type', displayName: 'Message Type',
@ -174,39 +187,36 @@ export class MessageBird implements INodeType {
options: [ options: [
{ {
name: 'Flash', name: 'Flash',
value: 1 value: 1,
}, },
{ {
name: 'Normal', name: 'Normal',
value: 0 value: 0,
} },
], ],
default: 1, default: 1,
description: description: 'Indicated the message type. 1 is a normal message, 0 is a flash message.',
'Indicated the message type. 1 is a normal message, 0 is a flash message.'
}, },
{ {
displayName: 'Reference', displayName: 'Reference',
name: 'reference', name: 'reference',
type: 'string', type: 'string',
default: '', default: '',
description: 'A client reference.' description: 'A client reference.',
}, },
{ {
displayName: 'Report Url', displayName: 'Report Url',
name: 'reportUrl', name: 'reportUrl',
type: 'string', type: 'string',
default: '', default: '',
description: description: 'The status report URL to be used on a per-message basis.<br /> Reference is required for a status report webhook to be sent.',
'The status report URL to be used on a per-message basis.<br /> Reference is required for a status report webhook to be sent.'
}, },
{ {
displayName: 'Scheduled Date-time', displayName: 'Scheduled Date-time',
name: 'scheduledDatetime', name: 'scheduledDatetime',
type: 'dateTime', type: 'dateTime',
default: '', default: '',
description: description: 'The scheduled date and time of the message in RFC3339 format (Y-m-dTH:i:sP).',
'The scheduled date and time of the message in RFC3339 format (Y-m-dTH:i:sP).'
}, },
{ {
displayName: 'Type', displayName: 'Type',
@ -215,28 +225,26 @@ export class MessageBird implements INodeType {
options: [ options: [
{ {
name: 'Binary', name: 'Binary',
value: 'binary' value: 'binary',
}, },
{ {
name: 'Flash', name: 'Flash',
value: 'flash' value: 'flash',
}, },
{ {
name: 'SMS', name: 'SMS',
value: 'sms' value: 'sms',
} },
], ],
default: '', default: '',
description: description: 'The type of message.<br /> Values can be: sms, binary, or flash.',
'The type of message.<br /> Values can be: sms, binary, or flash.'
}, },
{ {
displayName: 'Type Details', displayName: 'Type Details',
name: 'typeDetails', name: 'typeDetails',
type: 'string', type: 'string',
default: '', default: '',
description: description: 'A hash with extra information.<br /> Is only used when a binary message is sent.',
'A hash with extra information.<br /> Is only used when a binary message is sent.'
}, },
{ {
displayName: 'Validity', displayName: 'Validity',
@ -244,13 +252,13 @@ export class MessageBird implements INodeType {
type: 'number', type: 'number',
default: 1, default: 1,
typeOptions: { typeOptions: {
minValue: 1 minValue: 1,
}, },
description: 'The amount of seconds that the message is valid.' description: 'The amount of seconds that the message is valid.',
} },
] ],
} },
] ],
}; };
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> { async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {