2020-06-22 18:39:21 -07:00
|
|
|
import {
|
|
|
|
IExecuteFunctions,
|
|
|
|
} from 'n8n-core';
|
2020-06-16 17:46:38 -07:00
|
|
|
import {
|
|
|
|
IDataObject,
|
|
|
|
INodeExecutionData,
|
|
|
|
INodeType,
|
2020-06-22 11:51:15 -07:00
|
|
|
ILoadOptionsFunctions,
|
2020-06-18 12:29:16 -07:00
|
|
|
INodeTypeDescription,
|
2020-06-22 11:51:15 -07:00
|
|
|
INodePropertyOptions,
|
2020-06-16 17:46:38 -07:00
|
|
|
} from 'n8n-workflow';
|
|
|
|
import {
|
|
|
|
zoomApiRequest,
|
|
|
|
zoomApiRequestAllItems,
|
|
|
|
} from './GenericFunctions';
|
2020-06-18 12:29:16 -07:00
|
|
|
|
|
|
|
import {
|
|
|
|
meetingOperations,
|
|
|
|
meetingFields,
|
2020-06-22 11:51:15 -07:00
|
|
|
} from './MeetingDescription';
|
|
|
|
|
|
|
|
import {
|
|
|
|
meetingRegistrantOperations,
|
|
|
|
meetingRegistrantFields,
|
|
|
|
|
|
|
|
} from './MeetingRegistrantDescription';
|
|
|
|
|
2020-06-22 18:39:21 -07:00
|
|
|
import {
|
|
|
|
webinarOperations,
|
|
|
|
webinarFields,
|
|
|
|
} from './WebinarDescription';
|
2020-06-23 12:27:47 -07:00
|
|
|
|
2020-06-22 11:51:15 -07:00
|
|
|
import * as moment from 'moment-timezone';
|
|
|
|
|
|
|
|
interface Settings {
|
|
|
|
host_video?: boolean;
|
|
|
|
participant_video?: boolean;
|
2020-06-22 18:39:21 -07:00
|
|
|
panelists_video?: boolean;
|
2020-06-22 11:51:15 -07:00
|
|
|
cn_meeting?: boolean;
|
|
|
|
in_meeting?: boolean;
|
|
|
|
join_before_host?: boolean;
|
|
|
|
mute_upon_entry?: boolean;
|
|
|
|
watermark?: boolean;
|
|
|
|
audio?: string;
|
|
|
|
alternative_hosts?: string;
|
|
|
|
auto_recording?: string;
|
|
|
|
registration_type?: number;
|
2020-06-22 18:39:21 -07:00
|
|
|
approval_type?: number;
|
|
|
|
practice_session?: boolean;
|
2020-06-22 11:51:15 -07:00
|
|
|
}
|
2020-06-16 17:46:38 -07:00
|
|
|
export class Zoom implements INodeType {
|
|
|
|
description: INodeTypeDescription = {
|
|
|
|
displayName: 'Zoom',
|
|
|
|
name: 'zoom',
|
|
|
|
group: ['input'],
|
|
|
|
version: 1,
|
|
|
|
description: 'Consume Zoom API',
|
2020-06-17 11:16:31 -07:00
|
|
|
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
2020-06-16 17:46:38 -07:00
|
|
|
defaults: {
|
|
|
|
name: 'Zoom',
|
2020-06-22 11:51:15 -07:00
|
|
|
color: '#0B6CF9'
|
2020-06-16 17:46:38 -07:00
|
|
|
},
|
2020-06-17 11:16:31 -07:00
|
|
|
icon: 'file:zoom.png',
|
2020-06-16 17:46:38 -07:00
|
|
|
inputs: ['main'],
|
|
|
|
outputs: ['main'],
|
|
|
|
credentials: [
|
|
|
|
{
|
|
|
|
name: 'zoomApi',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2020-06-18 12:29:16 -07:00
|
|
|
authentication: [
|
|
|
|
'accessToken',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2020-06-16 17:46:38 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'zoomOAuth2Api',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2020-06-18 12:29:16 -07:00
|
|
|
authentication: [
|
|
|
|
'oAuth2',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2020-06-16 17:46:38 -07:00
|
|
|
],
|
|
|
|
properties: [
|
|
|
|
{
|
|
|
|
displayName: 'Authentication',
|
|
|
|
name: 'authentication',
|
|
|
|
type: 'options',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Access Token',
|
2020-06-18 12:29:16 -07:00
|
|
|
value: 'accessToken',
|
2020-06-16 17:46:38 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'OAuth2',
|
2020-06-18 12:29:16 -07:00
|
|
|
value: 'oAuth2',
|
|
|
|
},
|
2020-06-16 17:46:38 -07:00
|
|
|
],
|
|
|
|
default: 'accessToken',
|
2020-06-18 12:29:16 -07:00
|
|
|
description: 'The resource to operate on.',
|
2020-06-17 11:16:31 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Resource',
|
|
|
|
name: 'resource',
|
|
|
|
type: 'options',
|
|
|
|
options: [
|
|
|
|
{
|
2020-06-18 12:29:16 -07:00
|
|
|
name: 'Meeting',
|
2020-06-17 11:16:31 -07:00
|
|
|
value: 'meeting'
|
2020-06-22 11:51:15 -07:00
|
|
|
},
|
|
|
|
{
|
2020-06-22 18:39:21 -07:00
|
|
|
name: 'Meeting Registrant',
|
2020-06-22 11:51:15 -07:00
|
|
|
value: 'meetingRegistrants'
|
2020-06-22 18:39:21 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Webinar',
|
|
|
|
value: 'webinar'
|
2020-06-17 11:16:31 -07:00
|
|
|
}
|
|
|
|
],
|
|
|
|
default: 'meeting',
|
|
|
|
description: 'The resource to operate on.'
|
2020-06-18 12:29:16 -07:00
|
|
|
},
|
2020-06-22 18:39:21 -07:00
|
|
|
//MEETINGS
|
2020-06-18 12:29:16 -07:00
|
|
|
...meetingOperations,
|
2020-06-22 11:51:15 -07:00
|
|
|
...meetingFields,
|
2020-06-22 18:39:21 -07:00
|
|
|
|
|
|
|
//MEETING REGISTRANTS
|
2020-06-22 11:51:15 -07:00
|
|
|
...meetingRegistrantOperations,
|
|
|
|
...meetingRegistrantFields,
|
2020-06-22 18:39:21 -07:00
|
|
|
|
|
|
|
//WEBINARS
|
|
|
|
...webinarOperations,
|
|
|
|
...webinarFields,
|
2020-06-16 17:46:38 -07:00
|
|
|
]
|
2020-06-18 12:29:16 -07:00
|
|
|
|
2020-06-16 17:46:38 -07:00
|
|
|
};
|
2020-06-22 11:51:15 -07:00
|
|
|
methods = {
|
|
|
|
loadOptions: {
|
|
|
|
// Get all the timezones to display them to user so that he can select them easily
|
|
|
|
async getTimezones(
|
|
|
|
this: ILoadOptionsFunctions
|
|
|
|
): Promise<INodePropertyOptions[]> {
|
|
|
|
const returnData: INodePropertyOptions[] = [];
|
|
|
|
for (const timezone of moment.tz.names()) {
|
|
|
|
const timezoneName = timezone;
|
|
|
|
const timezoneId = timezone;
|
|
|
|
returnData.push({
|
|
|
|
name: timezoneName,
|
|
|
|
value: timezoneId
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return returnData;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2020-06-16 17:46:38 -07:00
|
|
|
|
|
|
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
|
|
|
const items = this.getInputData();
|
|
|
|
const returnData: IDataObject[] = [];
|
2020-06-23 14:26:00 -07:00
|
|
|
let qs: IDataObject = {};
|
|
|
|
let body: IDataObject = {};
|
2020-06-16 17:46:38 -07:00
|
|
|
let responseData;
|
|
|
|
const resource = this.getNodeParameter('resource', 0) as string;
|
2020-06-18 12:29:16 -07:00
|
|
|
const operation = this.getNodeParameter('operation', 0) as string;
|
2020-06-23 14:26:00 -07:00
|
|
|
|
|
|
|
for (let i = 0; i < items.length; i++) {
|
2020-06-18 12:29:16 -07:00
|
|
|
qs = {};
|
2020-06-22 18:39:21 -07:00
|
|
|
//https://marketplace.zoom.us/docs/api-reference/zoom-api/
|
2020-06-18 12:29:16 -07:00
|
|
|
if (resource === 'meeting') {
|
|
|
|
|
|
|
|
if (operation === 'get') {
|
2020-06-22 11:51:15 -07:00
|
|
|
//https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meeting
|
2020-06-22 18:39:21 -07:00
|
|
|
const meetingId = this.getNodeParameter('meetingId', i) as string;
|
|
|
|
const additionalFields = this.getNodeParameter(
|
|
|
|
'additionalFields',
|
|
|
|
i
|
|
|
|
) as IDataObject;
|
2020-06-23 13:40:43 -07:00
|
|
|
if (additionalFields.showPreviousOccurrences) {
|
|
|
|
qs.show_previous_occurrences = additionalFields.showPreviousOccurrences as boolean;
|
2020-06-22 18:39:21 -07:00
|
|
|
|
2020-06-23 12:14:04 -07:00
|
|
|
}
|
|
|
|
|
2020-06-23 13:40:43 -07:00
|
|
|
if (additionalFields.occurrenceId) {
|
|
|
|
qs.occurrence_id = additionalFields.occurrenceId as string;
|
2020-06-18 12:29:16 -07:00
|
|
|
|
2020-06-23 12:14:04 -07:00
|
|
|
}
|
|
|
|
|
2020-06-18 12:29:16 -07:00
|
|
|
responseData = await zoomApiRequest.call(
|
|
|
|
this,
|
|
|
|
'GET',
|
2020-06-22 18:39:21 -07:00
|
|
|
`/meetings/${meetingId}`,
|
2020-06-18 12:29:16 -07:00
|
|
|
{},
|
|
|
|
qs
|
|
|
|
);
|
|
|
|
}
|
2020-06-22 11:51:15 -07:00
|
|
|
if (operation === 'getAll') {
|
|
|
|
//https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetings
|
|
|
|
const userId = this.getNodeParameter('userId', i) as string;
|
2020-06-22 18:39:21 -07:00
|
|
|
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
2020-06-23 20:29:47 -07:00
|
|
|
|
|
|
|
const additionalFields = this.getNodeParameter(
|
|
|
|
'additionalFields',
|
|
|
|
i
|
|
|
|
) as IDataObject;
|
|
|
|
if (additionalFields.type) {
|
|
|
|
qs.type = additionalFields.type as string;
|
|
|
|
|
|
|
|
}
|
2020-06-22 18:39:21 -07:00
|
|
|
if (returnAll) {
|
2020-06-23 20:29:47 -07:00
|
|
|
responseData = await zoomApiRequestAllItems.call(this, 'meetings', 'GET', `/users/${userId}/meetings`, {}, qs);
|
2020-06-22 18:39:21 -07:00
|
|
|
} else {
|
2020-06-23 20:29:47 -07:00
|
|
|
qs.page_size = this.getNodeParameter('limit', i) as number;;
|
2020-06-22 18:39:21 -07:00
|
|
|
responseData = await zoomApiRequest.call(this, 'GET', `/users/${userId}/meetings`, {}, qs);
|
2020-06-23 20:29:47 -07:00
|
|
|
|
2020-06-22 18:39:21 -07:00
|
|
|
}
|
2020-06-22 11:51:15 -07:00
|
|
|
|
|
|
|
}
|
|
|
|
if (operation === 'delete') {
|
|
|
|
//https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingdelete
|
|
|
|
const meetingId = this.getNodeParameter('meetingId', i) as string;
|
2020-06-22 18:39:21 -07:00
|
|
|
const additionalFields = this.getNodeParameter(
|
|
|
|
'additionalFields',
|
|
|
|
i
|
|
|
|
) as IDataObject;
|
2020-06-23 12:14:04 -07:00
|
|
|
if (additionalFields.scheduleForReminder) {
|
2020-06-22 18:39:21 -07:00
|
|
|
qs.schedule_for_reminder = additionalFields.scheduleForReminder as boolean;
|
|
|
|
|
2020-06-23 12:14:04 -07:00
|
|
|
}
|
|
|
|
|
2020-06-23 13:40:43 -07:00
|
|
|
if (additionalFields.occurrenceId) {
|
|
|
|
qs.occurrence_id = additionalFields.occurrenceId;
|
2020-06-22 18:39:21 -07:00
|
|
|
|
2020-06-23 12:14:04 -07:00
|
|
|
}
|
|
|
|
|
2020-06-22 11:51:15 -07:00
|
|
|
responseData = await zoomApiRequest.call(
|
|
|
|
this,
|
|
|
|
'DELETE',
|
|
|
|
`/meetings/${meetingId}`,
|
|
|
|
{},
|
|
|
|
qs
|
|
|
|
);
|
|
|
|
responseData = { success: true };
|
|
|
|
}
|
|
|
|
if (operation === 'create') {
|
|
|
|
//https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingcreate
|
|
|
|
const userId = this.getNodeParameter('userId', i) as string;
|
|
|
|
const additionalFields = this.getNodeParameter(
|
|
|
|
'additionalFields',
|
|
|
|
i
|
|
|
|
) as IDataObject;
|
|
|
|
const settings: Settings = {};
|
|
|
|
if (additionalFields.cn_meeting) {
|
|
|
|
settings.cn_meeting = additionalFields.cn_meeting as boolean;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.in_meeting) {
|
|
|
|
settings.in_meeting = additionalFields.in_meeting as boolean;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.join_before_host) {
|
|
|
|
settings.join_before_host = additionalFields.join_before_host as boolean;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.mute_upon_entry) {
|
|
|
|
settings.mute_upon_entry = additionalFields.mute_upon_entry as boolean;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.watermark) {
|
|
|
|
settings.watermark = additionalFields.watermark as boolean;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.audio) {
|
|
|
|
settings.audio = additionalFields.audio as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.alternative_hosts) {
|
|
|
|
settings.alternative_hosts = additionalFields.alternative_hosts as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.participant_video) {
|
|
|
|
settings.participant_video = additionalFields.participant_video as boolean;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.host_video) {
|
|
|
|
settings.host_video = additionalFields.host_video as boolean;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.auto_recording) {
|
|
|
|
settings.auto_recording = additionalFields.auto_recording as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.registration_type) {
|
|
|
|
settings.registration_type = additionalFields.registration_type as number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
body = {
|
|
|
|
settings,
|
|
|
|
};
|
|
|
|
|
|
|
|
if (additionalFields.topic) {
|
|
|
|
body.topic = additionalFields.topic as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.type) {
|
|
|
|
body.type = additionalFields.type as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.startTime) {
|
|
|
|
body.start_time = additionalFields.startTime as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.duration) {
|
|
|
|
body.duration = additionalFields.duration as number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.scheduleFor) {
|
|
|
|
body.schedule_for = additionalFields.scheduleFor as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.timeZone) {
|
|
|
|
body.timezone = additionalFields.timeZone as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.password) {
|
|
|
|
body.password = additionalFields.password as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.agenda) {
|
|
|
|
body.agenda = additionalFields.agenda as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
responseData = await zoomApiRequest.call(
|
|
|
|
this,
|
|
|
|
'POST',
|
|
|
|
`/users/${userId}/meetings`,
|
|
|
|
body,
|
|
|
|
qs
|
|
|
|
);
|
|
|
|
}
|
|
|
|
if (operation === 'update') {
|
|
|
|
//https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingupdate
|
|
|
|
const meetingId = this.getNodeParameter('meetingId', i) as string;
|
2020-06-22 18:39:21 -07:00
|
|
|
const settings: Settings = {};
|
2020-06-22 11:51:15 -07:00
|
|
|
const additionalFields = this.getNodeParameter(
|
|
|
|
'additionalFields',
|
|
|
|
i
|
|
|
|
) as IDataObject;
|
2020-06-22 18:39:21 -07:00
|
|
|
|
2020-06-23 13:40:43 -07:00
|
|
|
if (additionalFields.occurrenceId) {
|
|
|
|
qs.occurrence_id = additionalFields.occurrenceId as string;
|
2020-06-22 18:39:21 -07:00
|
|
|
}
|
|
|
|
|
2020-06-22 11:51:15 -07:00
|
|
|
if (additionalFields.cn_meeting) {
|
|
|
|
settings.cn_meeting = additionalFields.cn_meeting as boolean;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.in_meeting) {
|
|
|
|
settings.in_meeting = additionalFields.in_meeting as boolean;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.join_before_host) {
|
|
|
|
settings.join_before_host = additionalFields.join_before_host as boolean;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.mute_upon_entry) {
|
|
|
|
settings.mute_upon_entry = additionalFields.mute_upon_entry as boolean;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.watermark) {
|
|
|
|
settings.watermark = additionalFields.watermark as boolean;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.audio) {
|
|
|
|
settings.audio = additionalFields.audio as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.alternative_hosts) {
|
|
|
|
settings.alternative_hosts = additionalFields.alternative_hosts as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.participant_video) {
|
|
|
|
settings.participant_video = additionalFields.participant_video as boolean;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.host_video) {
|
|
|
|
settings.host_video = additionalFields.host_video as boolean;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.auto_recording) {
|
|
|
|
settings.auto_recording = additionalFields.auto_recording as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.registration_type) {
|
|
|
|
settings.registration_type = additionalFields.registration_type as number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
body = {
|
|
|
|
settings,
|
|
|
|
};
|
|
|
|
if (additionalFields.topic) {
|
|
|
|
body.topic = additionalFields.topic as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.type) {
|
|
|
|
body.type = additionalFields.type as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.startTime) {
|
|
|
|
body.start_time = additionalFields.startTime as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.duration) {
|
|
|
|
body.duration = additionalFields.duration as number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.scheduleFor) {
|
|
|
|
body.schedule_for = additionalFields.scheduleFor as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.timeZone) {
|
|
|
|
body.timezone = additionalFields.timeZone as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.password) {
|
|
|
|
body.password = additionalFields.password as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.agenda) {
|
|
|
|
body.agenda = additionalFields.agenda as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
responseData = await zoomApiRequest.call(
|
|
|
|
this,
|
|
|
|
'PATCH',
|
|
|
|
`/meetings/${meetingId}`,
|
|
|
|
body,
|
|
|
|
qs
|
|
|
|
);
|
2020-06-22 18:39:21 -07:00
|
|
|
responseData = { updated: true };
|
|
|
|
|
2020-06-22 11:51:15 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (resource === 'meetingRegistrant') {
|
|
|
|
if (operation === 'create') {
|
|
|
|
//https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingregistrantcreate
|
|
|
|
const meetingId = this.getNodeParameter('meetingId', i) as string;
|
2020-06-22 18:39:21 -07:00
|
|
|
const emailId = this.getNodeParameter('email', i) as string;
|
|
|
|
body.email = emailId;
|
|
|
|
const firstName = this.getNodeParameter('firstName', i) as string;
|
|
|
|
body.first_name = firstName;
|
|
|
|
const additionalFields = this.getNodeParameter(
|
|
|
|
'additionalFields',
|
|
|
|
i
|
|
|
|
) as IDataObject;
|
2020-06-23 13:40:43 -07:00
|
|
|
if (additionalFields.occurrenceId) {
|
|
|
|
qs.occurrence_ids = additionalFields.occurrenceId as string;
|
2020-06-22 18:39:21 -07:00
|
|
|
}
|
|
|
|
if (additionalFields.lastName) {
|
|
|
|
body.last_name = additionalFields.lastName as string;
|
|
|
|
}
|
|
|
|
if (additionalFields.address) {
|
|
|
|
body.address = additionalFields.address as string;
|
|
|
|
}
|
|
|
|
if (additionalFields.city) {
|
|
|
|
body.city = additionalFields.city as string;
|
|
|
|
}
|
|
|
|
if (additionalFields.state) {
|
|
|
|
body.state = additionalFields.state as string;
|
|
|
|
}
|
|
|
|
if (additionalFields.country) {
|
|
|
|
body.country = additionalFields.country as string;
|
|
|
|
}
|
|
|
|
if (additionalFields.zip) {
|
|
|
|
body.zip = additionalFields.zip as string;
|
|
|
|
}
|
|
|
|
if (additionalFields.phone) {
|
|
|
|
body.phone = additionalFields.phone as string;
|
|
|
|
}
|
|
|
|
if (additionalFields.comments) {
|
|
|
|
body.comments = additionalFields.comments as string;
|
|
|
|
}
|
|
|
|
if (additionalFields.org) {
|
|
|
|
body.org = additionalFields.org as string;
|
|
|
|
}
|
|
|
|
if (additionalFields.job_title) {
|
|
|
|
body.job_title = additionalFields.job_title as string;
|
|
|
|
}
|
|
|
|
if (additionalFields.purchasing_time_frame) {
|
|
|
|
body.purchasing_time_frame = additionalFields.purchasing_time_frame as string;
|
|
|
|
}
|
|
|
|
if (additionalFields.role_in_purchase_process) {
|
|
|
|
body.role_in_purchase_process = additionalFields.role_in_purchase_process as string;
|
|
|
|
}
|
2020-06-22 11:51:15 -07:00
|
|
|
responseData = await zoomApiRequest.call(
|
|
|
|
this,
|
2020-06-22 18:39:21 -07:00
|
|
|
'POST',
|
2020-06-22 11:51:15 -07:00
|
|
|
`/meetings/${meetingId}/registrants`,
|
|
|
|
body,
|
|
|
|
qs
|
|
|
|
);
|
|
|
|
}
|
|
|
|
if (operation === 'getAll') {
|
|
|
|
//https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingregistrants
|
2020-06-22 18:39:21 -07:00
|
|
|
const meetingId = this.getNodeParameter('meetingId', i) as string;
|
|
|
|
const additionalFields = this.getNodeParameter(
|
|
|
|
'additionalFields',
|
|
|
|
i
|
|
|
|
) as IDataObject;
|
2020-06-23 13:40:43 -07:00
|
|
|
if (additionalFields.occurrenceId) {
|
|
|
|
qs.occurrence_id = additionalFields.occurrenceId as string;
|
2020-06-22 18:39:21 -07:00
|
|
|
}
|
|
|
|
if (additionalFields.status) {
|
|
|
|
qs.status = additionalFields.status as string;
|
|
|
|
}
|
|
|
|
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
|
|
|
if (returnAll) {
|
|
|
|
responseData = await zoomApiRequestAllItems.call(this, 'results', 'GET', `/meetings/${meetingId}/registrants`, {}, qs);
|
|
|
|
} else {
|
|
|
|
const limit = this.getNodeParameter('limit', i) as number;
|
|
|
|
qs.page_size = limit;
|
|
|
|
responseData = await zoomApiRequest.call(this, 'GET', `/meetings/${meetingId}/registrants`, {}, qs);
|
|
|
|
responseData = responseData.results;
|
|
|
|
}
|
|
|
|
|
2020-06-22 11:51:15 -07:00
|
|
|
}
|
|
|
|
if (operation === 'update') {
|
|
|
|
//https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingregistrantstatus
|
2020-06-22 18:39:21 -07:00
|
|
|
const meetingId = this.getNodeParameter('meetingId', i) as string;
|
|
|
|
const additionalFields = this.getNodeParameter(
|
|
|
|
'additionalFields',
|
|
|
|
i
|
|
|
|
) as IDataObject;
|
|
|
|
if (additionalFields.occurenceId) {
|
2020-06-23 13:40:43 -07:00
|
|
|
qs.occurrence_id = additionalFields.occurrenceId as string;
|
2020-06-22 18:39:21 -07:00
|
|
|
}
|
|
|
|
responseData = await zoomApiRequest.call(
|
|
|
|
this,
|
|
|
|
'PUT',
|
|
|
|
`/meetings/${meetingId}/registrants/status`,
|
|
|
|
body,
|
|
|
|
qs
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (resource === 'webinar') {
|
|
|
|
if (operation === 'create') {
|
|
|
|
//https://marketplace.zoom.us/docs/api-reference/zoom-api/webinars/webinarcreate
|
|
|
|
const userId = this.getNodeParameter('userId', i) as string;
|
|
|
|
const additionalFields = this.getNodeParameter(
|
|
|
|
'additionalFields',
|
|
|
|
i
|
|
|
|
) as IDataObject;
|
|
|
|
const settings: Settings = {};
|
|
|
|
|
|
|
|
|
|
|
|
if (additionalFields.audio) {
|
|
|
|
settings.audio = additionalFields.audio as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.alternative_hosts) {
|
|
|
|
settings.alternative_hosts = additionalFields.alternative_hosts as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.panelists_video) {
|
|
|
|
settings.panelists_video = additionalFields.panelists_video as boolean;
|
|
|
|
|
|
|
|
}
|
|
|
|
if (additionalFields.practice_session) {
|
|
|
|
settings.practice_session = additionalFields.practice_session as boolean;
|
|
|
|
|
|
|
|
}
|
|
|
|
if (additionalFields.auto_recording) {
|
|
|
|
settings.auto_recording = additionalFields.auto_recording as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.registration_type) {
|
|
|
|
settings.registration_type = additionalFields.registration_type as number;
|
|
|
|
|
|
|
|
}
|
|
|
|
if (additionalFields.approval_type) {
|
|
|
|
settings.approval_type = additionalFields.approval_type as number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
body = {
|
|
|
|
settings,
|
|
|
|
};
|
|
|
|
|
|
|
|
if (additionalFields.topic) {
|
|
|
|
body.topic = additionalFields.topic as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.type) {
|
|
|
|
body.type = additionalFields.type as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.startTime) {
|
|
|
|
body.start_time = additionalFields.startTime as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.duration) {
|
|
|
|
body.duration = additionalFields.duration as number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (additionalFields.timeZone) {
|
|
|
|
body.timezone = additionalFields.timeZone as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.password) {
|
|
|
|
body.password = additionalFields.password as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.agenda) {
|
|
|
|
body.agenda = additionalFields.agenda as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
responseData = await zoomApiRequest.call(
|
|
|
|
this,
|
|
|
|
'POST',
|
|
|
|
`/users/${userId}/webinars`,
|
|
|
|
body,
|
|
|
|
qs
|
|
|
|
);
|
|
|
|
}
|
|
|
|
if (operation === 'get') {
|
|
|
|
//https://marketplace.zoom.us/docs/api-reference/zoom-api/webinars/webinar
|
|
|
|
const webinarId = this.getNodeParameter('webinarId', i) as string;
|
|
|
|
|
|
|
|
const additionalFields = this.getNodeParameter(
|
|
|
|
'additionalFields',
|
|
|
|
i
|
|
|
|
) as IDataObject;
|
2020-06-23 13:40:43 -07:00
|
|
|
if (additionalFields.showPreviousOccurrences) {
|
|
|
|
qs.show_previous_occurrences = additionalFields.showPreviousOccurrences as boolean;
|
2020-06-22 18:39:21 -07:00
|
|
|
|
2020-06-23 12:14:04 -07:00
|
|
|
}
|
|
|
|
|
2020-06-23 13:40:43 -07:00
|
|
|
if (additionalFields.occurrenceId) {
|
|
|
|
qs.occurrence_id = additionalFields.occurrenceId as string;
|
2020-06-22 18:39:21 -07:00
|
|
|
|
2020-06-23 12:14:04 -07:00
|
|
|
}
|
|
|
|
|
2020-06-22 18:39:21 -07:00
|
|
|
responseData = await zoomApiRequest.call(
|
|
|
|
this,
|
|
|
|
'GET',
|
|
|
|
`/webinars/${webinarId}`,
|
|
|
|
{},
|
|
|
|
qs
|
|
|
|
);
|
|
|
|
}
|
|
|
|
if (operation === 'getAll') {
|
|
|
|
//https://marketplace.zoom.us/docs/api-reference/zoom-api/webinars/webinars
|
|
|
|
const userId = this.getNodeParameter('userId', i) as string;
|
|
|
|
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
|
|
|
if (returnAll) {
|
|
|
|
responseData = await zoomApiRequestAllItems.call(this, 'results', 'GET', `/users/${userId}/webinars`, {}, qs);
|
|
|
|
} else {
|
|
|
|
const limit = this.getNodeParameter('limit', i) as number;
|
|
|
|
qs.page_size = limit;
|
|
|
|
responseData = await zoomApiRequest.call(this, 'GET', `/users/${userId}/webinars`, {}, qs);
|
|
|
|
responseData = responseData.results;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (operation === 'delete') {
|
|
|
|
//https://marketplace.zoom.us/docs/api-reference/zoom-api/webinars/webinardelete
|
|
|
|
const webinarId = this.getNodeParameter('webinarId', i) as string;
|
|
|
|
const additionalFields = this.getNodeParameter(
|
|
|
|
'additionalFields',
|
|
|
|
i
|
|
|
|
) as IDataObject;
|
|
|
|
|
|
|
|
|
2020-06-23 13:40:43 -07:00
|
|
|
if (additionalFields.occurrenceId) {
|
|
|
|
qs.occurrence_id = additionalFields.occurrenceId;
|
2020-06-22 18:39:21 -07:00
|
|
|
|
2020-06-23 12:14:04 -07:00
|
|
|
}
|
|
|
|
|
2020-06-22 18:39:21 -07:00
|
|
|
responseData = await zoomApiRequest.call(
|
|
|
|
this,
|
|
|
|
'DELETE',
|
|
|
|
`/webinars/${webinarId}`,
|
|
|
|
{},
|
|
|
|
qs
|
|
|
|
);
|
|
|
|
responseData = { success: true };
|
|
|
|
}
|
|
|
|
if (operation === 'update') {
|
|
|
|
//https://marketplace.zoom.us/docs/api-reference/zoom-api/webinars/webinarupdate
|
|
|
|
const webinarId = this.getNodeParameter('webinarId', i) as string;
|
|
|
|
const additionalFields = this.getNodeParameter(
|
|
|
|
'additionalFields',
|
|
|
|
i
|
|
|
|
) as IDataObject;
|
2020-06-23 13:40:43 -07:00
|
|
|
if (additionalFields.occurrence_id) {
|
|
|
|
qs.occurrence_id = additionalFields.occurrence_id as string;
|
2020-06-22 18:39:21 -07:00
|
|
|
|
|
|
|
}
|
|
|
|
const settings: Settings = {};
|
|
|
|
if (additionalFields.audio) {
|
|
|
|
settings.audio = additionalFields.audio as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
if (additionalFields.alternative_hosts) {
|
|
|
|
settings.alternative_hosts = additionalFields.alternative_hosts as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.panelists_video) {
|
|
|
|
settings.panelists_video = additionalFields.panelists_video as boolean;
|
|
|
|
|
|
|
|
}
|
|
|
|
if (additionalFields.practice_session) {
|
|
|
|
settings.practice_session = additionalFields.practice_session as boolean;
|
|
|
|
|
|
|
|
}
|
|
|
|
if (additionalFields.auto_recording) {
|
|
|
|
settings.auto_recording = additionalFields.auto_recording as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.registration_type) {
|
|
|
|
settings.registration_type = additionalFields.registration_type as number;
|
|
|
|
|
|
|
|
}
|
|
|
|
if (additionalFields.approval_type) {
|
|
|
|
settings.approval_type = additionalFields.approval_type as number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
body = {
|
|
|
|
settings,
|
|
|
|
};
|
|
|
|
|
|
|
|
if (additionalFields.topic) {
|
|
|
|
body.topic = additionalFields.topic as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.type) {
|
|
|
|
body.type = additionalFields.type as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.startTime) {
|
|
|
|
body.start_time = additionalFields.startTime as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.duration) {
|
|
|
|
body.duration = additionalFields.duration as number;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (additionalFields.timeZone) {
|
|
|
|
body.timezone = additionalFields.timeZone as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.password) {
|
|
|
|
body.password = additionalFields.password as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (additionalFields.agenda) {
|
|
|
|
body.agenda = additionalFields.agenda as string;
|
|
|
|
|
|
|
|
}
|
|
|
|
responseData = await zoomApiRequest.call(
|
|
|
|
this,
|
|
|
|
'PATCH',
|
|
|
|
`/users/${webinarId}/webinars`,
|
|
|
|
body,
|
|
|
|
qs
|
|
|
|
);
|
2020-06-22 11:51:15 -07:00
|
|
|
}
|
2020-06-18 12:29:16 -07:00
|
|
|
}
|
|
|
|
}
|
2020-06-16 17:46:38 -07:00
|
|
|
if (Array.isArray(responseData)) {
|
|
|
|
returnData.push.apply(returnData, responseData as IDataObject[]);
|
|
|
|
} else {
|
|
|
|
returnData.push(responseData as IDataObject);
|
|
|
|
}
|
|
|
|
|
|
|
|
return [this.helpers.returnJsonArray(returnData)];
|
|
|
|
}
|
|
|
|
}
|