mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-26 21:19:43 -08:00
⚡ Add Google Calendar conference link (#1085)
This commit is contained in:
parent
b04769287d
commit
5eb65f8721
|
@ -177,6 +177,37 @@ export const eventFields = [
|
||||||
default: '',
|
default: '',
|
||||||
description: 'The color of the event.',
|
description: 'The color of the event.',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Conference Data',
|
||||||
|
name: 'conferenceDataUi',
|
||||||
|
placeholder: 'Add Conference',
|
||||||
|
type: 'fixedCollection',
|
||||||
|
typeOptions: {
|
||||||
|
multipleValues: false,
|
||||||
|
},
|
||||||
|
default: {},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
displayName: 'Conference Link',
|
||||||
|
name: 'conferenceDataValues',
|
||||||
|
values: [
|
||||||
|
{
|
||||||
|
displayName: 'Type',
|
||||||
|
name: 'conferenceSolution',
|
||||||
|
type: 'options',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getConferenceSolutations',
|
||||||
|
loadOptionsDependsOn: [
|
||||||
|
'calendar',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
description: 'Creates a conference link (Hangouts, Meet etc) and attachs it to the event',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Description',
|
displayName: 'Description',
|
||||||
name: 'description',
|
name: 'description',
|
||||||
|
|
|
@ -7,6 +7,15 @@ export interface IReminder {
|
||||||
overrides?: IDataObject[];
|
overrides?: IDataObject[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IConferenceData {
|
||||||
|
createRequest?: {
|
||||||
|
requestId: string,
|
||||||
|
conferenceSolution: {
|
||||||
|
type: string,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export interface IEvent {
|
export interface IEvent {
|
||||||
attendees?: IDataObject[];
|
attendees?: IDataObject[];
|
||||||
colorId?: string;
|
colorId?: string;
|
||||||
|
@ -25,4 +34,5 @@ export interface IEvent {
|
||||||
summary?: string;
|
summary?: string;
|
||||||
transparency?: string;
|
transparency?: string;
|
||||||
visibility?: string;
|
visibility?: string;
|
||||||
|
conferenceData?: IConferenceData;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,8 @@ import {
|
||||||
|
|
||||||
import * as moment from 'moment-timezone';
|
import * as moment from 'moment-timezone';
|
||||||
|
|
||||||
|
import * as uuid from 'uuid/v4';
|
||||||
|
|
||||||
export class GoogleCalendar implements INodeType {
|
export class GoogleCalendar implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
displayName: 'Google Calendar',
|
displayName: 'Google Calendar',
|
||||||
|
@ -69,6 +71,38 @@ export class GoogleCalendar implements INodeType {
|
||||||
|
|
||||||
methods = {
|
methods = {
|
||||||
loadOptions: {
|
loadOptions: {
|
||||||
|
|
||||||
|
|
||||||
|
// "conferenceProperties": {
|
||||||
|
// "allowedConferenceSolutionTypes": [
|
||||||
|
// "hangoutsMeet"
|
||||||
|
// ]
|
||||||
|
|
||||||
|
// Get all the calendars to display them to user so that he can
|
||||||
|
// select them easily
|
||||||
|
async getConferenceSolutations(
|
||||||
|
this: ILoadOptionsFunctions
|
||||||
|
): Promise<INodePropertyOptions[]> {
|
||||||
|
const returnData: INodePropertyOptions[] = [];
|
||||||
|
const calendar = this.getCurrentNodeParameter('calendar') as string;
|
||||||
|
const posibleSolutions: IDataObject = {
|
||||||
|
'eventHangout': 'Google Hangout',
|
||||||
|
'eventNamedHangout': 'Google Hangout Classic',
|
||||||
|
'hangoutsMeet': 'Google Meet',
|
||||||
|
};
|
||||||
|
const { conferenceProperties: { allowedConferenceSolutionTypes } } = await googleApiRequest.call(
|
||||||
|
this,
|
||||||
|
'GET',
|
||||||
|
`/calendar/v3/users/me/calendarList/${calendar}`,
|
||||||
|
);
|
||||||
|
for (const solution of allowedConferenceSolutionTypes) {
|
||||||
|
returnData.push({
|
||||||
|
name: posibleSolutions[solution] as string,
|
||||||
|
value: solution,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return returnData;
|
||||||
|
},
|
||||||
// Get all the calendars to display them to user so that he can
|
// Get all the calendars to display them to user so that he can
|
||||||
// select them easily
|
// select them easily
|
||||||
async getCalendars(
|
async getCalendars(
|
||||||
|
@ -265,6 +299,23 @@ export class GoogleCalendar implements INodeType {
|
||||||
if (body.recurrence.length !== 0) {
|
if (body.recurrence.length !== 0) {
|
||||||
body.recurrence = [`RRULE:${body.recurrence.join('')}`];
|
body.recurrence = [`RRULE:${body.recurrence.join('')}`];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (additionalFields.conferenceDataUi) {
|
||||||
|
const conferenceData = (additionalFields.conferenceDataUi as IDataObject).conferenceDataValues as IDataObject;
|
||||||
|
if (conferenceData) {
|
||||||
|
|
||||||
|
qs.conferenceDataVersion = 1;
|
||||||
|
body.conferenceData = {
|
||||||
|
createRequest: {
|
||||||
|
requestId: uuid(),
|
||||||
|
conferenceSolution: {
|
||||||
|
type: conferenceData.conferenceSolution as string,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
responseData = await googleApiRequest.call(
|
responseData = await googleApiRequest.call(
|
||||||
this,
|
this,
|
||||||
'POST',
|
'POST',
|
||||||
|
|
Loading…
Reference in a new issue