mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-26 05:04:05 -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: '',
|
||||
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',
|
||||
name: 'description',
|
||||
|
|
|
@ -7,6 +7,15 @@ export interface IReminder {
|
|||
overrides?: IDataObject[];
|
||||
}
|
||||
|
||||
export interface IConferenceData {
|
||||
createRequest?: {
|
||||
requestId: string,
|
||||
conferenceSolution: {
|
||||
type: string,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export interface IEvent {
|
||||
attendees?: IDataObject[];
|
||||
colorId?: string;
|
||||
|
@ -25,4 +34,5 @@ export interface IEvent {
|
|||
summary?: string;
|
||||
transparency?: string;
|
||||
visibility?: string;
|
||||
conferenceData?: IConferenceData;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@ import {
|
|||
|
||||
import * as moment from 'moment-timezone';
|
||||
|
||||
import * as uuid from 'uuid/v4';
|
||||
|
||||
export class GoogleCalendar implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'Google Calendar',
|
||||
|
@ -69,6 +71,38 @@ export class GoogleCalendar implements INodeType {
|
|||
|
||||
methods = {
|
||||
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
|
||||
// select them easily
|
||||
async getCalendars(
|
||||
|
@ -265,6 +299,23 @@ export class GoogleCalendar implements INodeType {
|
|||
if (body.recurrence.length !== 0) {
|
||||
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(
|
||||
this,
|
||||
'POST',
|
||||
|
|
Loading…
Reference in a new issue