From 355ccc3201f388b6c0160b8f53339e8fd571845b Mon Sep 17 00:00:00 2001 From: shraddha shaligram Date: Tue, 16 Jun 2020 17:46:38 -0700 Subject: [PATCH 01/20] add authentication --- .../credentials/ZoomApi.credentials.ts | 14 ++ .../credentials/ZoomOAuth2Api.credentials.ts | 50 +++++++ .../nodes-base/nodes/Zoom/GenericFunctions.ts | 128 ++++++++++++++++++ packages/nodes-base/nodes/Zoom/Zoom.node.ts | 103 ++++++++++++++ packages/nodes-base/nodes/Zoom/zoom.png | Bin 0 -> 1848 bytes packages/nodes-base/package.json | 3 + 6 files changed, 298 insertions(+) create mode 100644 packages/nodes-base/credentials/ZoomApi.credentials.ts create mode 100644 packages/nodes-base/credentials/ZoomOAuth2Api.credentials.ts create mode 100644 packages/nodes-base/nodes/Zoom/GenericFunctions.ts create mode 100644 packages/nodes-base/nodes/Zoom/Zoom.node.ts create mode 100644 packages/nodes-base/nodes/Zoom/zoom.png diff --git a/packages/nodes-base/credentials/ZoomApi.credentials.ts b/packages/nodes-base/credentials/ZoomApi.credentials.ts new file mode 100644 index 0000000000..3db4aadbe0 --- /dev/null +++ b/packages/nodes-base/credentials/ZoomApi.credentials.ts @@ -0,0 +1,14 @@ +import { ICredentialType, NodePropertyTypes } from 'n8n-workflow'; + +export class ZoomApi implements ICredentialType { + name = 'zoomApi'; + displayName = 'Zoom API'; + properties = [ + { + displayName: 'Access Token', + name: 'accessToken', + type: 'string' as NodePropertyTypes, + default: '' + } + ]; +} diff --git a/packages/nodes-base/credentials/ZoomOAuth2Api.credentials.ts b/packages/nodes-base/credentials/ZoomOAuth2Api.credentials.ts new file mode 100644 index 0000000000..2b05c819a7 --- /dev/null +++ b/packages/nodes-base/credentials/ZoomOAuth2Api.credentials.ts @@ -0,0 +1,50 @@ +import { ICredentialType, NodePropertyTypes } from 'n8n-workflow'; + +const userScopes = [ + 'meeting:read', + 'meeting:write', + 'user:read', + 'user:write', + 'user_profile', + 'webinar:read', + 'webinar:write' +]; + +export class ZoomOAuth2Api implements ICredentialType { + name = 'zoomOAuth2Api'; + extends = ['oAuth2Api']; + displayName = 'Zoom OAuth2 API'; + properties = [ + { + displayName: 'Authorization URL', + name: 'authUrl', + type: 'hidden' as NodePropertyTypes, + default: 'https://zoom.us/oauth/authorize' + }, + { + displayName: 'Access Token URL', + name: 'accessTokenUrl', + type: 'hidden' as NodePropertyTypes, + default: 'https://zoom.us/oauth/token' + }, + + { + displayName: 'Scope', + name: 'scope', + type: 'hidden' as NodePropertyTypes, + default: '' + }, + { + displayName: 'Auth URI Query Parameters', + name: 'authQueryParameters', + type: 'hidden' as NodePropertyTypes, + default: '' + }, + { + displayName: 'Authentication', + name: 'authentication', + type: 'hidden' as NodePropertyTypes, + default: 'body' + } + ]; +} diff --git a/packages/nodes-base/nodes/Zoom/GenericFunctions.ts b/packages/nodes-base/nodes/Zoom/GenericFunctions.ts new file mode 100644 index 0000000000..0e2feda8db --- /dev/null +++ b/packages/nodes-base/nodes/Zoom/GenericFunctions.ts @@ -0,0 +1,128 @@ +import { OptionsWithUri } from 'request'; + +import { + IExecuteFunctions, + IExecuteSingleFunctions, + ILoadOptionsFunctions +} from 'n8n-core'; + +import { IDataObject } from 'n8n-workflow'; +import * as _ from 'lodash'; + +export async function zoomApiRequest( + this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, + method: string, + resource: string, + body: object = {}, + query: object = {}, + headers: {} | undefined = undefined, + option: {} = {} +): Promise { + // tslint:disable-line:no-any + const authenticationMethod = this.getNodeParameter( + 'authentication', + 0, + 'accessToken' + ) as string; + let options: OptionsWithUri = { + method, + headers: headers || { + 'Content-Type': 'application/json' + }, + body, + qs: query, + uri: `https://zoom.us/oauth${resource}`, + json: true + }; + options = Object.assign({}, options, option); + if (Object.keys(body).length === 0) { + delete options.body; + } + if (Object.keys(query).length === 0) { + delete options.qs; + } + try { + if (authenticationMethod === 'accessToken') { + const credentials = this.getCredentials('zoomApi'); + if (credentials === undefined) { + throw new Error('No credentials got returned!'); + } + options.headers!.Authorization = `Bearer ${credentials.accessToken}`; + //@ts-ignore + return await this.helpers.request(options); + } else { + //@ts-ignore + return await this.helpers.requestOAuth2.call( + this, + 'zoomOAuth2Api', + options + ); + } + } catch (error) { + if (error.statusCode === 401) { + // Return a clear error + throw new Error('The Zoom credentials are not valid!'); + } + + if (error.response && error.response.body && error.response.body.message) { + // Try to return the error prettier + throw new Error( + `Zoom error response [${error.statusCode}]: ${error.response.body.message}` + ); + } + + // If that data does not exist for some reason return the actual error + throw error; + } +} + +export async function zoomApiRequestAllItems( + this: IExecuteFunctions | ILoadOptionsFunctions, + propertyName: string, + method: string, + endpoint: string, + body: any = {}, + query: IDataObject = {} +): Promise { + // tslint:disable-line:no-any + const returnData: IDataObject[] = []; + let responseData; + query.page = 1; + query.count = 100; + do { + responseData = await zoomApiRequest.call( + this, + method, + endpoint, + body, + query + ); + query.cursor = encodeURIComponent( + _.get(responseData, 'response_metadata.next_cursor') + ); + query.page++; + returnData.push.apply(returnData, responseData[propertyName]); + } while ( + (responseData.response_metadata !== undefined && + responseData.response_metadata.mext_cursor !== undefined && + responseData.response_metadata.next_cursor !== '' && + responseData.response_metadata.next_cursor !== null) || + (responseData.paging !== undefined && + responseData.paging.pages !== undefined && + responseData.paging.page !== undefined && + responseData.paging.page < responseData.paging.pages) + ); + + return returnData; +} + +export function validateJSON(json: string | undefined): any { + // tslint:disable-line:no-any + let result; + try { + result = JSON.parse(json!); + } catch (exception) { + result = undefined; + } + return result; +} diff --git a/packages/nodes-base/nodes/Zoom/Zoom.node.ts b/packages/nodes-base/nodes/Zoom/Zoom.node.ts new file mode 100644 index 0000000000..ce32b4c51b --- /dev/null +++ b/packages/nodes-base/nodes/Zoom/Zoom.node.ts @@ -0,0 +1,103 @@ +import { IExecuteFunctions } from 'n8n-core'; +import { + IDataObject, + INodeExecutionData, + INodeType, + INodeTypeDescription +} from 'n8n-workflow'; +import { + zoomApiRequest, + zoomApiRequestAllItems, + validateJSON +} from './GenericFunctions'; +export class Zoom implements INodeType { + description: INodeTypeDescription = { + displayName: 'Zoom', + name: 'zoom', + group: ['input'], + version: 1, + description: 'Consume Zoom API', + defaults: { + name: 'Zoom', + color: '#772244' + }, + inputs: ['main'], + outputs: ['main'], + credentials: [ + { + name: 'zoomApi', + required: true, + displayOptions: { + show: { + authentication: ['accessToken'] + } + } + }, + { + name: 'zoomOAuth2Api', + required: true, + displayOptions: { + show: { + authentication: ['oAuth2'] + } + } + } + ], + properties: [ + { + displayName: 'Authentication', + name: 'authentication', + type: 'options', + options: [ + { + name: 'Access Token', + value: 'accessToken' + }, + { + name: 'OAuth2', + value: 'oAuth2' + } + ], + default: 'accessToken', + description: 'The resource to operate on.' + } + ] + }; + + async execute(this: IExecuteFunctions): Promise { + const items = this.getInputData(); + const returnData: IDataObject[] = []; + const length = (items.length as unknown) as number; + let qs: IDataObject; + let responseData; + const authentication = this.getNodeParameter('authentication', 0) as string; + const resource = this.getNodeParameter('resource', 0) as string; + const operation = this.getNodeParameter('operation', 0) as string; + for (let i = 0; i < length; i++) { + qs = {}; + if (resource === 'channel') { + //https://api.slack.com/methods/conversations.archive + if (operation === 'archive') { + const channel = this.getNodeParameter('channelId', i) as string; + const body: IDataObject = { + channel + }; + responseData = await zoomApiRequest.call( + this, + 'POST', + '/conversations.archive', + body, + qs + ); + } + } + } + if (Array.isArray(responseData)) { + returnData.push.apply(returnData, responseData as IDataObject[]); + } else { + returnData.push(responseData as IDataObject); + } + + return [this.helpers.returnJsonArray(returnData)]; + } +} diff --git a/packages/nodes-base/nodes/Zoom/zoom.png b/packages/nodes-base/nodes/Zoom/zoom.png new file mode 100644 index 0000000000000000000000000000000000000000..dfc72331ebddb8f4f2bfded903500be639581567 GIT binary patch literal 1848 zcmV-82gmq{P)Px%JbF}EbW&k=AaHVTW@&6?Aar?fWgvKMZ~y=}jg?hP zvfLmH+;fT?0ZT$M$MFnim#Qpt{B*;7-uQVkiCtx5B-E{z!0GqTU+D+0SS9IId#sUt zarKLrFv%`nJiPj@O=Rzv%cYB8zPfRygcfU>twlD4@9H(#8e3pt(b#M+=6EBZDi(=o z*Ilw+W7REI$3kxe^F=bh{px!tZHWkAW8TR_w`q8|4<^qrn7eR=Jyu9AtF@AokX(;3 zrA2mCY2cG}QJ^aF#oVH%g=5TJF)PC^((#^8Ptu0lHXJv&gyh35xAX)o;8VoR{E(WY zVPtx181Aea(&;fS*#lm(55@uHMJw+I6T!1h05A#-)Q5_oij4@gzp?-YlnR9quS2N{ zh2U|w`;s774+u+EQ`oPypupex4zT@MB8)X**pSK!KAGepZNAs)7}6TL=S|r38uvUb z0=ARj8dli4L*w+B^m%YLcR(-rbcRczLnFb0GUHR~iOujvfeV5dYgY)+{rasbGZ?{v zPC7=J4O$d!m<1g>cHpe(@R0fh8H#O2E0Ux}q+hJssN8fyN_A|}O?d@c5S@;VSkb)I zgnf^1Y*1UUE^AISVpxZ{D*QlbK|V)hrlC=|3(4>Z%+5YRw&fl2JK*%_;aBuBdf0)E z4~$v4{H5TV-?X_)lm1bg_{1=sYV#HOgEn_*(gAt>Uu}e^0K~zWE&cC%d}{dgn&;7D z_I7%v=P5i*C%*!uG!K2k^At~i0DWd{JA-D?0ssI232;bRa{vGU0RR910RT@W#MS@+ z0Kia8R7L;)|0#0+DY^eCYXATL{V96?D7OFq{{Q{{|0uBkDyjb|ZvQB%|0{t1D5d`> zp#LbW|0{FUP>}zY$o^Hp|AxN*aHamW+Wp(+{&2?rNUr}pa{YDmg%SV&1Gz~= zK~zY`)t75ysxS#S=h0`rOkJY$Xx#LekY=iKf8|ErU$BL)MyWD&~x4T#m6|#L%aLQ;3GC zb4sdyc&(v7JRu(z95Jor$4Ro@{W+`MI^mp`L-X~`>ZXQPH*2ok8Y*u7*Xp8%ZeUq` z@%(`^Tsd9WVx?AVo<(MIyqA}k7qAX4&*=hp$sunDOd#+e2M5|Ex8b&0t3}IptHCdH zwNoB18@^s&{YJ08@`!ze1z+nT*RMXy%Z>otxdyebype25SWH1kAd~(DUe*H?zIxn8ifElSQGzW)pxRvbF(oHlIxF4}vWOU~rxJ z2S))5X<$mBGe(o|1TzHq$p*ifpS4eVgr9Vg(Vl$8!UAbOO$1zue0QgXvAwh84LHsi zrvTq6ktKX5q#ZN(0gUaMV%q3eiX7lMU1We5z*Mwb&VL8XF~4E2qWGu~4)U}qCWCMg z1W$9SsW6hIjgb)!5LP2kgFwLYT=C~ujG4wn!XY|NBYK1*3BMpLNv8ZHz?k>=s9*pz zgGWS#UtHIfaCJVwNaSu4DvIPj48U(1RpAhZ#*TA{V|hl?(EVWep4^Av=xSj1Wh)D* zG&|vRG)5cRm{a(K)JlV=E(xtx~ z9oi5BxY0kYu6ocYMD~}BZVffEU1RCAETcdei;A0q@R7`!d62lVRZ<=*z&}I(|JN63T z<8-_k*U)C1#)r8lHfB7C$!EI#xjmzwZTg8n97>lFb9`uh%paXm#Ico8{I^01|5Z3Y m^XEj^W09%Wm7f*)|MeG&CZon#`=kW`0000 Date: Wed, 17 Jun 2020 11:16:31 -0700 Subject: [PATCH 02/20] add resource --- packages/nodes-base/nodes/Zoom/Zoom.node.ts | 56 +++++++++++++-------- 1 file changed, 36 insertions(+), 20 deletions(-) diff --git a/packages/nodes-base/nodes/Zoom/Zoom.node.ts b/packages/nodes-base/nodes/Zoom/Zoom.node.ts index ce32b4c51b..ff7487a2e2 100644 --- a/packages/nodes-base/nodes/Zoom/Zoom.node.ts +++ b/packages/nodes-base/nodes/Zoom/Zoom.node.ts @@ -17,10 +17,12 @@ export class Zoom implements INodeType { group: ['input'], version: 1, description: 'Consume Zoom API', + subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}', defaults: { name: 'Zoom', color: '#772244' }, + icon: 'file:zoom.png', inputs: ['main'], outputs: ['main'], credentials: [ @@ -60,6 +62,19 @@ export class Zoom implements INodeType { ], default: 'accessToken', description: 'The resource to operate on.' + }, + { + displayName: 'Resource', + name: 'resource', + type: 'options', + options: [ + { + name: 'meeting', + value: 'meeting' + } + ], + default: 'meeting', + description: 'The resource to operate on.' } ] }; @@ -72,26 +87,27 @@ export class Zoom implements INodeType { let responseData; const authentication = this.getNodeParameter('authentication', 0) as string; const resource = this.getNodeParameter('resource', 0) as string; - const operation = this.getNodeParameter('operation', 0) as string; - for (let i = 0; i < length; i++) { - qs = {}; - if (resource === 'channel') { - //https://api.slack.com/methods/conversations.archive - if (operation === 'archive') { - const channel = this.getNodeParameter('channelId', i) as string; - const body: IDataObject = { - channel - }; - responseData = await zoomApiRequest.call( - this, - 'POST', - '/conversations.archive', - body, - qs - ); - } - } - } + // const operation = this.getNodeParameter('operation', 0) as string; + console.log(this.getCredentials('zoomOAuth2Api')); + // for (let i = 0; i < length; i++) { + // qs = {}; + // if (resource === 'channel') { + // //https://api.slack.com/methods/conversations.archive + // if (operation === 'archive') { + // const channel = this.getNodeParameter('channelId', i) as string; + // const body: IDataObject = { + // channel + // }; + // responseData = await zoomApiRequest.call( + // this, + // 'POST', + // '/conversations.archive', + // body, + // qs + // ); + // } + // } + // } if (Array.isArray(responseData)) { returnData.push.apply(returnData, responseData as IDataObject[]); } else { From b95e3464a45112f7202cb36829226746d571084e Mon Sep 17 00:00:00 2001 From: shraddha shaligram Date: Mon, 22 Jun 2020 11:51:15 -0700 Subject: [PATCH 03/20] add meeting functionality --- CONTRIBUTING.md | 10 +- LICENSE.md | 2 +- packages/cli/LICENSE.md | 2 +- packages/core/LICENSE.md | 2 +- packages/editor-ui/LICENSE.md | 2 +- packages/node-dev/LICENSE.md | 2 +- packages/nodes-base/LICENSE.md | 2 +- .../nodes/Salesforce/GenericFunctions.ts | 2 +- packages/nodes-base/nodes/Slack/Slack.node.ts | 114 +-- .../nodes-base/nodes/Zoom/GenericFunctions.ts | 12 +- .../nodes/Zoom/MeetingDescription.ts | 751 ++++++++++++++++++ .../Zoom/MeetingRegistrantDescription.ts | 407 ++++++++++ packages/nodes-base/nodes/Zoom/Zoom.node.ts | 355 ++++++++- .../nodes-base/nodes/Zoom/ZoomOperations.ts | 71 -- packages/workflow/LICENSE.md | 2 +- 15 files changed, 1561 insertions(+), 175 deletions(-) create mode 100644 packages/nodes-base/nodes/Zoom/MeetingDescription.ts create mode 100644 packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts delete mode 100644 packages/nodes-base/nodes/Zoom/ZoomOperations.ts diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 568f8fc9a7..fcc046beef 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -38,7 +38,7 @@ The most important directories: execution, active webhooks and workflows - [/packages/editor-ui](/packages/editor-ui) - Vue frontend workflow editor - - [/packages/node-dev](/packages/node-dev) - Simple CLI to create new n8n-nodes + - [/packages/node-dev](/packages/node-dev) - CLI to create new n8n-nodes - [/packages/nodes-base](/packages/nodes-base) - Base n8n nodes - [/packages/workflow](/packages/workflow) - Workflow code with interfaces which get used by front- & backend @@ -159,7 +159,7 @@ tests of all packages. ## Create Custom Nodes -It is very easy to create own nodes for n8n. More information about that can +It is very straightforward to create your own nodes for n8n. More information about that can be found in the documentation of "n8n-node-dev" which is a small CLI which helps with n8n-node-development. @@ -177,9 +177,9 @@ If you want to create a node which should be added to n8n follow these steps: 1. Create a new folder for the new node. For a service named "Example" the folder would be called: `/packages/nodes-base/nodes/Example` - 1. If there is already a similar node simply copy the existing one in the new folder and rename it. If none exists yet, create a boilerplate node with [n8n-node-dev](https://github.com/n8n-io/n8n/tree/master/packages/node-dev) and copy that one in the folder. + 1. If there is already a similar node, copy the existing one in the new folder and rename it. If none exists yet, create a boilerplate node with [n8n-node-dev](https://github.com/n8n-io/n8n/tree/master/packages/node-dev) and copy that one in the folder. - 1. If the node needs credentials because it has to authenticate with an API or similar create new ones. Existing ones can be found in folder `/packages/nodes-base/credentials`. Also there it is the easiest to simply copy existing similar ones. + 1. If the node needs credentials because it has to authenticate with an API or similar create new ones. Existing ones can be found in folder `/packages/nodes-base/credentials`. Also there it is the easiest to copy existing similar ones. 1. Add the path to the new node (and optionally credentials) to package.json of `nodes-base`. It already contains a property `n8n` with its own keys `credentials` and `nodes`. @@ -236,6 +236,6 @@ docsify serve ./docs That we do not have any potential problems later it is sadly necessary to sign a [Contributor License Agreement](CONTRIBUTOR_LICENSE_AGREEMENT.md). That can be done literally with the push of a button. -We used the most simple one that exists. It is from [Indie Open Source](https://indieopensource.com/forms/cla) which uses plain English and is literally just a few lines long. +We used the most simple one that exists. It is from [Indie Open Source](https://indieopensource.com/forms/cla) which uses plain English and is literally only a few lines long. A bot will automatically comment on the pull request once it got opened asking for the agreement to be signed. Before it did not get signed it is sadly not possible to merge it in. diff --git a/LICENSE.md b/LICENSE.md index aac54547eb..24a7d38fc9 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -215,7 +215,7 @@ Licensor: n8n GmbH same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright [yyyy] [name of copyright owner] + Copyright 2020 n8n GmbH Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/packages/cli/LICENSE.md b/packages/cli/LICENSE.md index aac54547eb..24a7d38fc9 100644 --- a/packages/cli/LICENSE.md +++ b/packages/cli/LICENSE.md @@ -215,7 +215,7 @@ Licensor: n8n GmbH same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright [yyyy] [name of copyright owner] + Copyright 2020 n8n GmbH Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/packages/core/LICENSE.md b/packages/core/LICENSE.md index aac54547eb..24a7d38fc9 100644 --- a/packages/core/LICENSE.md +++ b/packages/core/LICENSE.md @@ -215,7 +215,7 @@ Licensor: n8n GmbH same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright [yyyy] [name of copyright owner] + Copyright 2020 n8n GmbH Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/packages/editor-ui/LICENSE.md b/packages/editor-ui/LICENSE.md index aac54547eb..24a7d38fc9 100644 --- a/packages/editor-ui/LICENSE.md +++ b/packages/editor-ui/LICENSE.md @@ -215,7 +215,7 @@ Licensor: n8n GmbH same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright [yyyy] [name of copyright owner] + Copyright 2020 n8n GmbH Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/packages/node-dev/LICENSE.md b/packages/node-dev/LICENSE.md index aac54547eb..24a7d38fc9 100644 --- a/packages/node-dev/LICENSE.md +++ b/packages/node-dev/LICENSE.md @@ -215,7 +215,7 @@ Licensor: n8n GmbH same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright [yyyy] [name of copyright owner] + Copyright 2020 n8n GmbH Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/packages/nodes-base/LICENSE.md b/packages/nodes-base/LICENSE.md index aac54547eb..24a7d38fc9 100644 --- a/packages/nodes-base/LICENSE.md +++ b/packages/nodes-base/LICENSE.md @@ -215,7 +215,7 @@ Licensor: n8n GmbH same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright [yyyy] [name of copyright owner] + Copyright 2020 n8n GmbH Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/packages/nodes-base/nodes/Salesforce/GenericFunctions.ts b/packages/nodes-base/nodes/Salesforce/GenericFunctions.ts index 648735feb2..4c81432238 100644 --- a/packages/nodes-base/nodes/Salesforce/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Salesforce/GenericFunctions.ts @@ -30,7 +30,7 @@ export async function salesforceApiRequest(this: IExecuteFunctions | IExecuteSin } } -export async function salesforceApiRequestAllItems(this: IExecuteFunctions | ILoadOptionsFunctions, propertyName: string ,method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise { // tslint:disable-line:no-any +export async function salesforceApiRequestAllItems(this: IExecuteFunctions | ILoadOptionsFunctions, propertyName: string, method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise { // tslint:disable-line:no-any const returnData: IDataObject[] = []; diff --git a/packages/nodes-base/nodes/Slack/Slack.node.ts b/packages/nodes-base/nodes/Slack/Slack.node.ts index 57fe569d22..bd3a7b3c21 100644 --- a/packages/nodes-base/nodes/Slack/Slack.node.ts +++ b/packages/nodes-base/nodes/Slack/Slack.node.ts @@ -289,7 +289,7 @@ export class Slack implements INodeType { if (operation === 'get') { const channel = this.getNodeParameter('channelId', i) as string; qs.channel = channel, - responseData = await slackApiRequest.call(this, 'POST', '/conversations.info', {}, qs); + responseData = await slackApiRequest.call(this, 'POST', '/conversations.info', {}, qs); responseData = responseData.channel; } //https://api.slack.com/methods/conversations.list @@ -456,7 +456,7 @@ export class Slack implements INodeType { if (!jsonParameters) { const attachments = this.getNodeParameter('attachments', i, []) as unknown as Attachment[]; - const blocksUi = (this.getNodeParameter('blocksUi', i, []) as IDataObject).blocksValues as IDataObject[]; + const blocksUi = (this.getNodeParameter('blocksUi', i, []) as IDataObject).blocksValues as IDataObject[]; // The node does save the fields data differently than the API // expects so fix the data befre we send the request @@ -482,7 +482,7 @@ export class Slack implements INodeType { block.block_id = blockUi.blockId as string; block.type = blockUi.type as string; if (block.type === 'actions') { - const elementsUi = (blockUi.elementsUi as IDataObject).elementsValues as IDataObject[]; + const elementsUi = (blockUi.elementsUi as IDataObject).elementsValues as IDataObject[]; if (elementsUi) { for (const elementUi of elementsUi) { const element: Element = {}; @@ -498,7 +498,7 @@ export class Slack implements INodeType { text: elementUi.text as string, type: 'plain_text', emoji: elementUi.emoji as boolean, - }; + }; if (elementUi.url) { element.url = elementUi.url as string; } @@ -508,13 +508,13 @@ export class Slack implements INodeType { if (elementUi.style !== 'default') { element.style = elementUi.style as string; } - const confirmUi = (elementUi.confirmUi as IDataObject).confirmValue as IDataObject; - if (confirmUi) { + const confirmUi = (elementUi.confirmUi as IDataObject).confirmValue as IDataObject; + if (confirmUi) { const confirm: Confirm = {}; - const titleUi = (confirmUi.titleUi as IDataObject).titleValue as IDataObject; - const textUi = (confirmUi.textUi as IDataObject).textValue as IDataObject; - const confirmTextUi = (confirmUi.confirmTextUi as IDataObject).confirmValue as IDataObject; - const denyUi = (confirmUi.denyUi as IDataObject).denyValue as IDataObject; + const titleUi = (confirmUi.titleUi as IDataObject).titleValue as IDataObject; + const textUi = (confirmUi.textUi as IDataObject).textValue as IDataObject; + const confirmTextUi = (confirmUi.confirmTextUi as IDataObject).confirmValue as IDataObject; + const denyUi = (confirmUi.denyUi as IDataObject).denyValue as IDataObject; const style = confirmUi.style as string; if (titleUi) { confirm.title = { @@ -548,13 +548,13 @@ export class Slack implements INodeType { confirm.style = style as string; } element.confirm = confirm; - } - elements.push(element); + } + elements.push(element); } block.elements = elements; } } else if (block.type === 'section') { - const textUi = (blockUi.textUi as IDataObject).textValue as IDataObject; + const textUi = (blockUi.textUi as IDataObject).textValue as IDataObject; if (textUi) { const text: Text = {}; if (textUi.type === 'plainText') { @@ -569,7 +569,7 @@ export class Slack implements INodeType { } else { throw new Error('Property text must be defined'); } - const fieldsUi = (blockUi.fieldsUi as IDataObject).fieldsValues as IDataObject[]; + const fieldsUi = (blockUi.fieldsUi as IDataObject).fieldsValues as IDataObject[]; if (fieldsUi) { const fields: Text[] = []; for (const fieldUi of fieldsUi) { @@ -589,7 +589,7 @@ export class Slack implements INodeType { block.fields = fields; } } - const accessoryUi = (blockUi.accessoryUi as IDataObject).accessoriesValues as IDataObject; + const accessoryUi = (blockUi.accessoryUi as IDataObject).accessoriesValues as IDataObject; if (accessoryUi) { const accessory: Element = {}; if (accessoryUi.type === 'button') { @@ -608,46 +608,46 @@ export class Slack implements INodeType { if (accessoryUi.style !== 'default') { accessory.style = accessoryUi.style as string; } - const confirmUi = (accessoryUi.confirmUi as IDataObject).confirmValue as IDataObject; + const confirmUi = (accessoryUi.confirmUi as IDataObject).confirmValue as IDataObject; if (confirmUi) { - const confirm: Confirm = {}; - const titleUi = (confirmUi.titleUi as IDataObject).titleValue as IDataObject; - const textUi = (confirmUi.textUi as IDataObject).textValue as IDataObject; - const confirmTextUi = (confirmUi.confirmTextUi as IDataObject).confirmValue as IDataObject; - const denyUi = (confirmUi.denyUi as IDataObject).denyValue as IDataObject; - const style = confirmUi.style as string; - if (titleUi) { - confirm.title = { - type: 'plain_text', - text: titleUi.text as string, - emoji: titleUi.emoji as boolean, - }; - } - if (textUi) { - confirm.text = { - type: 'plain_text', - text: textUi.text as string, - emoji: textUi.emoji as boolean, - }; - } - if (confirmTextUi) { - confirm.confirm = { - type: 'plain_text', - text: confirmTextUi.text as string, - emoji: confirmTextUi.emoji as boolean, - }; - } - if (denyUi) { - confirm.deny = { - type: 'plain_text', - text: denyUi.text as string, - emoji: denyUi.emoji as boolean, - }; - } - if (style !== 'default') { - confirm.style = style as string; - } - accessory.confirm = confirm; + const confirm: Confirm = {}; + const titleUi = (confirmUi.titleUi as IDataObject).titleValue as IDataObject; + const textUi = (confirmUi.textUi as IDataObject).textValue as IDataObject; + const confirmTextUi = (confirmUi.confirmTextUi as IDataObject).confirmValue as IDataObject; + const denyUi = (confirmUi.denyUi as IDataObject).denyValue as IDataObject; + const style = confirmUi.style as string; + if (titleUi) { + confirm.title = { + type: 'plain_text', + text: titleUi.text as string, + emoji: titleUi.emoji as boolean, + }; + } + if (textUi) { + confirm.text = { + type: 'plain_text', + text: textUi.text as string, + emoji: textUi.emoji as boolean, + }; + } + if (confirmTextUi) { + confirm.confirm = { + type: 'plain_text', + text: confirmTextUi.text as string, + emoji: confirmTextUi.emoji as boolean, + }; + } + if (denyUi) { + confirm.deny = { + type: 'plain_text', + text: denyUi.text as string, + emoji: denyUi.emoji as boolean, + }; + } + if (style !== 'default') { + confirm.style = style as string; + } + accessory.confirm = confirm; } } block.accessory = accessory; @@ -790,8 +790,8 @@ export class Slack implements INodeType { if (binaryData) { const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string; if (items[i].binary === undefined - //@ts-ignore - || items[i].binary[binaryPropertyName] === undefined) { + //@ts-ignore + || items[i].binary[binaryPropertyName] === undefined) { throw new Error(`No binary data property "${binaryPropertyName}" does not exists on item!`); } body.file = { @@ -804,7 +804,7 @@ export class Slack implements INodeType { contentType: items[i].binary[binaryPropertyName].mimeType, } }; - responseData = await slackApiRequest.call(this, 'POST', '/files.upload', {}, qs, { 'Content-Type': 'multipart/form-data' }, { formData: body }); + responseData = await slackApiRequest.call(this, 'POST', '/files.upload', {}, qs, { 'Content-Type': 'multipart/form-data' }, { formData: body }); responseData = responseData.file; } else { const fileContent = this.getNodeParameter('fileContent', i) as string; diff --git a/packages/nodes-base/nodes/Zoom/GenericFunctions.ts b/packages/nodes-base/nodes/Zoom/GenericFunctions.ts index e8e0247461..9cde3e67e2 100644 --- a/packages/nodes-base/nodes/Zoom/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Zoom/GenericFunctions.ts @@ -40,21 +40,11 @@ export async function zoomApiRequest(this: IExecuteFunctions | IExecuteSingleFun throw new Error('No credentials got returned!'); } options.headers!.Authorization = `Bearer ${credentials.accessToken}`; - console.log("options if"); - console.log(options); + //@ts-ignore return await this.helpers.request(options); } else { - console.log("options else"); - console.log(options); - let credentials = this.getCredentials('zoomOAuth2Api'); - // let oauthtoken1 = credentials!.oauthTokenData; - - - console.log(credentials); - console.log("credss"); - //@ts-ignore return await this.helpers.requestOAuth2.call(this, 'zoomOAuth2Api', options); diff --git a/packages/nodes-base/nodes/Zoom/MeetingDescription.ts b/packages/nodes-base/nodes/Zoom/MeetingDescription.ts new file mode 100644 index 0000000000..bd4b8ce271 --- /dev/null +++ b/packages/nodes-base/nodes/Zoom/MeetingDescription.ts @@ -0,0 +1,751 @@ +import { + INodeProperties, +} from 'n8n-workflow'; + +export const meetingOperations = [ + { + displayName: 'Operation', + name: 'operation', + type: 'options', + displayOptions: { + show: { + resource: [ + 'meeting', + ], + }, + }, + options: [ + { + name: 'Create', + value: 'create', + description: 'Create a meeting', + }, + { + name: 'Delete', + value: 'delete', + description: 'Delete a meeting', + }, + { + name: 'Get', + value: 'get', + description: 'Retrieve a meeting', + }, + { + name: 'Get All', + value: 'getAll', + description: 'Retrieve all meetings', + }, + { + name: 'Update', + value: 'update', + description: 'Update a meeting', + } + ], + default: 'create', + description: 'The operation to perform.', + } +] as INodeProperties[]; + +export const meetingFields = [ + /* -------------------------------------------------------------------------- */ + /* meeting:create */ + /* -------------------------------------------------------------------------- */ + { + displayName: 'Id', + name: 'userId', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'create', + + + ], + resource: [ + 'meeting', + ], + }, + }, + description: 'User ID.', + }, + { + displayName: 'Additional settings', + name: 'additionalFields', + type: 'collection', + placeholder: 'Add Field', + default: {}, + displayOptions: { + show: { + operation: [ + 'create', + + ], + resource: [ + 'meeting', + ], + } + }, + options: [ + { + displayName: 'Meeting topic', + name: 'topic', + type: 'string', + default: '', + description: `Meeting topic.`, + }, + { + displayName: 'Meeting type', + name: 'type', + type: 'options', + options: [ + { + name: 'Instant Meeting', + value: 1, + }, + { + name: 'Scheduled Meeting', + value: 2, + }, + { + name: 'Recurring meeting with no fixed time', + value: 3, + }, + { + name: 'Recurring meeting with no fixed time', + value: 8, + }, + + ], + default: 2, + description: 'Meeting type.' + }, + { + displayName: 'Start time', + name: 'startTime', + type: 'dateTime', + default: '', + description: 'Start time should be used only for scheduled or recurring meetings with fixed time', + }, + { + displayName: 'Duration', + name: 'duration', + type: 'number', + default: '', + description: 'Duration.', + }, + { + displayName: 'Timezone', + name: 'timeZone', + type: 'options', + typeOptions: { + loadOptionsMethod: 'getTimezones', + }, + default: '', + description: `Time zone used in the response. The default is the time zone of the calendar.`, + }, + { + displayName: 'Schedule for', + name: 'scheduleFor', + type: 'string', + default: '', + description: 'Schedule meeting for someone else from your account, provide their email id.', + }, + { + displayName: 'Password', + name: 'password', + type: 'string', + default: '', + description: 'Password to join the meeting with maximum 10 characters.', + }, + { + displayName: 'Agenda', + name: 'agenda', + type: 'string', + default: '', + description: 'Meeting agenda.', + }, + { + displayName: 'Host Meeting in China', + name: 'cn_meeting', + type: 'boolean', + default: false, + description: 'Host Meeting in China.', + }, + { + displayName: 'Host Meeting in India', + name: 'in_meeting', + type: 'boolean', + default: false, + description: 'Host Meeting in India.', + }, + { + displayName: 'Host Video', + name: 'host_video', + type: 'boolean', + default: false, + description: 'Start video when host joins the meeting.', + }, + { + displayName: 'Participant Video', + name: 'participant_video', + type: 'boolean', + default: false, + description: 'Start video when participant joins the meeting.', + }, + { + displayName: 'Join before Host', + name: 'join_before_host', + type: 'boolean', + default: false, + description: 'Allow participants to join the meeting before host starts it.', + }, + { + displayName: 'Muting before entry', + name: 'mute_upon_entry', + type: 'boolean', + default: false, + description: 'Mute participants upon entry.', + }, + { + displayName: 'Watermark', + name: 'watermark', + type: 'boolean', + default: false, + description: 'Adds watermark when viewing a shared screen.', + }, + { + displayName: 'Alternative Hosts', + name: 'alternative_hosts', + type: 'string', + default: '', + description: 'Alternative hosts email ids.', + }, + { + displayName: 'Auto recording', + name: 'auto_recording', + type: 'options', + options: [ + { + name: 'Record on local', + value: 'local', + }, + { + name: 'Record on cloud', + value: 'cloud', + }, + { + name: 'Disabled', + value: 'none', + }, + + + ], + default: 'none', + description: 'Auto recording.', + }, + { + displayName: 'Audio', + name: 'auto_recording', + type: 'options', + options: [ + { + name: 'Both Telephony and VoiP', + value: 'both', + }, + { + name: 'Telephony', + value: 'telephony', + }, + { + name: 'VOIP', + value: 'voip', + }, + + + ], + default: 'both', + description: 'Determine how participants can join audio portion of the meeting.', + }, + { + displayName: 'Registration type', + name: 'registration_type', + type: 'options', + options: [ + { + name: 'Attendees register once and can attend any of the occurences', + value: 1, + }, + { + name: 'Attendees need to register for every occurence', + value: 2, + }, + { + name: 'Attendees register once and can choose one or more occurences to attend', + value: 3, + }, + + + ], + default: 1, + description: 'Registration type. Used for recurring meetings with fixed time only', + }, + + + ], + }, + /* -------------------------------------------------------------------------- */ + /* meeting:get */ + /* -------------------------------------------------------------------------- */ + { + displayName: 'Id', + name: 'userId', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'get', + ], + resource: [ + 'meeting', + ], + }, + }, + description: 'User ID.', + }, + /* -------------------------------------------------------------------------- */ + /* meeting:getAll */ + /* -------------------------------------------------------------------------- */ + { + displayName: 'Id', + name: 'userId', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'getAll', + ], + resource: [ + 'meeting', + ], + }, + }, + description: 'User ID.', + }, + { + displayName: 'Return All', + name: 'returnAll', + type: 'boolean', + displayOptions: { + show: { + operation: [ + 'getAll', + ], + resource: [ + 'meeting', + ], + }, + }, + default: false, + description: 'If all results should be returned or only up to a given limit.', + }, + { + displayName: 'Limit', + name: 'limit', + type: 'number', + displayOptions: { + show: { + operation: [ + 'getAll', + ], + resource: [ + 'meeting', + ], + returnAll: [ + false, + ], + }, + }, + typeOptions: { + minValue: 1, + maxValue: 300 + }, + default: 30, + description: 'How many results to return.', + }, + { + displayName: 'Additional settings', + name: 'additionalFields', + type: 'collection', + placeholder: 'Add Field', + default: {}, + displayOptions: { + show: { + operation: [ + 'getAll', + + ], + resource: [ + 'meeting', + ], + } + }, + options: [ + { + displayName: 'Type', + name: 'type', + type: 'options', + options: [ + { + name: 'Scheduled', + value: 'scheduled', + }, + { + name: 'Live', + value: 'live', + }, + { + name: 'Upcoming', + value: 'upcoming', + }, + + + ], + default: 'live', + description: `Meeting type.`, + }, + ] + }, + /* -------------------------------------------------------------------------- */ + /* meeting:delete */ + /* -------------------------------------------------------------------------- */ + { + displayName: 'Meeting Id', + name: 'meetingId', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'delete' + ], + resource: [ + 'meeting', + ], + }, + }, + description: 'Meeting ID.', + }, + { + displayName: 'Additional Fields', + name: 'additionalFields', + type: 'collection', + placeholder: 'Add Field', + default: {}, + displayOptions: { + show: { + operation: [ + 'delete', + ], + resource: [ + 'meeting', + ], + }, + }, + options: [ + { + displayName: 'Occurence Id', + name: 'occurenceId', + type: 'string', + default: '', + description: 'Meeting occurence Id.', + }, + { + displayName: 'Schedule a reminder', + name: 'scheduleForReminder', + type: 'boolean', + default: false, + description: 'Schedule a reminder via email', + }, + + + + ], + + }, + /* -------------------------------------------------------------------------- */ + /* meeting:update */ + /* -------------------------------------------------------------------------- */ + { + displayName: 'Meeting Id', + name: 'meetingId', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'update', + + + ], + resource: [ + 'meeting', + ], + }, + }, + description: 'Meeting ID.', + }, + { + displayName: 'Occurence Id', + name: 'occurenceId', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'update', + + + ], + resource: [ + 'meeting', + ], + }, + }, + description: 'Occurence ID.', + }, + { + displayName: 'Additional settings', + name: 'additionalFields', + type: 'collection', + placeholder: 'Add Field', + default: {}, + displayOptions: { + show: { + operation: [ + + 'update', + ], + resource: [ + 'meeting', + ], + } + }, + options: [ + { + displayName: 'Meeting topic', + name: 'topic', + type: 'string', + default: '', + description: `Meeting topic.`, + }, + { + displayName: 'Meeting type', + name: 'type', + type: 'options', + options: [ + { + name: 'Instant Meeting', + value: 1, + }, + { + name: 'Scheduled Meeting', + value: 2, + }, + { + name: 'Recurring meeting with no fixed time', + value: 3, + }, + { + name: 'Recurring meeting with no fixed time', + value: 8, + }, + + ], + default: 2, + description: 'Meeting type.' + }, + { + displayName: 'Start time', + name: 'startTime', + type: 'dateTime', + default: '', + description: 'Start time should be used only for scheduled or recurring meetings with fixed time', + }, + { + displayName: 'Duration', + name: 'duration', + type: 'number', + default: '', + description: 'Duration.', + }, + { + displayName: 'Timezone', + name: 'timeZone', + type: 'options', + typeOptions: { + loadOptionsMethod: 'getTimezones', + }, + default: '', + description: `Time zone used in the response. The default is the time zone of the calendar.`, + }, + { + displayName: 'Schedule for', + name: 'scheduleFor', + type: 'string', + default: '', + description: 'Schedule meeting for someone else from your account, provide their email id.', + }, + { + displayName: 'Password', + name: 'password', + type: 'string', + default: '', + description: 'Password to join the meeting with maximum 10 characters.', + }, + { + displayName: 'Agenda', + name: 'agenda', + type: 'string', + default: '', + description: 'Meeting agenda.', + }, + { + displayName: 'Host Meeting in China', + name: 'cn_meeting', + type: 'boolean', + default: false, + description: 'Host Meeting in China.', + }, + { + displayName: 'Host Meeting in India', + name: 'in_meeting', + type: 'boolean', + default: false, + description: 'Host Meeting in India.', + }, + { + displayName: 'Host Video', + name: 'host_video', + type: 'boolean', + default: false, + description: 'Start video when host joins the meeting.', + }, + { + displayName: 'Participant Video', + name: 'participant_video', + type: 'boolean', + default: false, + description: 'Start video when participant joins the meeting.', + }, + { + displayName: 'Join before Host', + name: 'join_before_host', + type: 'boolean', + default: false, + description: 'Allow participants to join the meeting before host starts it.', + }, + { + displayName: 'Muting before entry', + name: 'mute_upon_entry', + type: 'boolean', + default: false, + description: 'Mute participants upon entry.', + }, + { + displayName: 'Watermark', + name: 'watermark', + type: 'boolean', + default: false, + description: 'Adds watermark when viewing a shared screen.', + }, + { + displayName: 'Alternative Hosts', + name: 'alternative_hosts', + type: 'string', + default: '', + description: 'Alternative hosts email ids.', + }, + { + displayName: 'Auto recording', + name: 'auto_recording', + type: 'options', + options: [ + { + name: 'Record on local', + value: 'local', + }, + { + name: 'Record on cloud', + value: 'cloud', + }, + { + name: 'Disabled', + value: 'none', + }, + + + ], + default: 'none', + description: 'Auto recording.', + }, + { + displayName: 'Audio', + name: 'auto_recording', + type: 'options', + options: [ + { + name: 'Both Telephony and VoiP', + value: 'both', + }, + { + name: 'Telephony', + value: 'telephony', + }, + { + name: 'VOIP', + value: 'voip', + }, + + + ], + default: 'both', + description: 'Determine how participants can join audio portion of the meeting.', + }, + { + displayName: 'Registration type', + name: 'registration_type', + type: 'options', + options: [ + { + name: 'Attendees register once and can attend any of the occurences', + value: 1, + }, + { + name: 'Attendees need to register for every occurence', + value: 2, + }, + { + name: 'Attendees register once and can choose one or more occurences to attend', + value: 3, + }, + + + ], + default: 1, + description: 'Registration type. Used for recurring meetings with fixed time only', + }, + + + ], + }, + +] as INodeProperties[]; diff --git a/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts b/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts new file mode 100644 index 0000000000..b062786892 --- /dev/null +++ b/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts @@ -0,0 +1,407 @@ +import { + INodeProperties, +} from 'n8n-workflow'; +export const meetingRegistrantOperations = [ + { + displayName: 'Operation', + name: 'operation', + type: 'options', + displayOptions: { + show: { + resource: [ + 'meetingRegistrants', + ], + }, + }, + options: [ + { + name: 'Create', + value: 'create', + description: 'Create Meeting Registrants', + }, + { + name: 'Update', + value: 'update', + description: 'Update Meeting Registrant status', + }, + { + name: 'Get All', + value: 'getAll', + description: 'Retrieve all meeting registrants', + }, + + ], + default: 'create', + description: 'The operation to perform.', + } +] as INodeProperties[]; + + + +export const meetingRegistrantFields = [ + /* -------------------------------------------------------------------------- */ + /* meetingRegistrants:create */ + /* -------------------------------------------------------------------------- */ + { + displayName: 'Meeting Id', + name: 'meetingId', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'create', + + + ], + resource: [ + 'meetingRegistrants', + ], + }, + }, + description: 'Meeting ID.', + }, + { + displayName: 'Occurence Id', + name: 'occurenceId', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'create', + + + ], + resource: [ + 'meetingRegistrants', + ], + }, + }, + description: 'Occurence ID.', + }, + { + displayName: 'Email', + name: 'email', + type: 'string', + required: true, + default: '', + description: 'Valid email-id of registrant.', + }, + { + displayName: 'First name', + name: 'firstName', + required: true, + type: 'string', + default: '', + description: 'First Name.', + }, + { + displayName: 'Additional settings', + name: 'additionalFields', + type: 'collection', + placeholder: 'Add Field', + default: {}, + displayOptions: { + show: { + operation: [ + 'get', + + ], + resource: [ + 'meetingRegistrants', + ], + } + }, + options: [ + { + displayName: 'Last Name', + name: 'lastName', + type: 'string', + default: '', + description: 'Last Name.', + }, + { + displayName: 'Address', + name: 'address', + type: 'string', + default: '', + description: 'Valid address of registrant.', + }, + { + displayName: 'City', + name: 'city', + type: 'string', + default: '', + description: 'Valid city of registrant.', + }, + { + displayName: 'State', + name: 'state', + type: 'string', + default: '', + description: 'Valid state of registrant.', + }, + { + displayName: 'Country', + name: 'country', + type: 'string', + default: '', + description: 'Valid country of registrant.', + }, + { + displayName: 'Zip code', + name: 'zip', + type: 'string', + default: '', + description: 'Valid zip-code of registrant.', + }, + { + displayName: 'Phone Number', + name: 'phone', + type: 'string', + default: '', + description: 'Valid phone number of registrant.', + }, + { + displayName: 'Comments', + name: 'comments', + type: 'string', + default: '', + description: 'Allows registrants to provide any questions they have.', + }, + { + displayName: 'Organization', + name: 'org', + type: 'string', + default: '', + description: 'Organization of registrant.', + }, + { + displayName: 'Job title', + name: 'job_title', + type: 'string', + default: '', + description: 'Job title of registrant.', + }, + { + displayName: 'Purchasing time frame', + name: 'purchasing_time_frame', + type: 'options', + options: [ + { + name: 'Within a month', + value: 'Within a month', + }, + { + name: '1-3 months', + value: '1-3 months', + }, + { + name: '4-6 months', + value: '4-6 months', + }, + { + name: 'More than 6 months', + value: 'More than 6 months', + }, + { + name: 'No timeframe', + value: 'No timeframe', + }, + + + ], + default: '', + description: 'Meeting type.' + }, + { + displayName: 'Role in purchase process', + name: 'role_in_purchase_process', + type: 'options', + options: [ + { + name: 'Decision Maker', + value: 'Decision Maker', + }, + { + name: 'Evaluator/Recommender', + value: 'Evaluator/Recommender', + }, + { + name: 'Influener', + value: 'Influener', + }, + { + name: 'Not Involved', + value: 'Not Involved', + }, + + ], + default: '', + description: 'Role in purchase process.' + }, + ], + }, + /* -------------------------------------------------------------------------- */ + /* meetingRegistrants:getAll */ + /* -------------------------------------------------------------------------- */ + { + displayName: 'Meeting Id', + name: 'meetingId', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'getAll', + + + ], + resource: [ + 'meetingRegistrants', + ], + }, + }, + description: 'Meeting ID.', + }, + { + displayName: 'Return All', + name: 'returnAll', + type: 'boolean', + displayOptions: { + show: { + operation: [ + 'getAll', + ], + resource: [ + 'meetingRegistrants', + ], + }, + }, + default: false, + description: 'If all results should be returned or only up to a given limit.', + }, + { + displayName: 'Limit', + name: 'limit', + type: 'number', + displayOptions: { + show: { + operation: [ + 'getAll', + ], + resource: [ + 'meetingRegistrants', + ], + returnAll: [ + false, + ], + }, + }, + typeOptions: { + minValue: 1, + maxValue: 300 + }, + default: 30, + description: 'How many results to return.', + }, + { + displayName: 'Additional settings', + name: 'additionalFields', + type: 'collection', + placeholder: 'Add Field', + default: {}, + displayOptions: { + show: { + operation: [ + 'get', + + ], + resource: [ + 'meetingRegistrants', + ], + } + }, + options: [ + { + displayName: 'Occurence Id', + name: 'occurence_id', + type: 'string', + default: '', + description: `Occurence Id.`, + }, + { + displayName: 'Status', + name: 'status', + type: 'options', + options: [ + { + name: 'Pending', + value: 'pending', + }, + { + name: 'Approved', + value: 'approved', + }, + { + name: 'Denied', + value: 'denied', + }, + + + ], + default: '', + description: `Registrant Status.`, + }, + + ] + }, + /* -------------------------------------------------------------------------- */ + /* meetingRegistrants:update */ + /* -------------------------------------------------------------------------- */ + { + displayName: 'Meeting Id', + name: 'meetingId', + type: 'number', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'update', + + + ], + resource: [ + 'meetingRegistrants', + ], + }, + }, + description: 'Meeting ID.', + }, + { + displayName: 'Occurence Id', + name: 'occurenceId', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'update', + + + ], + resource: [ + 'meetingRegistrants', + ], + }, + }, + description: 'Occurence ID.', + }, + +] as INodeProperties[]; diff --git a/packages/nodes-base/nodes/Zoom/Zoom.node.ts b/packages/nodes-base/nodes/Zoom/Zoom.node.ts index 524fc08440..c1915d4ab4 100644 --- a/packages/nodes-base/nodes/Zoom/Zoom.node.ts +++ b/packages/nodes-base/nodes/Zoom/Zoom.node.ts @@ -3,7 +3,9 @@ import { IDataObject, INodeExecutionData, INodeType, + ILoadOptionsFunctions, INodeTypeDescription, + INodePropertyOptions, } from 'n8n-workflow'; import { zoomApiRequest, @@ -14,7 +16,30 @@ import { import { meetingOperations, meetingFields, -} from './ZoomOperations'; +} from './MeetingDescription'; + +import { + meetingRegistrantOperations, + meetingRegistrantFields, + +} from './MeetingRegistrantDescription'; + +import * as moment from 'moment-timezone'; + +interface Settings { + host_video?: boolean; + participant_video?: boolean; + 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; + +} export class Zoom implements INodeType { description: INodeTypeDescription = { displayName: 'Zoom', @@ -25,31 +50,11 @@ export class Zoom implements INodeType { subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}', defaults: { name: 'Zoom', - color: '#772244' + color: '#0B6CF9' }, icon: 'file:zoom.png', inputs: ['main'], outputs: ['main'], - // credentials: [ - // { - // name: 'zoomApi', - // required: true, - // displayOptions: { - // show: { - // authentication: ['accessToken'] - // } - // } - // }, - // { - // name: 'zoomOAuth2Api', - // required: true, - // displayOptions: { - // show: { - // authentication: ['oAuth2'] - // } - // } - // } - // ], credentials: [ { name: 'zoomApi', @@ -100,16 +105,41 @@ export class Zoom implements INodeType { { name: 'Meeting', value: 'meeting' + }, + { + name: 'Meeting Registrants', + value: 'meetingRegistrants' } ], default: 'meeting', description: 'The resource to operate on.' }, ...meetingOperations, - ...meetingFields + ...meetingFields, + ...meetingRegistrantOperations, + ...meetingRegistrantFields, ] }; + methods = { + loadOptions: { + // Get all the timezones to display them to user so that he can select them easily + async getTimezones( + this: ILoadOptionsFunctions + ): Promise { + const returnData: INodePropertyOptions[] = []; + for (const timezone of moment.tz.names()) { + const timezoneName = timezone; + const timezoneId = timezone; + returnData.push({ + name: timezoneName, + value: timezoneId + }); + } + return returnData; + } + } + }; async execute(this: IExecuteFunctions): Promise { const items = this.getInputData(); @@ -120,11 +150,13 @@ export class Zoom implements INodeType { const resource = this.getNodeParameter('resource', 0) as string; const operation = this.getNodeParameter('operation', 0) as string; console.log(this.getCredentials('zoomOAuth2Api')); + let body: IDataObject = {}; for (let i = 0; i < length; i++) { qs = {}; if (resource === 'meeting') { if (operation === 'get') { + //https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meeting const userId = this.getNodeParameter('userId', i) as string; responseData = await zoomApiRequest.call( @@ -135,6 +167,283 @@ export class Zoom implements INodeType { qs ); } + if (operation === 'getAll') { + //https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetings + const userId = this.getNodeParameter('userId', i) as string; + + responseData = await zoomApiRequest.call( + this, + 'GET', + `/users/${userId}/meetings`, + {}, + qs + ); + } + if (operation === 'delete') { + //https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingdelete + const meetingId = this.getNodeParameter('meetingId', i) as string; + 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; + qs.occurence_id = this.getNodeParameter('occurenceId', 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, + 'PATCH', + `/meetings/${meetingId}`, + body, + qs + ); + } + } + 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; + qs.occurence_id = this.getNodeParameter('occurenceId', i) as string; + responseData = await zoomApiRequest.call( + this, + 'PATCH', + `/meetings/${meetingId}/registrants`, + body, + qs + ); + } + if (operation === 'getAll') { + //https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingregistrants + } + if (operation === 'update') { + //https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingregistrantstatus + } } } if (Array.isArray(responseData)) { diff --git a/packages/nodes-base/nodes/Zoom/ZoomOperations.ts b/packages/nodes-base/nodes/Zoom/ZoomOperations.ts deleted file mode 100644 index 58f1825435..0000000000 --- a/packages/nodes-base/nodes/Zoom/ZoomOperations.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { - INodeProperties, -} from 'n8n-workflow'; - -export const meetingOperations = [ - { - displayName: 'Operation', - name: 'operation', - type: 'options', - displayOptions: { - show: { - resource: [ - 'meeting', - ], - }, - }, - options: [ - { - name: 'Create', - value: 'create', - description: 'Create a meeting', - }, - { - name: 'Delete', - value: 'delete', - description: 'Delete a meeting', - }, - { - name: 'Get', - value: 'get', - description: 'Retrieve a meeting', - }, - { - name: 'Get All', - value: 'getAll', - description: 'Retrieve all meetings', - }, - { - name: 'Update', - value: 'update', - description: 'Update a meeting', - } - ], - default: 'create', - description: 'The operation to perform.', - } -] as INodeProperties[]; - -export const meetingFields = [ - /* -------------------------------------------------------------------------- */ - /* meeting:get */ - /* -------------------------------------------------------------------------- */ - { - displayName: 'User Id', - name: 'userId', - type: 'string', - default: '', - required: true, - displayOptions: { - show: { - operation: [ - 'get', - ], - resource: [ - 'meeting', - ], - }, - }, - description: 'User ID.', - }, -] as INodeProperties[]; diff --git a/packages/workflow/LICENSE.md b/packages/workflow/LICENSE.md index aac54547eb..24a7d38fc9 100644 --- a/packages/workflow/LICENSE.md +++ b/packages/workflow/LICENSE.md @@ -215,7 +215,7 @@ Licensor: n8n GmbH same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright [yyyy] [name of copyright owner] + Copyright 2020 n8n GmbH Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From 815f823f5ac6371d2796d30da68792d473f20baf Mon Sep 17 00:00:00 2001 From: shraddha shaligram Date: Mon, 22 Jun 2020 18:39:21 -0700 Subject: [PATCH 04/20] add webinars and registrants resource --- .../nodes-base/nodes/Zoom/GenericFunctions.ts | 34 +- .../nodes/Zoom/MeetingDescription.ts | 107 ++- .../Zoom/MeetingRegistrantDescription.ts | 104 ++- .../nodes/Zoom/WebinarDescription.ts | 685 ++++++++++++++++++ packages/nodes-base/nodes/Zoom/Zoom.node.ts | 405 ++++++++++- 5 files changed, 1198 insertions(+), 137 deletions(-) create mode 100644 packages/nodes-base/nodes/Zoom/WebinarDescription.ts diff --git a/packages/nodes-base/nodes/Zoom/GenericFunctions.ts b/packages/nodes-base/nodes/Zoom/GenericFunctions.ts index 9cde3e67e2..d361a9761a 100644 --- a/packages/nodes-base/nodes/Zoom/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Zoom/GenericFunctions.ts @@ -31,8 +31,6 @@ export async function zoomApiRequest(this: IExecuteFunctions | IExecuteSingleFun if (Object.keys(query).length === 0) { delete options.qs; } - console.log("options"); - console.log(options); try { if (authenticationMethod === 'accessToken') { const credentials = this.getCredentials('zoomApi'); @@ -42,7 +40,6 @@ export async function zoomApiRequest(this: IExecuteFunctions | IExecuteSingleFun options.headers!.Authorization = `Bearer ${credentials.accessToken}`; //@ts-ignore - return await this.helpers.request(options); } else { //@ts-ignore @@ -78,9 +75,10 @@ export async function zoomApiRequestAllItems( ): Promise { // tslint:disable-line:no-any const returnData: IDataObject[] = []; + let responseData; - query.page = 1; - query.count = 100; + //query.maxResults = 300; + do { responseData = await zoomApiRequest.call( this, @@ -89,32 +87,14 @@ export async function zoomApiRequestAllItems( body, query ); - query.cursor = encodeURIComponent( - _.get(responseData, 'response_metadata.next_cursor') - ); - query.page++; + query.page_number = responseData['page_number']; returnData.push.apply(returnData, responseData[propertyName]); } while ( - (responseData.response_metadata !== undefined && - responseData.response_metadata.mext_cursor !== undefined && - responseData.response_metadata.next_cursor !== '' && - responseData.response_metadata.next_cursor !== null) || - (responseData.paging !== undefined && - responseData.paging.pages !== undefined && - responseData.paging.page !== undefined && - responseData.paging.page < responseData.paging.pages) + responseData['page_number'] !== undefined && + responseData['page_number'] !== '' ); return returnData; } -export function validateJSON(json: string | undefined): any { - // tslint:disable-line:no-any - let result; - try { - result = JSON.parse(json!); - } catch (exception) { - result = undefined; - } - return result; -} + diff --git a/packages/nodes-base/nodes/Zoom/MeetingDescription.ts b/packages/nodes-base/nodes/Zoom/MeetingDescription.ts index bd4b8ce271..274b48ff97 100644 --- a/packages/nodes-base/nodes/Zoom/MeetingDescription.ts +++ b/packages/nodes-base/nodes/Zoom/MeetingDescription.ts @@ -51,7 +51,7 @@ export const meetingFields = [ /* meeting:create */ /* -------------------------------------------------------------------------- */ { - displayName: 'Id', + displayName: 'User Id', name: 'userId', type: 'string', default: '', @@ -60,15 +60,13 @@ export const meetingFields = [ show: { operation: [ 'create', - - ], resource: [ 'meeting', ], }, }, - description: 'User ID.', + description: 'User ID or email address of user.', }, { displayName: 'Additional settings', @@ -239,15 +237,13 @@ export const meetingFields = [ name: 'Disabled', value: 'none', }, - - ], default: 'none', description: 'Auto recording.', }, { displayName: 'Audio', - name: 'auto_recording', + name: 'audio', type: 'options', options: [ { @@ -263,7 +259,6 @@ export const meetingFields = [ value: 'voip', }, - ], default: 'both', description: 'Determine how participants can join audio portion of the meeting.', @@ -285,22 +280,19 @@ export const meetingFields = [ name: 'Attendees register once and can choose one or more occurences to attend', value: 3, }, - - ], default: 1, description: 'Registration type. Used for recurring meetings with fixed time only', }, - ], }, /* -------------------------------------------------------------------------- */ /* meeting:get */ /* -------------------------------------------------------------------------- */ { - displayName: 'Id', - name: 'userId', + displayName: 'Meeting Id', + name: 'meetingId', type: 'string', default: '', required: true, @@ -314,13 +306,47 @@ export const meetingFields = [ ], }, }, - description: 'User ID.', + description: 'Meeting ID.', + }, + { + displayName: 'Additional settings', + name: 'additionalFields', + type: 'collection', + placeholder: 'Add Field', + default: {}, + displayOptions: { + show: { + operation: [ + 'get', + + ], + resource: [ + 'meeting', + ], + }, + }, + options: [ + { + displayName: 'Occurence Id', + name: 'occurenceId', + type: 'string', + default: '', + description: 'To view meeting details of a particular occurence of the recurring meeting.', + }, + { + displayName: 'Show Previous Occurences', + name: 'showPreviousOccurences', + type: 'boolean', + default: '', + description: 'To view meeting details of all previous occurences of the recurring meeting.', + }, + ], }, /* -------------------------------------------------------------------------- */ /* meeting:getAll */ /* -------------------------------------------------------------------------- */ { - displayName: 'Id', + displayName: 'User Id', name: 'userId', type: 'string', default: '', @@ -335,7 +361,7 @@ export const meetingFields = [ ], }, }, - description: 'User ID.', + description: 'User ID or email-id.', }, { displayName: 'Return All', @@ -393,7 +419,7 @@ export const meetingFields = [ resource: [ 'meeting', ], - } + }, }, options: [ { @@ -413,8 +439,6 @@ export const meetingFields = [ name: 'Upcoming', value: 'upcoming', }, - - ], default: 'live', description: `Meeting type.`, @@ -471,11 +495,8 @@ export const meetingFields = [ name: 'scheduleForReminder', type: 'boolean', default: false, - description: 'Schedule a reminder via email', + description: 'Notify hosts and alternative hosts about meeting cancellation via email', }, - - - ], }, @@ -492,8 +513,6 @@ export const meetingFields = [ show: { operation: [ 'update', - - ], resource: [ 'meeting', @@ -502,26 +521,6 @@ export const meetingFields = [ }, description: 'Meeting ID.', }, - { - displayName: 'Occurence Id', - name: 'occurenceId', - type: 'string', - default: '', - required: true, - displayOptions: { - show: { - operation: [ - 'update', - - - ], - resource: [ - 'meeting', - ], - }, - }, - description: 'Occurence ID.', - }, { displayName: 'Additional settings', name: 'additionalFields', @@ -531,15 +530,21 @@ export const meetingFields = [ displayOptions: { show: { operation: [ - 'update', ], resource: [ 'meeting', ], - } + }, }, options: [ + { + displayName: 'Occurence Id', + name: 'occurenceId', + type: 'string', + default: '', + description: 'Occurence ID.', + }, { displayName: 'Meeting topic', name: 'topic', @@ -691,8 +696,6 @@ export const meetingFields = [ name: 'Disabled', value: 'none', }, - - ], default: 'none', description: 'Auto recording.', @@ -714,8 +717,6 @@ export const meetingFields = [ name: 'VOIP', value: 'voip', }, - - ], default: 'both', description: 'Determine how participants can join audio portion of the meeting.', @@ -737,14 +738,10 @@ export const meetingFields = [ name: 'Attendees register once and can choose one or more occurences to attend', value: 3, }, - - ], default: 1, description: 'Registration type. Used for recurring meetings with fixed time only', }, - - ], }, diff --git a/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts b/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts index b062786892..592c7a285a 100644 --- a/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts +++ b/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts @@ -52,8 +52,6 @@ export const meetingRegistrantFields = [ show: { operation: [ 'create', - - ], resource: [ 'meetingRegistrants', @@ -63,31 +61,21 @@ export const meetingRegistrantFields = [ description: 'Meeting ID.', }, { - displayName: 'Occurence Id', - name: 'occurenceId', + displayName: 'Email', + name: 'email', type: 'string', - default: '', required: true, + default: '', displayOptions: { show: { operation: [ 'create', - - ], resource: [ 'meetingRegistrants', ], }, }, - description: 'Occurence ID.', - }, - { - displayName: 'Email', - name: 'email', - type: 'string', - required: true, - default: '', description: 'Valid email-id of registrant.', }, { @@ -96,6 +84,16 @@ export const meetingRegistrantFields = [ required: true, type: 'string', default: '', + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'meetingRegistrants', + ], + }, + }, description: 'First Name.', }, { @@ -107,7 +105,7 @@ export const meetingRegistrantFields = [ displayOptions: { show: { operation: [ - 'get', + 'create', ], resource: [ @@ -116,6 +114,13 @@ export const meetingRegistrantFields = [ } }, options: [ + { + displayName: 'Occurence Ids', + name: 'occurenceId', + type: 'string', + default: '', + description: 'Occurence IDs separated by comma.', + }, { displayName: 'Last Name', name: 'lastName', @@ -211,8 +216,6 @@ export const meetingRegistrantFields = [ name: 'No timeframe', value: 'No timeframe', }, - - ], default: '', description: 'Meeting type.' @@ -258,8 +261,6 @@ export const meetingRegistrantFields = [ show: { operation: [ 'getAll', - - ], resource: [ 'meetingRegistrants', @@ -318,7 +319,7 @@ export const meetingRegistrantFields = [ displayOptions: { show: { operation: [ - 'get', + 'getAll', ], resource: [ @@ -351,10 +352,8 @@ export const meetingRegistrantFields = [ name: 'Denied', value: 'denied', }, - - ], - default: '', + default: 'approved', description: `Registrant Status.`, }, @@ -366,15 +365,13 @@ export const meetingRegistrantFields = [ { displayName: 'Meeting Id', name: 'meetingId', - type: 'number', + type: 'string', default: '', required: true, displayOptions: { show: { operation: [ 'update', - - ], resource: [ 'meetingRegistrants', @@ -384,24 +381,63 @@ export const meetingRegistrantFields = [ description: 'Meeting ID.', }, { - displayName: 'Occurence Id', - name: 'occurenceId', - type: 'string', - default: '', + displayName: 'Action', + name: 'action', + type: 'options', required: true, displayOptions: { show: { operation: [ 'update', - - ], resource: [ 'meetingRegistrants', ], }, }, - description: 'Occurence ID.', + options: [ + { + name: 'Cancel', + value: 'cancel', + }, + { + name: 'Approved', + value: 'approve', + }, + { + name: 'Deny', + value: 'deny', + }, + ], + default: '', + description: `Registrant Status.`, }, + { + displayName: 'Additional settings', + name: 'additionalFields', + type: 'collection', + placeholder: 'Add Field', + default: {}, + displayOptions: { + show: { + operation: [ + 'update', + ], + resource: [ + 'meetingRegistrants', + ], + }, + }, + options: [ + { + displayName: 'Occurence Id', + name: 'occurenceId', + type: 'string', + default: '', + description: 'Occurence ID.', + }, + + ], + } ] as INodeProperties[]; diff --git a/packages/nodes-base/nodes/Zoom/WebinarDescription.ts b/packages/nodes-base/nodes/Zoom/WebinarDescription.ts new file mode 100644 index 0000000000..5cefbdace8 --- /dev/null +++ b/packages/nodes-base/nodes/Zoom/WebinarDescription.ts @@ -0,0 +1,685 @@ +import { + INodeProperties, +} from 'n8n-workflow'; + +export const webinarOperations = [ + { + displayName: 'Operation', + name: 'operation', + type: 'options', + displayOptions: { + show: { + resource: [ + 'webinar', + ], + }, + }, + options: [ + { + name: 'Create', + value: 'create', + description: 'Create a webinar', + }, + { + name: 'Delete', + value: 'delete', + description: 'Delete a webinar', + }, + { + name: 'Get', + value: 'get', + description: 'Retrieve a webinar', + }, + { + name: 'Get All', + value: 'getAll', + description: 'Retrieve all webinars', + }, + { + name: 'Update', + value: 'update', + description: 'Update a webinar', + } + ], + default: 'create', + description: 'The operation to perform.', + } +] as INodeProperties[]; + +export const webinarFields = [ + /* -------------------------------------------------------------------------- */ + /* webinar:create */ + /* -------------------------------------------------------------------------- */ + { + displayName: 'User Id', + name: 'userId', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'webinar', + ], + }, + }, + description: 'User ID or email address of user.', + }, + { + displayName: 'Additional settings', + name: 'additionalFields', + type: 'collection', + placeholder: 'Add Field', + default: {}, + displayOptions: { + show: { + operation: [ + 'create', + + ], + resource: [ + 'webinar', + ], + } + }, + options: [ + { + displayName: 'Webinar topic', + name: 'topic', + type: 'string', + default: '', + description: `Webinar topic.`, + }, + { + displayName: 'Webinar type', + name: 'type', + type: 'options', + options: [ + { + name: 'Webinar', + value: 5, + }, + { + name: 'Recurring webinar with no fixed time', + value: 6, + }, + { + name: 'Recurring webinar with fixed time', + value: 9, + }, + ], + default: 5, + description: 'Webinar type.' + }, + { + displayName: 'Start time', + name: 'startTime', + type: 'dateTime', + default: '', + description: 'Start time should be used only for scheduled or recurring webinar with fixed time', + }, + { + displayName: 'Duration', + name: 'duration', + type: 'string', + default: '', + description: 'Duration.', + }, + { + displayName: 'Timezone', + name: 'timeZone', + type: 'options', + typeOptions: { + loadOptionsMethod: 'getTimezones', + }, + default: '', + description: `Time zone used in the response. The default is the time zone of the calendar.`, + }, + { + displayName: 'Password', + name: 'password', + type: 'string', + default: '', + description: 'Password to join the webinar with maximum 10 characters.', + }, + { + displayName: 'Agenda', + name: 'agenda', + type: 'string', + default: '', + description: 'Webinar agenda.', + }, + { + displayName: 'Host Video', + name: 'host_video', + type: 'boolean', + default: false, + description: 'Start video when host joins the webinar.', + }, + { + displayName: 'Panelists Video', + name: 'panelists_video', + type: 'boolean', + default: false, + description: 'Start video when panelists joins the webinar.', + }, + { + displayName: 'Practice Session', + name: 'practice_session', + type: 'boolean', + default: false, + description: 'Enable Practice session.', + }, + { + displayName: 'Alternative Hosts', + name: 'alternative_hosts', + type: 'string', + default: '', + description: 'Alternative hosts email ids.', + }, + { + displayName: 'Approval type', + name: 'approval_type', + type: 'options', + options: [ + { + name: 'Automatically approve', + value: 0, + }, + { + name: 'Manually approve', + value: 1, + }, + { + name: 'No registration required', + value: 2, + }, + ], + default: 2, + description: 'Approval type.', + }, + { + displayName: 'Auto recording', + name: 'auto_recording', + type: 'options', + options: [ + { + name: 'Record on local', + value: 'local', + }, + { + name: 'Record on cloud', + value: 'cloud', + }, + { + name: 'Disabled', + value: 'none', + }, + ], + default: 'none', + description: 'Auto recording.', + }, + { + displayName: 'Audio', + name: 'audio', + type: 'options', + options: [ + { + name: 'Both Telephony and VoiP', + value: 'both', + }, + { + name: 'Telephony', + value: 'telephony', + }, + { + name: 'VOIP', + value: 'voip', + }, + + ], + default: 'both', + description: 'Determine how participants can join audio portion of the webinar.', + }, + { + displayName: 'Registration type', + name: 'registration_type', + type: 'options', + options: [ + { + name: 'Attendees register once and can attend any of the occurences', + value: 1, + }, + { + name: 'Attendees need to register for every occurence', + value: 2, + }, + { + name: 'Attendees register once and can choose one or more occurences to attend', + value: 3, + }, + ], + default: 1, + description: 'Registration type. Used for recurring webinar with fixed time only', + }, + + ], + }, + /* -------------------------------------------------------------------------- */ + /* webinar:get */ + /* -------------------------------------------------------------------------- */ + { + displayName: 'Webinar Id', + name: 'webinarId', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'get', + ], + resource: [ + 'webinar', + ], + }, + }, + description: 'Webinar ID.', + }, + { + displayName: 'Additional settings', + name: 'additionalFields', + type: 'collection', + placeholder: 'Add Field', + default: {}, + displayOptions: { + show: { + operation: [ + 'get', + + ], + resource: [ + 'webinar', + ], + }, + }, + options: [ + { + displayName: 'Occurence Id', + name: 'occurenceId', + type: 'string', + default: '', + description: 'To view webinar details of a particular occurence of the recurring webinar.', + }, + { + displayName: 'Show Previous Occurences', + name: 'showPreviousOccurences', + type: 'boolean', + default: '', + description: 'To view webinar details of all previous occurences of the recurring webinar.', + }, + ], + }, + /* -------------------------------------------------------------------------- */ + /* webinar:getAll */ + /* -------------------------------------------------------------------------- */ + { + displayName: 'User Id', + name: 'userId', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'getAll', + ], + resource: [ + 'webinar', + ], + }, + }, + description: 'User ID or email-id.', + }, + { + displayName: 'Return All', + name: 'returnAll', + type: 'boolean', + displayOptions: { + show: { + operation: [ + 'getAll', + ], + resource: [ + 'webinar', + ], + }, + }, + default: false, + description: 'If all results should be returned or only up to a given limit.', + }, + { + displayName: 'Limit', + name: 'limit', + type: 'number', + displayOptions: { + show: { + operation: [ + 'getAll', + ], + resource: [ + 'webinar', + ], + returnAll: [ + false, + ], + }, + }, + typeOptions: { + minValue: 1, + maxValue: 300 + }, + default: 30, + description: 'How many results to return.', + }, + { + displayName: 'Additional settings', + name: 'additionalFields', + type: 'collection', + placeholder: 'Add Field', + default: {}, + displayOptions: { + show: { + operation: [ + 'getAll', + + ], + resource: [ + 'webinar', + ], + }, + }, + + }, + /* -------------------------------------------------------------------------- */ + /* webina:delete */ + /* -------------------------------------------------------------------------- */ + { + displayName: 'Webinar Id', + name: 'webinarId', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'delete' + ], + resource: [ + 'webinarId', + ], + }, + }, + description: 'WebinarId ID.', + }, + { + displayName: 'Additional Fields', + name: 'additionalFields', + type: 'collection', + placeholder: 'Add Field', + default: {}, + displayOptions: { + show: { + operation: [ + 'delete', + ], + resource: [ + 'webinar', + ], + }, + }, + options: [ + { + displayName: 'Occurence Id', + name: 'occurenceId', + type: 'string', + default: '', + description: 'Webinar occurence Id.', + }, + + ], + + }, + /* -------------------------------------------------------------------------- */ + /* webinar:update */ + /* -------------------------------------------------------------------------- */ + { + displayName: 'User Id', + name: 'userId', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'update', + ], + resource: [ + 'webinar', + ], + }, + }, + description: 'User ID or email address of user.', + }, + { + displayName: 'Additional settings', + name: 'additionalFields', + type: 'collection', + placeholder: 'Add Field', + default: {}, + displayOptions: { + show: { + operation: [ + 'update', + + ], + resource: [ + 'webinar', + ], + } + }, + options: [ + { + displayName: 'Occurence Id', + name: 'occurence_id', + type: 'string', + default: '', + description: `Webinar occurence Id.`, + }, + { + displayName: 'Webinar topic', + name: 'topic', + type: 'string', + default: '', + description: `Webinar topic.`, + }, + { + displayName: 'Webinar type', + name: 'type', + type: 'options', + options: [ + { + name: 'Webinar', + value: 5, + }, + { + name: 'Recurring webinar with no fixed time', + value: 6, + }, + { + name: 'Recurring webinar with fixed time', + value: 9, + }, + ], + default: 5, + description: 'Webinar type.' + }, + { + displayName: 'Start time', + name: 'startTime', + type: 'dateTime', + default: '', + description: 'Start time should be used only for scheduled or recurring webinar with fixed time', + }, + { + displayName: 'Duration', + name: 'duration', + type: 'string', + default: '', + description: 'Duration.', + }, + { + displayName: 'Timezone', + name: 'timeZone', + type: 'options', + typeOptions: { + loadOptionsMethod: 'getTimezones', + }, + default: '', + description: `Time zone used in the response. The default is the time zone of the calendar.`, + }, + { + displayName: 'Password', + name: 'password', + type: 'string', + default: '', + description: 'Password to join the webinar with maximum 10 characters.', + }, + { + displayName: 'Agenda', + name: 'agenda', + type: 'string', + default: '', + description: 'Webinar agenda.', + }, + { + displayName: 'Host Video', + name: 'host_video', + type: 'boolean', + default: false, + description: 'Start video when host joins the webinar.', + }, + { + displayName: 'Panelists Video', + name: 'panelists_video', + type: 'boolean', + default: false, + description: 'Start video when panelists joins the webinar.', + }, + { + displayName: 'Practice Session', + name: 'practice_session', + type: 'boolean', + default: false, + description: 'Enable Practice session.', + }, + { + displayName: 'Alternative Hosts', + name: 'alternative_hosts', + type: 'string', + default: '', + description: 'Alternative hosts email ids.', + }, + { + displayName: 'Approval type', + name: 'approval_type', + type: 'options', + options: [ + { + name: 'Automatically approve', + value: 0, + }, + { + name: 'Manually approve', + value: 1, + }, + { + name: 'No registration required', + value: 2, + }, + ], + default: 2, + description: 'Approval type.', + }, + { + displayName: 'Auto recording', + name: 'auto_recording', + type: 'options', + options: [ + { + name: 'Record on local', + value: 'local', + }, + { + name: 'Record on cloud', + value: 'cloud', + }, + { + name: 'Disabled', + value: 'none', + }, + ], + default: 'none', + description: 'Auto recording.', + }, + { + displayName: 'Audio', + name: 'audio', + type: 'options', + options: [ + { + name: 'Both Telephony and VoiP', + value: 'both', + }, + { + name: 'Telephony', + value: 'telephony', + }, + { + name: 'VOIP', + value: 'voip', + }, + + ], + default: 'both', + description: 'Determine how participants can join audio portion of the webinar.', + }, + { + displayName: 'Registration type', + name: 'registration_type', + type: 'options', + options: [ + { + name: 'Attendees register once and can attend any of the occurences', + value: 1, + }, + { + name: 'Attendees need to register for every occurence', + value: 2, + }, + { + name: 'Attendees register once and can choose one or more occurences to attend', + value: 3, + }, + ], + default: 1, + description: 'Registration type. Used for recurring webinars with fixed time only', + }, + + ], + }, + +] as INodeProperties[]; diff --git a/packages/nodes-base/nodes/Zoom/Zoom.node.ts b/packages/nodes-base/nodes/Zoom/Zoom.node.ts index c1915d4ab4..fb3b7565f7 100644 --- a/packages/nodes-base/nodes/Zoom/Zoom.node.ts +++ b/packages/nodes-base/nodes/Zoom/Zoom.node.ts @@ -1,4 +1,6 @@ -import { IExecuteFunctions } from 'n8n-core'; +import { + IExecuteFunctions, +} from 'n8n-core'; import { IDataObject, INodeExecutionData, @@ -10,7 +12,6 @@ import { import { zoomApiRequest, zoomApiRequestAllItems, - validateJSON, } from './GenericFunctions'; import { @@ -24,11 +25,16 @@ import { } from './MeetingRegistrantDescription'; +import { + webinarOperations, + webinarFields, +} from './WebinarDescription'; import * as moment from 'moment-timezone'; interface Settings { host_video?: boolean; participant_video?: boolean; + panelists_video?: boolean; cn_meeting?: boolean; in_meeting?: boolean; join_before_host?: boolean; @@ -38,6 +44,9 @@ interface Settings { alternative_hosts?: string; auto_recording?: string; registration_type?: number; + approval_type?: number; + practice_session?: boolean; + } export class Zoom implements INodeType { @@ -107,17 +116,28 @@ export class Zoom implements INodeType { value: 'meeting' }, { - name: 'Meeting Registrants', + name: 'Meeting Registrant', value: 'meetingRegistrants' + }, + { + name: 'Webinar', + value: 'webinar' } ], default: 'meeting', description: 'The resource to operate on.' }, + //MEETINGS ...meetingOperations, ...meetingFields, + + //MEETING REGISTRANTS ...meetingRegistrantOperations, ...meetingRegistrantFields, + + //WEBINARS + ...webinarOperations, + ...webinarFields, ] }; @@ -149,20 +169,30 @@ export class Zoom implements INodeType { let responseData; const resource = this.getNodeParameter('resource', 0) as string; const operation = this.getNodeParameter('operation', 0) as string; - console.log(this.getCredentials('zoomOAuth2Api')); let body: IDataObject = {}; for (let i = 0; i < length; i++) { qs = {}; + //https://marketplace.zoom.us/docs/api-reference/zoom-api/ if (resource === 'meeting') { if (operation === 'get') { //https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meeting - const userId = this.getNodeParameter('userId', i) as string; + const meetingId = this.getNodeParameter('meetingId', i) as string; + + const additionalFields = this.getNodeParameter( + 'additionalFields', + i + ) as IDataObject; + if (additionalFields.showPreviousOccurences) + qs.show_previous_occurences = additionalFields.showPreviousOccurences as boolean; + + if (additionalFields.occurenceId) + qs.occurence_id = additionalFields.occurenceId as string; responseData = await zoomApiRequest.call( this, 'GET', - `/meetings/${userId}`, + `/meetings/${meetingId}`, {}, qs ); @@ -170,18 +200,30 @@ export class Zoom implements INodeType { if (operation === 'getAll') { //https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetings 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}/meetings`, {}, qs); + } else { + const limit = this.getNodeParameter('limit', i) as number; + qs.page_size = limit; + responseData = await zoomApiRequest.call(this, 'GET', `/users/${userId}/meetings`, {}, qs); + responseData = responseData.results; + } - responseData = await zoomApiRequest.call( - this, - 'GET', - `/users/${userId}/meetings`, - {}, - qs - ); } if (operation === 'delete') { //https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingdelete const meetingId = this.getNodeParameter('meetingId', i) as string; + const additionalFields = this.getNodeParameter( + 'additionalFields', + i + ) as IDataObject; + if (additionalFields.scheduleForReminder) + qs.schedule_for_reminder = additionalFields.scheduleForReminder as boolean; + + if (additionalFields.occurenceId) + qs.occurence_id = additionalFields.occurenceId; + responseData = await zoomApiRequest.call( this, 'DELETE', @@ -297,10 +339,6 @@ export class Zoom implements INodeType { body.agenda = additionalFields.agenda as string; } - - - - responseData = await zoomApiRequest.call( this, 'POST', @@ -312,12 +350,16 @@ export class Zoom implements INodeType { if (operation === 'update') { //https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingupdate const meetingId = this.getNodeParameter('meetingId', i) as string; - qs.occurence_id = this.getNodeParameter('occurenceId', i) as string; + const settings: Settings = {}; const additionalFields = this.getNodeParameter( 'additionalFields', i ) as IDataObject; - const settings: Settings = {}; + + if (additionalFields.occurenceId) { + qs.occurence_id = additionalFields.occurenceId as string; + } + if (additionalFields.cn_meeting) { settings.cn_meeting = additionalFields.cn_meeting as boolean; @@ -423,16 +465,64 @@ export class Zoom implements INodeType { body, qs ); + responseData = { updated: true }; + } } 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; - qs.occurence_id = this.getNodeParameter('occurenceId', i) as string; + 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; + if (additionalFields.occurenceId) { + qs.occurence_ids = additionalFields.occurenceId as string; + } + 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; + } responseData = await zoomApiRequest.call( this, - 'PATCH', + 'POST', `/meetings/${meetingId}/registrants`, body, qs @@ -440,9 +530,282 @@ export class Zoom implements INodeType { } if (operation === 'getAll') { //https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingregistrants + const meetingId = this.getNodeParameter('meetingId', i) as string; + const additionalFields = this.getNodeParameter( + 'additionalFields', + i + ) as IDataObject; + if (additionalFields.occurenceId) { + qs.occurence_id = additionalFields.occurenceId as string; + } + 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; + } + } if (operation === 'update') { //https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingregistrantstatus + const meetingId = this.getNodeParameter('meetingId', i) as string; + const additionalFields = this.getNodeParameter( + 'additionalFields', + i + ) as IDataObject; + if (additionalFields.occurenceId) { + qs.occurence_id = additionalFields.occurenceId as string; + } + 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; + if (additionalFields.showPreviousOccurences) + qs.show_previous_occurences = additionalFields.showPreviousOccurences as boolean; + + if (additionalFields.occurenceId) + qs.occurence_id = additionalFields.occurenceId as string; + + 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; + + + if (additionalFields.occurenceId) + qs.occurence_id = additionalFields.occurenceId; + + 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; + if (additionalFields.occurence_id) { + qs.occurence_id = additionalFields.occurence_id as string; + + } + 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 + ); } } } From 807db166fd6ec8b46ed987d15cc254606307eb2b Mon Sep 17 00:00:00 2001 From: shraddha shaligram Date: Tue, 23 Jun 2020 12:14:04 -0700 Subject: [PATCH 05/20] refactor code --- .../nodes/Zoom/MeetingDescription.ts | 498 +++++++++--------- .../Zoom/MeetingRegistrantDescription.ts | 59 ++- .../nodes/Zoom/WebinarDescription.ts | 396 +++++++------- packages/nodes-base/nodes/Zoom/Zoom.node.ts | 28 +- 4 files changed, 489 insertions(+), 492 deletions(-) diff --git a/packages/nodes-base/nodes/Zoom/MeetingDescription.ts b/packages/nodes-base/nodes/Zoom/MeetingDescription.ts index 274b48ff97..b9a1c74cb5 100644 --- a/packages/nodes-base/nodes/Zoom/MeetingDescription.ts +++ b/packages/nodes-base/nodes/Zoom/MeetingDescription.ts @@ -86,77 +86,6 @@ export const meetingFields = [ } }, options: [ - { - displayName: 'Meeting topic', - name: 'topic', - type: 'string', - default: '', - description: `Meeting topic.`, - }, - { - displayName: 'Meeting type', - name: 'type', - type: 'options', - options: [ - { - name: 'Instant Meeting', - value: 1, - }, - { - name: 'Scheduled Meeting', - value: 2, - }, - { - name: 'Recurring meeting with no fixed time', - value: 3, - }, - { - name: 'Recurring meeting with no fixed time', - value: 8, - }, - - ], - default: 2, - description: 'Meeting type.' - }, - { - displayName: 'Start time', - name: 'startTime', - type: 'dateTime', - default: '', - description: 'Start time should be used only for scheduled or recurring meetings with fixed time', - }, - { - displayName: 'Duration', - name: 'duration', - type: 'number', - default: '', - description: 'Duration.', - }, - { - displayName: 'Timezone', - name: 'timeZone', - type: 'options', - typeOptions: { - loadOptionsMethod: 'getTimezones', - }, - default: '', - description: `Time zone used in the response. The default is the time zone of the calendar.`, - }, - { - displayName: 'Schedule for', - name: 'scheduleFor', - type: 'string', - default: '', - description: 'Schedule meeting for someone else from your account, provide their email id.', - }, - { - displayName: 'Password', - name: 'password', - type: 'string', - default: '', - description: 'Password to join the meeting with maximum 10 characters.', - }, { displayName: 'Agenda', name: 'agenda', @@ -164,55 +93,6 @@ export const meetingFields = [ default: '', description: 'Meeting agenda.', }, - { - displayName: 'Host Meeting in China', - name: 'cn_meeting', - type: 'boolean', - default: false, - description: 'Host Meeting in China.', - }, - { - displayName: 'Host Meeting in India', - name: 'in_meeting', - type: 'boolean', - default: false, - description: 'Host Meeting in India.', - }, - { - displayName: 'Host Video', - name: 'host_video', - type: 'boolean', - default: false, - description: 'Start video when host joins the meeting.', - }, - { - displayName: 'Participant Video', - name: 'participant_video', - type: 'boolean', - default: false, - description: 'Start video when participant joins the meeting.', - }, - { - displayName: 'Join before Host', - name: 'join_before_host', - type: 'boolean', - default: false, - description: 'Allow participants to join the meeting before host starts it.', - }, - { - displayName: 'Muting before entry', - name: 'mute_upon_entry', - type: 'boolean', - default: false, - description: 'Mute participants upon entry.', - }, - { - displayName: 'Watermark', - name: 'watermark', - type: 'boolean', - default: false, - description: 'Adds watermark when viewing a shared screen.', - }, { displayName: 'Alternative Hosts', name: 'alternative_hosts', @@ -263,6 +143,95 @@ export const meetingFields = [ default: 'both', description: 'Determine how participants can join audio portion of the meeting.', }, + { + displayName: 'Duration', + name: 'duration', + type: 'number', + default: '', + description: 'Duration.', + }, + { + displayName: 'Host Meeting in China', + name: 'cn_meeting', + type: 'boolean', + default: false, + description: 'Host Meeting in China.', + }, + { + displayName: 'Host Meeting in India', + name: 'in_meeting', + type: 'boolean', + default: false, + description: 'Host Meeting in India.', + }, + { + displayName: 'Host Video', + name: 'host_video', + type: 'boolean', + default: false, + description: 'Start video when host joins the meeting.', + }, + { + displayName: 'Join before Host', + name: 'join_before_host', + type: 'boolean', + default: false, + description: 'Allow participants to join the meeting before host starts it.', + }, + { + displayName: 'Meeting topic', + name: 'topic', + type: 'string', + default: '', + description: `Meeting topic.`, + }, + { + displayName: 'Meeting type', + name: 'type', + type: 'options', + options: [ + { + name: 'Instant Meeting', + value: 1, + }, + { + name: 'Scheduled Meeting', + value: 2, + }, + { + name: 'Recurring meeting with no fixed time', + value: 3, + }, + { + name: 'Recurring meeting with no fixed time', + value: 8, + }, + + ], + default: 2, + description: 'Meeting type.' + }, + { + displayName: 'Muting before entry', + name: 'mute_upon_entry', + type: 'boolean', + default: false, + description: 'Mute participants upon entry.', + }, + { + displayName: 'Participant Video', + name: 'participant_video', + type: 'boolean', + default: false, + description: 'Start video when participant joins the meeting.', + }, + { + displayName: 'Password', + name: 'password', + type: 'string', + default: '', + description: 'Password to join the meeting with maximum 10 characters.', + }, { displayName: 'Registration type', name: 'registration_type', @@ -284,7 +253,37 @@ export const meetingFields = [ default: 1, description: 'Registration type. Used for recurring meetings with fixed time only', }, - + { + displayName: 'Schedule for', + name: 'scheduleFor', + type: 'string', + default: '', + description: 'Schedule meeting for someone else from your account, provide their email id.', + }, + { + displayName: 'Start time', + name: 'startTime', + type: 'dateTime', + default: '', + description: 'Start time should be used only for scheduled or recurring meetings with fixed time', + }, + { + displayName: 'Timezone', + name: 'timeZone', + type: 'options', + typeOptions: { + loadOptionsMethod: 'getTimezones', + }, + default: '', + description: `Time zone used in the response. The default is the time zone of the calendar.`, + }, + { + displayName: 'Watermark', + name: 'watermark', + type: 'boolean', + default: false, + description: 'Adds watermark when viewing a shared screen.', + }, ], }, /* -------------------------------------------------------------------------- */ @@ -538,6 +537,98 @@ export const meetingFields = [ }, }, options: [ + { + displayName: 'Agenda', + name: 'agenda', + type: 'string', + default: '', + description: 'Meeting agenda.', + }, + { + displayName: 'Alternative Hosts', + name: 'alternative_hosts', + type: 'string', + default: '', + description: 'Alternative hosts email ids.', + }, + { + displayName: 'Audio', + name: 'auto_recording', + type: 'options', + options: [ + { + name: 'Both Telephony and VoiP', + value: 'both', + }, + { + name: 'Telephony', + value: 'telephony', + }, + { + name: 'VOIP', + value: 'voip', + }, + ], + default: 'both', + description: 'Determine how participants can join audio portion of the meeting.', + }, + { + displayName: 'Auto recording', + name: 'auto_recording', + type: 'options', + options: [ + { + name: 'Record on local', + value: 'local', + }, + { + name: 'Record on cloud', + value: 'cloud', + }, + { + name: 'Disabled', + value: 'none', + }, + ], + default: 'none', + description: 'Auto recording.', + }, + + { + displayName: 'Duration', + name: 'duration', + type: 'number', + default: '', + description: 'Duration.', + }, + { + displayName: 'Join before Host', + name: 'join_before_host', + type: 'boolean', + default: false, + description: 'Allow participants to join the meeting before host starts it.', + }, + { + displayName: 'Host Meeting in China', + name: 'cn_meeting', + type: 'boolean', + default: false, + description: 'Host Meeting in China.', + }, + { + displayName: 'Host Meeting in India', + name: 'in_meeting', + type: 'boolean', + default: false, + description: 'Host Meeting in India.', + }, + { + displayName: 'Host Video', + name: 'host_video', + type: 'boolean', + default: false, + description: 'Start video when host joins the meeting.', + }, { displayName: 'Occurence Id', name: 'occurenceId', @@ -579,35 +670,11 @@ export const meetingFields = [ description: 'Meeting type.' }, { - displayName: 'Start time', - name: 'startTime', - type: 'dateTime', - default: '', - description: 'Start time should be used only for scheduled or recurring meetings with fixed time', - }, - { - displayName: 'Duration', - name: 'duration', - type: 'number', - default: '', - description: 'Duration.', - }, - { - displayName: 'Timezone', - name: 'timeZone', - type: 'options', - typeOptions: { - loadOptionsMethod: 'getTimezones', - }, - default: '', - description: `Time zone used in the response. The default is the time zone of the calendar.`, - }, - { - displayName: 'Schedule for', - name: 'scheduleFor', - type: 'string', - default: '', - description: 'Schedule meeting for someone else from your account, provide their email id.', + displayName: 'Muting before entry', + name: 'mute_upon_entry', + type: 'boolean', + default: false, + description: 'Mute participants upon entry.', }, { displayName: 'Password', @@ -616,34 +683,6 @@ export const meetingFields = [ default: '', description: 'Password to join the meeting with maximum 10 characters.', }, - { - displayName: 'Agenda', - name: 'agenda', - type: 'string', - default: '', - description: 'Meeting agenda.', - }, - { - displayName: 'Host Meeting in China', - name: 'cn_meeting', - type: 'boolean', - default: false, - description: 'Host Meeting in China.', - }, - { - displayName: 'Host Meeting in India', - name: 'in_meeting', - type: 'boolean', - default: false, - description: 'Host Meeting in India.', - }, - { - displayName: 'Host Video', - name: 'host_video', - type: 'boolean', - default: false, - description: 'Start video when host joins the meeting.', - }, { displayName: 'Participant Video', name: 'participant_video', @@ -651,76 +690,6 @@ export const meetingFields = [ default: false, description: 'Start video when participant joins the meeting.', }, - { - displayName: 'Join before Host', - name: 'join_before_host', - type: 'boolean', - default: false, - description: 'Allow participants to join the meeting before host starts it.', - }, - { - displayName: 'Muting before entry', - name: 'mute_upon_entry', - type: 'boolean', - default: false, - description: 'Mute participants upon entry.', - }, - { - displayName: 'Watermark', - name: 'watermark', - type: 'boolean', - default: false, - description: 'Adds watermark when viewing a shared screen.', - }, - { - displayName: 'Alternative Hosts', - name: 'alternative_hosts', - type: 'string', - default: '', - description: 'Alternative hosts email ids.', - }, - { - displayName: 'Auto recording', - name: 'auto_recording', - type: 'options', - options: [ - { - name: 'Record on local', - value: 'local', - }, - { - name: 'Record on cloud', - value: 'cloud', - }, - { - name: 'Disabled', - value: 'none', - }, - ], - default: 'none', - description: 'Auto recording.', - }, - { - displayName: 'Audio', - name: 'auto_recording', - type: 'options', - options: [ - { - name: 'Both Telephony and VoiP', - value: 'both', - }, - { - name: 'Telephony', - value: 'telephony', - }, - { - name: 'VOIP', - value: 'voip', - }, - ], - default: 'both', - description: 'Determine how participants can join audio portion of the meeting.', - }, { displayName: 'Registration type', name: 'registration_type', @@ -742,6 +711,39 @@ export const meetingFields = [ default: 1, description: 'Registration type. Used for recurring meetings with fixed time only', }, + { + displayName: 'Schedule for', + name: 'scheduleFor', + type: 'string', + default: '', + description: 'Schedule meeting for someone else from your account, provide their email id.', + }, + { + displayName: 'Start time', + name: 'startTime', + type: 'dateTime', + default: '', + description: 'Start time should be used only for scheduled or recurring meetings with fixed time', + }, + { + displayName: 'Timezone', + name: 'timeZone', + type: 'options', + typeOptions: { + loadOptionsMethod: 'getTimezones', + }, + default: '', + description: `Time zone used in the response. The default is the time zone of the calendar.`, + }, + { + displayName: 'Watermark', + name: 'watermark', + type: 'boolean', + default: false, + description: 'Adds watermark when viewing a shared screen.', + }, + + ], }, diff --git a/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts b/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts index 592c7a285a..232f8cf42c 100644 --- a/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts +++ b/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts @@ -114,20 +114,6 @@ export const meetingRegistrantFields = [ } }, options: [ - { - displayName: 'Occurence Ids', - name: 'occurenceId', - type: 'string', - default: '', - description: 'Occurence IDs separated by comma.', - }, - { - displayName: 'Last Name', - name: 'lastName', - type: 'string', - default: '', - description: 'Last Name.', - }, { displayName: 'Address', name: 'address', @@ -143,11 +129,11 @@ export const meetingRegistrantFields = [ description: 'Valid city of registrant.', }, { - displayName: 'State', - name: 'state', + displayName: 'Comments', + name: 'comments', type: 'string', default: '', - description: 'Valid state of registrant.', + description: 'Allows registrants to provide any questions they have.', }, { displayName: 'Country', @@ -157,25 +143,25 @@ export const meetingRegistrantFields = [ description: 'Valid country of registrant.', }, { - displayName: 'Zip code', - name: 'zip', + displayName: 'Job title', + name: 'job_title', type: 'string', default: '', - description: 'Valid zip-code of registrant.', + description: 'Job title of registrant.', }, { - displayName: 'Phone Number', - name: 'phone', + displayName: 'Last Name', + name: 'lastName', type: 'string', default: '', - description: 'Valid phone number of registrant.', + description: 'Last Name.', }, { - displayName: 'Comments', - name: 'comments', + displayName: 'Occurence Ids', + name: 'occurenceId', type: 'string', default: '', - description: 'Allows registrants to provide any questions they have.', + description: 'Occurence IDs separated by comma.', }, { displayName: 'Organization', @@ -185,11 +171,11 @@ export const meetingRegistrantFields = [ description: 'Organization of registrant.', }, { - displayName: 'Job title', - name: 'job_title', + displayName: 'Phone Number', + name: 'phone', type: 'string', default: '', - description: 'Job title of registrant.', + description: 'Valid phone number of registrant.', }, { displayName: 'Purchasing time frame', @@ -246,6 +232,21 @@ export const meetingRegistrantFields = [ default: '', description: 'Role in purchase process.' }, + { + displayName: 'State', + name: 'state', + type: 'string', + default: '', + description: 'Valid state of registrant.', + }, + { + displayName: 'Zip code', + name: 'zip', + type: 'string', + default: '', + description: 'Valid zip-code of registrant.', + }, + ], }, /* -------------------------------------------------------------------------- */ diff --git a/packages/nodes-base/nodes/Zoom/WebinarDescription.ts b/packages/nodes-base/nodes/Zoom/WebinarDescription.ts index 5cefbdace8..4bbec11fd4 100644 --- a/packages/nodes-base/nodes/Zoom/WebinarDescription.ts +++ b/packages/nodes-base/nodes/Zoom/WebinarDescription.ts @@ -86,65 +86,6 @@ export const webinarFields = [ } }, options: [ - { - displayName: 'Webinar topic', - name: 'topic', - type: 'string', - default: '', - description: `Webinar topic.`, - }, - { - displayName: 'Webinar type', - name: 'type', - type: 'options', - options: [ - { - name: 'Webinar', - value: 5, - }, - { - name: 'Recurring webinar with no fixed time', - value: 6, - }, - { - name: 'Recurring webinar with fixed time', - value: 9, - }, - ], - default: 5, - description: 'Webinar type.' - }, - { - displayName: 'Start time', - name: 'startTime', - type: 'dateTime', - default: '', - description: 'Start time should be used only for scheduled or recurring webinar with fixed time', - }, - { - displayName: 'Duration', - name: 'duration', - type: 'string', - default: '', - description: 'Duration.', - }, - { - displayName: 'Timezone', - name: 'timeZone', - type: 'options', - typeOptions: { - loadOptionsMethod: 'getTimezones', - }, - default: '', - description: `Time zone used in the response. The default is the time zone of the calendar.`, - }, - { - displayName: 'Password', - name: 'password', - type: 'string', - default: '', - description: 'Password to join the webinar with maximum 10 characters.', - }, { displayName: 'Agenda', name: 'agenda', @@ -152,27 +93,6 @@ export const webinarFields = [ default: '', description: 'Webinar agenda.', }, - { - displayName: 'Host Video', - name: 'host_video', - type: 'boolean', - default: false, - description: 'Start video when host joins the webinar.', - }, - { - displayName: 'Panelists Video', - name: 'panelists_video', - type: 'boolean', - default: false, - description: 'Start video when panelists joins the webinar.', - }, - { - displayName: 'Practice Session', - name: 'practice_session', - type: 'boolean', - default: false, - description: 'Enable Practice session.', - }, { displayName: 'Alternative Hosts', name: 'alternative_hosts', @@ -201,27 +121,6 @@ export const webinarFields = [ default: 2, description: 'Approval type.', }, - { - displayName: 'Auto recording', - name: 'auto_recording', - type: 'options', - options: [ - { - name: 'Record on local', - value: 'local', - }, - { - name: 'Record on cloud', - value: 'cloud', - }, - { - name: 'Disabled', - value: 'none', - }, - ], - default: 'none', - description: 'Auto recording.', - }, { displayName: 'Audio', name: 'audio', @@ -244,6 +143,62 @@ export const webinarFields = [ default: 'both', description: 'Determine how participants can join audio portion of the webinar.', }, + { + displayName: 'Auto recording', + name: 'auto_recording', + type: 'options', + options: [ + { + name: 'Record on local', + value: 'local', + }, + { + name: 'Record on cloud', + value: 'cloud', + }, + { + name: 'Disabled', + value: 'none', + }, + ], + default: 'none', + description: 'Auto recording.', + }, + { + displayName: 'Duration', + name: 'duration', + type: 'string', + default: '', + description: 'Duration.', + }, + { + displayName: 'Host Video', + name: 'host_video', + type: 'boolean', + default: false, + description: 'Start video when host joins the webinar.', + }, + { + displayName: 'Panelists Video', + name: 'panelists_video', + type: 'boolean', + default: false, + description: 'Start video when panelists joins the webinar.', + }, + { + displayName: 'Password', + name: 'password', + type: 'string', + default: '', + description: 'Password to join the webinar with maximum 10 characters.', + }, + { + displayName: 'Practice Session', + name: 'practice_session', + type: 'boolean', + default: false, + description: 'Enable Practice session.', + }, { displayName: 'Registration type', name: 'registration_type', @@ -265,6 +220,51 @@ export const webinarFields = [ default: 1, description: 'Registration type. Used for recurring webinar with fixed time only', }, + { + displayName: 'Start time', + name: 'startTime', + type: 'dateTime', + default: '', + description: 'Start time should be used only for scheduled or recurring webinar with fixed time', + }, + { + displayName: 'Timezone', + name: 'timeZone', + type: 'options', + typeOptions: { + loadOptionsMethod: 'getTimezones', + }, + default: '', + description: `Time zone used in the response. The default is the time zone of the calendar.`, + }, + { + displayName: 'Webinar topic', + name: 'topic', + type: 'string', + default: '', + description: `Webinar topic.`, + }, + { + displayName: 'Webinar type', + name: 'type', + type: 'options', + options: [ + { + name: 'Webinar', + value: 5, + }, + { + name: 'Recurring webinar with no fixed time', + value: 6, + }, + { + name: 'Recurring webinar with fixed time', + value: 9, + }, + ], + default: 5, + description: 'Webinar type.' + }, ], }, @@ -385,25 +385,6 @@ export const webinarFields = [ default: 30, description: 'How many results to return.', }, - { - displayName: 'Additional settings', - name: 'additionalFields', - type: 'collection', - placeholder: 'Add Field', - default: {}, - displayOptions: { - show: { - operation: [ - 'getAll', - - ], - resource: [ - 'webinar', - ], - }, - }, - - }, /* -------------------------------------------------------------------------- */ /* webina:delete */ /* -------------------------------------------------------------------------- */ @@ -492,72 +473,6 @@ export const webinarFields = [ } }, options: [ - { - displayName: 'Occurence Id', - name: 'occurence_id', - type: 'string', - default: '', - description: `Webinar occurence Id.`, - }, - { - displayName: 'Webinar topic', - name: 'topic', - type: 'string', - default: '', - description: `Webinar topic.`, - }, - { - displayName: 'Webinar type', - name: 'type', - type: 'options', - options: [ - { - name: 'Webinar', - value: 5, - }, - { - name: 'Recurring webinar with no fixed time', - value: 6, - }, - { - name: 'Recurring webinar with fixed time', - value: 9, - }, - ], - default: 5, - description: 'Webinar type.' - }, - { - displayName: 'Start time', - name: 'startTime', - type: 'dateTime', - default: '', - description: 'Start time should be used only for scheduled or recurring webinar with fixed time', - }, - { - displayName: 'Duration', - name: 'duration', - type: 'string', - default: '', - description: 'Duration.', - }, - { - displayName: 'Timezone', - name: 'timeZone', - type: 'options', - typeOptions: { - loadOptionsMethod: 'getTimezones', - }, - default: '', - description: `Time zone used in the response. The default is the time zone of the calendar.`, - }, - { - displayName: 'Password', - name: 'password', - type: 'string', - default: '', - description: 'Password to join the webinar with maximum 10 characters.', - }, { displayName: 'Agenda', name: 'agenda', @@ -565,27 +480,6 @@ export const webinarFields = [ default: '', description: 'Webinar agenda.', }, - { - displayName: 'Host Video', - name: 'host_video', - type: 'boolean', - default: false, - description: 'Start video when host joins the webinar.', - }, - { - displayName: 'Panelists Video', - name: 'panelists_video', - type: 'boolean', - default: false, - description: 'Start video when panelists joins the webinar.', - }, - { - displayName: 'Practice Session', - name: 'practice_session', - type: 'boolean', - default: false, - description: 'Enable Practice session.', - }, { displayName: 'Alternative Hosts', name: 'alternative_hosts', @@ -657,6 +551,48 @@ export const webinarFields = [ default: 'both', description: 'Determine how participants can join audio portion of the webinar.', }, + { + displayName: 'Duration', + name: 'duration', + type: 'string', + default: '', + description: 'Duration.', + }, + { + displayName: 'Host Video', + name: 'host_video', + type: 'boolean', + default: false, + description: 'Start video when host joins the webinar.', + }, + { + displayName: 'Occurence Id', + name: 'occurence_id', + type: 'string', + default: '', + description: `Webinar occurence Id.`, + }, + { + displayName: 'Password', + name: 'password', + type: 'string', + default: '', + description: 'Password to join the webinar with maximum 10 characters.', + }, + { + displayName: 'Panelists Video', + name: 'panelists_video', + type: 'boolean', + default: false, + description: 'Start video when panelists joins the webinar.', + }, + { + displayName: 'Practice Session', + name: 'practice_session', + type: 'boolean', + default: false, + description: 'Enable Practice session.', + }, { displayName: 'Registration type', name: 'registration_type', @@ -678,7 +614,51 @@ export const webinarFields = [ default: 1, description: 'Registration type. Used for recurring webinars with fixed time only', }, - + { + displayName: 'Start time', + name: 'startTime', + type: 'dateTime', + default: '', + description: 'Start time should be used only for scheduled or recurring webinar with fixed time', + }, + { + displayName: 'Timezone', + name: 'timeZone', + type: 'options', + typeOptions: { + loadOptionsMethod: 'getTimezones', + }, + default: '', + description: `Time zone used in the response. The default is the time zone of the calendar.`, + }, + { + displayName: 'Webinar topic', + name: 'topic', + type: 'string', + default: '', + description: `Webinar topic.`, + }, + { + displayName: 'Webinar type', + name: 'type', + type: 'options', + options: [ + { + name: 'Webinar', + value: 5, + }, + { + name: 'Recurring webinar with no fixed time', + value: 6, + }, + { + name: 'Recurring webinar with fixed time', + value: 9, + }, + ], + default: 5, + description: 'Webinar type.' + }, ], }, diff --git a/packages/nodes-base/nodes/Zoom/Zoom.node.ts b/packages/nodes-base/nodes/Zoom/Zoom.node.ts index fb3b7565f7..8e6eb10d2b 100644 --- a/packages/nodes-base/nodes/Zoom/Zoom.node.ts +++ b/packages/nodes-base/nodes/Zoom/Zoom.node.ts @@ -183,12 +183,16 @@ export class Zoom implements INodeType { 'additionalFields', i ) as IDataObject; - if (additionalFields.showPreviousOccurences) + if (additionalFields.showPreviousOccurences) { qs.show_previous_occurences = additionalFields.showPreviousOccurences as boolean; - if (additionalFields.occurenceId) + } + + if (additionalFields.occurenceId) { qs.occurence_id = additionalFields.occurenceId as string; + } + responseData = await zoomApiRequest.call( this, 'GET', @@ -218,12 +222,16 @@ export class Zoom implements INodeType { 'additionalFields', i ) as IDataObject; - if (additionalFields.scheduleForReminder) + if (additionalFields.scheduleForReminder) { qs.schedule_for_reminder = additionalFields.scheduleForReminder as boolean; - if (additionalFields.occurenceId) + } + + if (additionalFields.occurenceId) { qs.occurence_id = additionalFields.occurenceId; + } + responseData = await zoomApiRequest.call( this, 'DELETE', @@ -669,12 +677,16 @@ export class Zoom implements INodeType { 'additionalFields', i ) as IDataObject; - if (additionalFields.showPreviousOccurences) + if (additionalFields.showPreviousOccurences) { qs.show_previous_occurences = additionalFields.showPreviousOccurences as boolean; - if (additionalFields.occurenceId) + } + + if (additionalFields.occurenceId) { qs.occurence_id = additionalFields.occurenceId as string; + } + responseData = await zoomApiRequest.call( this, 'GET', @@ -705,9 +717,11 @@ export class Zoom implements INodeType { ) as IDataObject; - if (additionalFields.occurenceId) + if (additionalFields.occurenceId) { qs.occurence_id = additionalFields.occurenceId; + } + responseData = await zoomApiRequest.call( this, 'DELETE', From a6e40aaebe3cbd1b099f65ad4797cace9104ac92 Mon Sep 17 00:00:00 2001 From: shraddha shaligram Date: Tue, 23 Jun 2020 12:27:47 -0700 Subject: [PATCH 06/20] minor fix --- .../nodes-base/nodes/Zoom/GenericFunctions.ts | 16 +++++++--------- .../nodes/Zoom/MeetingRegistrantDescription.ts | 2 -- packages/nodes-base/nodes/Zoom/Zoom.node.ts | 3 +-- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/packages/nodes-base/nodes/Zoom/GenericFunctions.ts b/packages/nodes-base/nodes/Zoom/GenericFunctions.ts index d361a9761a..d5cad39297 100644 --- a/packages/nodes-base/nodes/Zoom/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Zoom/GenericFunctions.ts @@ -1,13 +1,16 @@ -import { OptionsWithUri } from 'request'; +import { + OptionsWithUri, +} from 'request'; import { IExecuteFunctions, IExecuteSingleFunctions, - ILoadOptionsFunctions + ILoadOptionsFunctions, } from 'n8n-core'; -import { IDataObject } from 'n8n-workflow'; -import * as _ from 'lodash'; +import { + IDataObject, +} from 'n8n-workflow'; export async function zoomApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: object = {}, query: object = {}, headers: {} | undefined = undefined, option: {} = {}): Promise { // tslint:disable-line:no-any @@ -60,8 +63,6 @@ export async function zoomApiRequest(this: IExecuteFunctions | IExecuteSingleFun // If that data does not exist for some reason return the actual error throw error; } - - } @@ -75,10 +76,7 @@ export async function zoomApiRequestAllItems( ): Promise { // tslint:disable-line:no-any const returnData: IDataObject[] = []; - let responseData; - //query.maxResults = 300; - do { responseData = await zoomApiRequest.call( this, diff --git a/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts b/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts index 232f8cf42c..2d32c55b42 100644 --- a/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts +++ b/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts @@ -36,8 +36,6 @@ export const meetingRegistrantOperations = [ } ] as INodeProperties[]; - - export const meetingRegistrantFields = [ /* -------------------------------------------------------------------------- */ /* meetingRegistrants:create */ diff --git a/packages/nodes-base/nodes/Zoom/Zoom.node.ts b/packages/nodes-base/nodes/Zoom/Zoom.node.ts index 8e6eb10d2b..078da4879c 100644 --- a/packages/nodes-base/nodes/Zoom/Zoom.node.ts +++ b/packages/nodes-base/nodes/Zoom/Zoom.node.ts @@ -29,6 +29,7 @@ import { webinarOperations, webinarFields, } from './WebinarDescription'; + import * as moment from 'moment-timezone'; interface Settings { @@ -46,8 +47,6 @@ interface Settings { registration_type?: number; approval_type?: number; practice_session?: boolean; - - } export class Zoom implements INodeType { description: INodeTypeDescription = { From 37ff6a8f1333b74dea2548e9ca56746fddced9c1 Mon Sep 17 00:00:00 2001 From: shraddha shaligram Date: Tue, 23 Jun 2020 13:40:43 -0700 Subject: [PATCH 07/20] fix spellings --- .../nodes-base/nodes/Zoom/GenericFunctions.ts | 1 - .../nodes/Zoom/MeetingDescription.ts | 40 ++++++++--------- .../Zoom/MeetingRegistrantDescription.ts | 18 ++++---- .../nodes/Zoom/WebinarDescription.ts | 36 ++++++++-------- packages/nodes-base/nodes/Zoom/Zoom.node.ts | 43 +++++++++---------- 5 files changed, 68 insertions(+), 70 deletions(-) diff --git a/packages/nodes-base/nodes/Zoom/GenericFunctions.ts b/packages/nodes-base/nodes/Zoom/GenericFunctions.ts index d5cad39297..74b5a18d06 100644 --- a/packages/nodes-base/nodes/Zoom/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Zoom/GenericFunctions.ts @@ -46,7 +46,6 @@ export async function zoomApiRequest(this: IExecuteFunctions | IExecuteSingleFun return await this.helpers.request(options); } else { //@ts-ignore - return await this.helpers.requestOAuth2.call(this, 'zoomOAuth2Api', options); } } catch (error) { diff --git a/packages/nodes-base/nodes/Zoom/MeetingDescription.ts b/packages/nodes-base/nodes/Zoom/MeetingDescription.ts index b9a1c74cb5..4d8281660d 100644 --- a/packages/nodes-base/nodes/Zoom/MeetingDescription.ts +++ b/packages/nodes-base/nodes/Zoom/MeetingDescription.ts @@ -98,7 +98,7 @@ export const meetingFields = [ name: 'alternative_hosts', type: 'string', default: '', - description: 'Alternative hosts email ids.', + description: 'Alternative hosts email IDs.', }, { displayName: 'Auto recording', @@ -242,11 +242,11 @@ export const meetingFields = [ value: 1, }, { - name: 'Attendees need to register for every occurence', + name: 'Attendees need to register for every occurrence', value: 2, }, { - name: 'Attendees register once and can choose one or more occurences to attend', + name: 'Attendees register once and can choose one or more occurrences to attend', value: 3, }, ], @@ -326,18 +326,18 @@ export const meetingFields = [ }, options: [ { - displayName: 'Occurence Id', - name: 'occurenceId', + displayName: 'Occurrence ID', + name: 'occurrenceId', type: 'string', default: '', - description: 'To view meeting details of a particular occurence of the recurring meeting.', + description: 'To view meeting details of a particular occurrence of the recurring meeting.', }, { - displayName: 'Show Previous Occurences', - name: 'showPreviousOccurences', + displayName: 'Show Previous Occurrences', + name: 'showPreviousOccurrences', type: 'boolean', default: '', - description: 'To view meeting details of all previous occurences of the recurring meeting.', + description: 'To view meeting details of all previous occurrences of the recurring meeting.', }, ], }, @@ -360,7 +360,7 @@ export const meetingFields = [ ], }, }, - description: 'User ID or email-id.', + description: 'User ID or email-ID.', }, { displayName: 'Return All', @@ -483,11 +483,11 @@ export const meetingFields = [ }, options: [ { - displayName: 'Occurence Id', - name: 'occurenceId', + displayName: 'Occurence ID', + name: 'occurrenceId', type: 'string', default: '', - description: 'Meeting occurence Id.', + description: 'Meeting occurrence ID.', }, { displayName: 'Schedule a reminder', @@ -503,7 +503,7 @@ export const meetingFields = [ /* meeting:update */ /* -------------------------------------------------------------------------- */ { - displayName: 'Meeting Id', + displayName: 'Meeting ID', name: 'meetingId', type: 'string', default: '', @@ -630,11 +630,11 @@ export const meetingFields = [ description: 'Start video when host joins the meeting.', }, { - displayName: 'Occurence Id', - name: 'occurenceId', + displayName: 'Occurrence Id', + name: 'occurrenceId', type: 'string', default: '', - description: 'Occurence ID.', + description: 'Occurrence ID.', }, { displayName: 'Meeting topic', @@ -696,15 +696,15 @@ export const meetingFields = [ type: 'options', options: [ { - name: 'Attendees register once and can attend any of the occurences', + name: 'Attendees register once and can attend any of the occurrences', value: 1, }, { - name: 'Attendees need to register for every occurence', + name: 'Attendees need to register for every occurrence', value: 2, }, { - name: 'Attendees register once and can choose one or more occurences to attend', + name: 'Attendees register once and can choose one or more occurrences to attend', value: 3, }, ], diff --git a/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts b/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts index 2d32c55b42..8cef3383aa 100644 --- a/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts +++ b/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts @@ -155,11 +155,11 @@ export const meetingRegistrantFields = [ description: 'Last Name.', }, { - displayName: 'Occurence Ids', - name: 'occurenceId', + displayName: 'Occurrence Ids', + name: 'occurrenceId', type: 'string', default: '', - description: 'Occurence IDs separated by comma.', + description: 'Occurrence IDs separated by comma.', }, { displayName: 'Organization', @@ -328,11 +328,11 @@ export const meetingRegistrantFields = [ }, options: [ { - displayName: 'Occurence Id', - name: 'occurence_id', + displayName: 'Occurrence Id', + name: 'occurrence_id', type: 'string', default: '', - description: `Occurence Id.`, + description: `Occurrence Id.`, }, { displayName: 'Status', @@ -429,11 +429,11 @@ export const meetingRegistrantFields = [ }, options: [ { - displayName: 'Occurence Id', - name: 'occurenceId', + displayName: 'Occurrence Id', + name: 'occurrenceId', type: 'string', default: '', - description: 'Occurence ID.', + description: 'Occurrence ID.', }, ], diff --git a/packages/nodes-base/nodes/Zoom/WebinarDescription.ts b/packages/nodes-base/nodes/Zoom/WebinarDescription.ts index 4bbec11fd4..b673b77fa9 100644 --- a/packages/nodes-base/nodes/Zoom/WebinarDescription.ts +++ b/packages/nodes-base/nodes/Zoom/WebinarDescription.ts @@ -209,11 +209,11 @@ export const webinarFields = [ value: 1, }, { - name: 'Attendees need to register for every occurence', + name: 'Attendees need to register for every occurrence', value: 2, }, { - name: 'Attendees register once and can choose one or more occurences to attend', + name: 'Attendees register once and can choose one or more occurrences to attend', value: 3, }, ], @@ -312,14 +312,14 @@ export const webinarFields = [ name: 'occurenceId', type: 'string', default: '', - description: 'To view webinar details of a particular occurence of the recurring webinar.', + description: 'To view webinar details of a particular occurrence of the recurring webinar.', }, { - displayName: 'Show Previous Occurences', - name: 'showPreviousOccurences', + displayName: 'Show Previous Occurrences', + name: 'showPreviousOccurrences', type: 'boolean', default: '', - description: 'To view webinar details of all previous occurences of the recurring webinar.', + description: 'To view webinar details of all previous occurrences of the recurring webinar.', }, ], }, @@ -386,7 +386,7 @@ export const webinarFields = [ description: 'How many results to return.', }, /* -------------------------------------------------------------------------- */ - /* webina:delete */ + /* webinar:delete */ /* -------------------------------------------------------------------------- */ { displayName: 'Webinar Id', @@ -424,11 +424,11 @@ export const webinarFields = [ }, options: [ { - displayName: 'Occurence Id', - name: 'occurenceId', + displayName: 'Occurrence Id', + name: 'occurrenceId', type: 'string', default: '', - description: 'Webinar occurence Id.', + description: 'Webinar occurrence Id.', }, ], @@ -566,11 +566,11 @@ export const webinarFields = [ description: 'Start video when host joins the webinar.', }, { - displayName: 'Occurence Id', - name: 'occurence_id', + displayName: 'Occurrence Id', + name: 'occurrence_id', type: 'string', default: '', - description: `Webinar occurence Id.`, + description: `Webinar occurrence Id.`, }, { displayName: 'Password', @@ -599,27 +599,27 @@ export const webinarFields = [ type: 'options', options: [ { - name: 'Attendees register once and can attend any of the occurences', + name: 'Attendees register once and can attend any of the occurrences', value: 1, }, { - name: 'Attendees need to register for every occurence', + name: 'Attendees need to register for every occurrence', value: 2, }, { - name: 'Attendees register once and can choose one or more occurences to attend', + name: 'Attendees register once and can choose one or more occurrences to attend', value: 3, }, ], default: 1, - description: 'Registration type. Used for recurring webinars with fixed time only', + description: 'Registration type. Used for recurring webinars with fixed time only.', }, { displayName: 'Start time', name: 'startTime', type: 'dateTime', default: '', - description: 'Start time should be used only for scheduled or recurring webinar with fixed time', + description: 'Start time should be used only for scheduled or recurring webinar with fixed time.', }, { displayName: 'Timezone', diff --git a/packages/nodes-base/nodes/Zoom/Zoom.node.ts b/packages/nodes-base/nodes/Zoom/Zoom.node.ts index 078da4879c..9e0cf88889 100644 --- a/packages/nodes-base/nodes/Zoom/Zoom.node.ts +++ b/packages/nodes-base/nodes/Zoom/Zoom.node.ts @@ -177,18 +177,17 @@ export class Zoom implements INodeType { if (operation === 'get') { //https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meeting const meetingId = this.getNodeParameter('meetingId', i) as string; - const additionalFields = this.getNodeParameter( 'additionalFields', i ) as IDataObject; - if (additionalFields.showPreviousOccurences) { - qs.show_previous_occurences = additionalFields.showPreviousOccurences as boolean; + if (additionalFields.showPreviousOccurrences) { + qs.show_previous_occurrences = additionalFields.showPreviousOccurrences as boolean; } - if (additionalFields.occurenceId) { - qs.occurence_id = additionalFields.occurenceId as string; + if (additionalFields.occurrenceId) { + qs.occurrence_id = additionalFields.occurrenceId as string; } @@ -226,8 +225,8 @@ export class Zoom implements INodeType { } - if (additionalFields.occurenceId) { - qs.occurence_id = additionalFields.occurenceId; + if (additionalFields.occurrenceId) { + qs.occurrence_id = additionalFields.occurrenceId; } @@ -363,8 +362,8 @@ export class Zoom implements INodeType { i ) as IDataObject; - if (additionalFields.occurenceId) { - qs.occurence_id = additionalFields.occurenceId as string; + if (additionalFields.occurrenceId) { + qs.occurrence_id = additionalFields.occurrenceId as string; } if (additionalFields.cn_meeting) { @@ -488,8 +487,8 @@ export class Zoom implements INodeType { 'additionalFields', i ) as IDataObject; - if (additionalFields.occurenceId) { - qs.occurence_ids = additionalFields.occurenceId as string; + if (additionalFields.occurrenceId) { + qs.occurrence_ids = additionalFields.occurrenceId as string; } if (additionalFields.lastName) { body.last_name = additionalFields.lastName as string; @@ -542,8 +541,8 @@ export class Zoom implements INodeType { 'additionalFields', i ) as IDataObject; - if (additionalFields.occurenceId) { - qs.occurence_id = additionalFields.occurenceId as string; + if (additionalFields.occurrenceId) { + qs.occurrence_id = additionalFields.occurrenceId as string; } if (additionalFields.status) { qs.status = additionalFields.status as string; @@ -567,7 +566,7 @@ export class Zoom implements INodeType { i ) as IDataObject; if (additionalFields.occurenceId) { - qs.occurence_id = additionalFields.occurenceId as string; + qs.occurrence_id = additionalFields.occurrenceId as string; } responseData = await zoomApiRequest.call( this, @@ -676,13 +675,13 @@ export class Zoom implements INodeType { 'additionalFields', i ) as IDataObject; - if (additionalFields.showPreviousOccurences) { - qs.show_previous_occurences = additionalFields.showPreviousOccurences as boolean; + if (additionalFields.showPreviousOccurrences) { + qs.show_previous_occurrences = additionalFields.showPreviousOccurrences as boolean; } - if (additionalFields.occurenceId) { - qs.occurence_id = additionalFields.occurenceId as string; + if (additionalFields.occurrenceId) { + qs.occurrence_id = additionalFields.occurrenceId as string; } @@ -716,8 +715,8 @@ export class Zoom implements INodeType { ) as IDataObject; - if (additionalFields.occurenceId) { - qs.occurence_id = additionalFields.occurenceId; + if (additionalFields.occurrenceId) { + qs.occurrence_id = additionalFields.occurrenceId; } @@ -737,8 +736,8 @@ export class Zoom implements INodeType { 'additionalFields', i ) as IDataObject; - if (additionalFields.occurence_id) { - qs.occurence_id = additionalFields.occurence_id as string; + if (additionalFields.occurrence_id) { + qs.occurrence_id = additionalFields.occurrence_id as string; } const settings: Settings = {}; From 83828a19abda3945196523fc698812d2bfa9bd02 Mon Sep 17 00:00:00 2001 From: shraddha shaligram Date: Tue, 23 Jun 2020 14:26:00 -0700 Subject: [PATCH 08/20] follow codebase conventions --- .../nodes-base/nodes/Zoom/GenericFunctions.ts | 1 - .../nodes/Zoom/MeetingDescription.ts | 16 +++++------ .../Zoom/MeetingRegistrantDescription.ts | 12 ++++---- .../nodes/Zoom/WebinarDescription.ts | 28 +++++++++---------- packages/nodes-base/nodes/Zoom/Zoom.node.ts | 8 +++--- 5 files changed, 32 insertions(+), 33 deletions(-) diff --git a/packages/nodes-base/nodes/Zoom/GenericFunctions.ts b/packages/nodes-base/nodes/Zoom/GenericFunctions.ts index 74b5a18d06..500b0a64d9 100644 --- a/packages/nodes-base/nodes/Zoom/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Zoom/GenericFunctions.ts @@ -14,7 +14,6 @@ import { export async function zoomApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: object = {}, query: object = {}, headers: {} | undefined = undefined, option: {} = {}): Promise { // tslint:disable-line:no-any - // tslint:disable-line:no-any const authenticationMethod = this.getNodeParameter('authentication', 0, 'accessToken') as string; let options: OptionsWithUri = { diff --git a/packages/nodes-base/nodes/Zoom/MeetingDescription.ts b/packages/nodes-base/nodes/Zoom/MeetingDescription.ts index 4d8281660d..829418d12b 100644 --- a/packages/nodes-base/nodes/Zoom/MeetingDescription.ts +++ b/packages/nodes-base/nodes/Zoom/MeetingDescription.ts @@ -51,7 +51,7 @@ export const meetingFields = [ /* meeting:create */ /* -------------------------------------------------------------------------- */ { - displayName: 'User Id', + displayName: 'User ID', name: 'userId', type: 'string', default: '', @@ -258,7 +258,7 @@ export const meetingFields = [ name: 'scheduleFor', type: 'string', default: '', - description: 'Schedule meeting for someone else from your account, provide their email id.', + description: 'Schedule meeting for someone else from your account, provide their email ID.', }, { displayName: 'Start time', @@ -290,7 +290,7 @@ export const meetingFields = [ /* meeting:get */ /* -------------------------------------------------------------------------- */ { - displayName: 'Meeting Id', + displayName: 'Meeting ID', name: 'meetingId', type: 'string', default: '', @@ -345,7 +345,7 @@ export const meetingFields = [ /* meeting:getAll */ /* -------------------------------------------------------------------------- */ { - displayName: 'User Id', + displayName: 'User ID', name: 'userId', type: 'string', default: '', @@ -448,7 +448,7 @@ export const meetingFields = [ /* meeting:delete */ /* -------------------------------------------------------------------------- */ { - displayName: 'Meeting Id', + displayName: 'Meeting ID', name: 'meetingId', type: 'string', default: '', @@ -549,7 +549,7 @@ export const meetingFields = [ name: 'alternative_hosts', type: 'string', default: '', - description: 'Alternative hosts email ids.', + description: 'Alternative hosts email IDs.', }, { displayName: 'Audio', @@ -630,7 +630,7 @@ export const meetingFields = [ description: 'Start video when host joins the meeting.', }, { - displayName: 'Occurrence Id', + displayName: 'Occurrence ID', name: 'occurrenceId', type: 'string', default: '', @@ -716,7 +716,7 @@ export const meetingFields = [ name: 'scheduleFor', type: 'string', default: '', - description: 'Schedule meeting for someone else from your account, provide their email id.', + description: 'Schedule meeting for someone else from your account, provide their email ID.', }, { displayName: 'Start time', diff --git a/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts b/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts index 8cef3383aa..b9a5147364 100644 --- a/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts +++ b/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts @@ -155,7 +155,7 @@ export const meetingRegistrantFields = [ description: 'Last Name.', }, { - displayName: 'Occurrence Ids', + displayName: 'Occurrence IDs', name: 'occurrenceId', type: 'string', default: '', @@ -251,7 +251,7 @@ export const meetingRegistrantFields = [ /* meetingRegistrants:getAll */ /* -------------------------------------------------------------------------- */ { - displayName: 'Meeting Id', + displayName: 'Meeting ID', name: 'meetingId', type: 'string', default: '', @@ -328,11 +328,11 @@ export const meetingRegistrantFields = [ }, options: [ { - displayName: 'Occurrence Id', + displayName: 'Occurrence ID', name: 'occurrence_id', type: 'string', default: '', - description: `Occurrence Id.`, + description: `Occurrence ID.`, }, { displayName: 'Status', @@ -362,7 +362,7 @@ export const meetingRegistrantFields = [ /* meetingRegistrants:update */ /* -------------------------------------------------------------------------- */ { - displayName: 'Meeting Id', + displayName: 'Meeting ID', name: 'meetingId', type: 'string', default: '', @@ -429,7 +429,7 @@ export const meetingRegistrantFields = [ }, options: [ { - displayName: 'Occurrence Id', + displayName: 'Occurrence ID', name: 'occurrenceId', type: 'string', default: '', diff --git a/packages/nodes-base/nodes/Zoom/WebinarDescription.ts b/packages/nodes-base/nodes/Zoom/WebinarDescription.ts index b673b77fa9..19796ea51a 100644 --- a/packages/nodes-base/nodes/Zoom/WebinarDescription.ts +++ b/packages/nodes-base/nodes/Zoom/WebinarDescription.ts @@ -51,7 +51,7 @@ export const webinarFields = [ /* webinar:create */ /* -------------------------------------------------------------------------- */ { - displayName: 'User Id', + displayName: 'User ID', name: 'userId', type: 'string', default: '', @@ -98,7 +98,7 @@ export const webinarFields = [ name: 'alternative_hosts', type: 'string', default: '', - description: 'Alternative hosts email ids.', + description: 'Alternative hosts email IDs.', }, { displayName: 'Approval type', @@ -272,7 +272,7 @@ export const webinarFields = [ /* webinar:get */ /* -------------------------------------------------------------------------- */ { - displayName: 'Webinar Id', + displayName: 'Webinar ID', name: 'webinarId', type: 'string', default: '', @@ -308,7 +308,7 @@ export const webinarFields = [ }, options: [ { - displayName: 'Occurence Id', + displayName: 'Occurence ID', name: 'occurenceId', type: 'string', default: '', @@ -327,7 +327,7 @@ export const webinarFields = [ /* webinar:getAll */ /* -------------------------------------------------------------------------- */ { - displayName: 'User Id', + displayName: 'User ID', name: 'userId', type: 'string', default: '', @@ -342,7 +342,7 @@ export const webinarFields = [ ], }, }, - description: 'User ID or email-id.', + description: 'User ID or email-ID.', }, { displayName: 'Return All', @@ -389,7 +389,7 @@ export const webinarFields = [ /* webinar:delete */ /* -------------------------------------------------------------------------- */ { - displayName: 'Webinar Id', + displayName: 'Webinar ID', name: 'webinarId', type: 'string', default: '', @@ -404,7 +404,7 @@ export const webinarFields = [ ], }, }, - description: 'WebinarId ID.', + description: 'Webinar ID.', }, { displayName: 'Additional Fields', @@ -424,11 +424,11 @@ export const webinarFields = [ }, options: [ { - displayName: 'Occurrence Id', + displayName: 'Occurrence ID', name: 'occurrenceId', type: 'string', default: '', - description: 'Webinar occurrence Id.', + description: 'Webinar occurrence ID.', }, ], @@ -438,7 +438,7 @@ export const webinarFields = [ /* webinar:update */ /* -------------------------------------------------------------------------- */ { - displayName: 'User Id', + displayName: 'User ID', name: 'userId', type: 'string', default: '', @@ -485,7 +485,7 @@ export const webinarFields = [ name: 'alternative_hosts', type: 'string', default: '', - description: 'Alternative hosts email ids.', + description: 'Alternative hosts email IDs.', }, { displayName: 'Approval type', @@ -566,11 +566,11 @@ export const webinarFields = [ description: 'Start video when host joins the webinar.', }, { - displayName: 'Occurrence Id', + displayName: 'Occurrence ID', name: 'occurrence_id', type: 'string', default: '', - description: `Webinar occurrence Id.`, + description: `Webinar occurrence ID.`, }, { displayName: 'Password', diff --git a/packages/nodes-base/nodes/Zoom/Zoom.node.ts b/packages/nodes-base/nodes/Zoom/Zoom.node.ts index 9e0cf88889..56901ac2ce 100644 --- a/packages/nodes-base/nodes/Zoom/Zoom.node.ts +++ b/packages/nodes-base/nodes/Zoom/Zoom.node.ts @@ -163,13 +163,13 @@ export class Zoom implements INodeType { async execute(this: IExecuteFunctions): Promise { const items = this.getInputData(); const returnData: IDataObject[] = []; - const length = (items.length as unknown) as number; - let qs: IDataObject; + let qs: IDataObject = {}; + let body: IDataObject = {}; let responseData; const resource = this.getNodeParameter('resource', 0) as string; const operation = this.getNodeParameter('operation', 0) as string; - let body: IDataObject = {}; - for (let i = 0; i < length; i++) { + + for (let i = 0; i < items.length; i++) { qs = {}; //https://marketplace.zoom.us/docs/api-reference/zoom-api/ if (resource === 'meeting') { From 69a1f8af00f6bd64795c709fd25e407cfc28c0e5 Mon Sep 17 00:00:00 2001 From: shraddha shaligram Date: Tue, 23 Jun 2020 20:29:47 -0700 Subject: [PATCH 09/20] fix pagination --- .../credentials/ZoomOAuth2Api.credentials.ts | 16 ++++---------- .../nodes-base/nodes/Zoom/GenericFunctions.ts | 18 ++++++++++----- .../nodes/Zoom/MeetingDescription.ts | 22 +++++++++---------- .../Zoom/MeetingRegistrantDescription.ts | 16 +++++++------- .../nodes/Zoom/WebinarDescription.ts | 14 ++++++------ packages/nodes-base/nodes/Zoom/Zoom.node.ts | 16 ++++++++++---- 6 files changed, 55 insertions(+), 47 deletions(-) diff --git a/packages/nodes-base/credentials/ZoomOAuth2Api.credentials.ts b/packages/nodes-base/credentials/ZoomOAuth2Api.credentials.ts index c00c694661..f85cc75254 100644 --- a/packages/nodes-base/credentials/ZoomOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/ZoomOAuth2Api.credentials.ts @@ -1,14 +1,7 @@ -import { ICredentialType, NodePropertyTypes } from 'n8n-workflow'; - -const userScopes = [ - 'meeting:read', - 'meeting:write', - 'user:read', - 'user:write', - 'user_profile', - 'webinar:read', - 'webinar:write' -]; +import { + ICredentialType, + NodePropertyTypes, +} from 'n8n-workflow'; export class ZoomOAuth2Api implements ICredentialType { name = 'zoomOAuth2Api'; @@ -27,7 +20,6 @@ export class ZoomOAuth2Api implements ICredentialType { type: 'hidden' as NodePropertyTypes, default: 'https://zoom.us/oauth/token' }, - { displayName: 'Scope', name: 'scope', diff --git a/packages/nodes-base/nodes/Zoom/GenericFunctions.ts b/packages/nodes-base/nodes/Zoom/GenericFunctions.ts index 500b0a64d9..6a8593e3ab 100644 --- a/packages/nodes-base/nodes/Zoom/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Zoom/GenericFunctions.ts @@ -75,6 +75,7 @@ export async function zoomApiRequestAllItems( // tslint:disable-line:no-any const returnData: IDataObject[] = []; let responseData; + query.page_number = 0; do { responseData = await zoomApiRequest.call( this, @@ -83,14 +84,21 @@ export async function zoomApiRequestAllItems( body, query ); - query.page_number = responseData['page_number']; + query.page_number++; returnData.push.apply(returnData, responseData[propertyName]); + // zoom free plan rate limit is 1 request/second + // TODO just wait when the plan is free + await wait(); } while ( - responseData['page_number'] !== undefined && - responseData['page_number'] !== '' + responseData.page_count !== responseData.page_number ); return returnData; } - - +function wait() { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve(true); + }, 1000); + }); +} diff --git a/packages/nodes-base/nodes/Zoom/MeetingDescription.ts b/packages/nodes-base/nodes/Zoom/MeetingDescription.ts index 829418d12b..5a8a5966a9 100644 --- a/packages/nodes-base/nodes/Zoom/MeetingDescription.ts +++ b/packages/nodes-base/nodes/Zoom/MeetingDescription.ts @@ -39,7 +39,7 @@ export const meetingOperations = [ name: 'Update', value: 'update', description: 'Update a meeting', - } + }, ], default: 'create', description: 'The operation to perform.', @@ -69,7 +69,7 @@ export const meetingFields = [ description: 'User ID or email address of user.', }, { - displayName: 'Additional settings', + displayName: 'Additional fields', name: 'additionalFields', type: 'collection', placeholder: 'Add Field', @@ -83,7 +83,7 @@ export const meetingFields = [ resource: [ 'meeting', ], - } + }, }, options: [ { @@ -209,7 +209,7 @@ export const meetingFields = [ ], default: 2, - description: 'Meeting type.' + description: 'Meeting type.', }, { displayName: 'Muting before entry', @@ -219,7 +219,7 @@ export const meetingFields = [ description: 'Mute participants upon entry.', }, { - displayName: 'Participant Video', + displayName: 'Participant video', name: 'participant_video', type: 'boolean', default: false, @@ -308,7 +308,7 @@ export const meetingFields = [ description: 'Meeting ID.', }, { - displayName: 'Additional settings', + displayName: 'Additional fields', name: 'additionalFields', type: 'collection', placeholder: 'Add Field', @@ -398,13 +398,13 @@ export const meetingFields = [ }, typeOptions: { minValue: 1, - maxValue: 300 + maxValue: 300, }, default: 30, description: 'How many results to return.', }, { - displayName: 'Additional settings', + displayName: 'Additional fields', name: 'additionalFields', type: 'collection', placeholder: 'Add Field', @@ -456,7 +456,7 @@ export const meetingFields = [ displayOptions: { show: { operation: [ - 'delete' + 'delete', ], resource: [ 'meeting', @@ -521,7 +521,7 @@ export const meetingFields = [ description: 'Meeting ID.', }, { - displayName: 'Additional settings', + displayName: 'Additional fields', name: 'additionalFields', type: 'collection', placeholder: 'Add Field', @@ -667,7 +667,7 @@ export const meetingFields = [ ], default: 2, - description: 'Meeting type.' + description: 'Meeting type.', }, { displayName: 'Muting before entry', diff --git a/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts b/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts index b9a5147364..b7e5271f55 100644 --- a/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts +++ b/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts @@ -95,7 +95,7 @@ export const meetingRegistrantFields = [ description: 'First Name.', }, { - displayName: 'Additional settings', + displayName: 'Additional fields', name: 'additionalFields', type: 'collection', placeholder: 'Add Field', @@ -109,7 +109,7 @@ export const meetingRegistrantFields = [ resource: [ 'meetingRegistrants', ], - } + }, }, options: [ { @@ -202,7 +202,7 @@ export const meetingRegistrantFields = [ }, ], default: '', - description: 'Meeting type.' + description: 'Meeting type.', }, { displayName: 'Role in purchase process', @@ -228,7 +228,7 @@ export const meetingRegistrantFields = [ ], default: '', - description: 'Role in purchase process.' + description: 'Role in purchase process.', }, { displayName: 'State', @@ -304,13 +304,13 @@ export const meetingRegistrantFields = [ }, typeOptions: { minValue: 1, - maxValue: 300 + maxValue: 300, }, default: 30, description: 'How many results to return.', }, { - displayName: 'Additional settings', + displayName: 'Additional fields', name: 'additionalFields', type: 'collection', placeholder: 'Add Field', @@ -324,7 +324,7 @@ export const meetingRegistrantFields = [ resource: [ 'meetingRegistrants', ], - } + }, }, options: [ { @@ -412,7 +412,7 @@ export const meetingRegistrantFields = [ description: `Registrant Status.`, }, { - displayName: 'Additional settings', + displayName: 'Additional fields', name: 'additionalFields', type: 'collection', placeholder: 'Add Field', diff --git a/packages/nodes-base/nodes/Zoom/WebinarDescription.ts b/packages/nodes-base/nodes/Zoom/WebinarDescription.ts index 19796ea51a..228cf9f1ae 100644 --- a/packages/nodes-base/nodes/Zoom/WebinarDescription.ts +++ b/packages/nodes-base/nodes/Zoom/WebinarDescription.ts @@ -69,7 +69,7 @@ export const webinarFields = [ description: 'User ID or email address of user.', }, { - displayName: 'Additional settings', + displayName: 'Additional fields', name: 'additionalFields', type: 'collection', placeholder: 'Add Field', @@ -263,7 +263,7 @@ export const webinarFields = [ }, ], default: 5, - description: 'Webinar type.' + description: 'Webinar type.', }, ], @@ -290,7 +290,7 @@ export const webinarFields = [ description: 'Webinar ID.', }, { - displayName: 'Additional settings', + displayName: 'Additional fields', name: 'additionalFields', type: 'collection', placeholder: 'Add Field', @@ -380,7 +380,7 @@ export const webinarFields = [ }, typeOptions: { minValue: 1, - maxValue: 300 + maxValue: 300, }, default: 30, description: 'How many results to return.', @@ -397,7 +397,7 @@ export const webinarFields = [ displayOptions: { show: { operation: [ - 'delete' + 'delete', ], resource: [ 'webinarId', @@ -456,7 +456,7 @@ export const webinarFields = [ description: 'User ID or email address of user.', }, { - displayName: 'Additional settings', + displayName: 'Additional fields', name: 'additionalFields', type: 'collection', placeholder: 'Add Field', @@ -470,7 +470,7 @@ export const webinarFields = [ resource: [ 'webinar', ], - } + }, }, options: [ { diff --git a/packages/nodes-base/nodes/Zoom/Zoom.node.ts b/packages/nodes-base/nodes/Zoom/Zoom.node.ts index 56901ac2ce..18e3614cc4 100644 --- a/packages/nodes-base/nodes/Zoom/Zoom.node.ts +++ b/packages/nodes-base/nodes/Zoom/Zoom.node.ts @@ -203,13 +203,21 @@ export class Zoom implements INodeType { //https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetings const userId = this.getNodeParameter('userId', i) as string; const returnAll = this.getNodeParameter('returnAll', i) as boolean; + + const additionalFields = this.getNodeParameter( + 'additionalFields', + i + ) as IDataObject; + if (additionalFields.type) { + qs.type = additionalFields.type as string; + + } if (returnAll) { - responseData = await zoomApiRequestAllItems.call(this, 'results', 'GET', `/users/${userId}/meetings`, {}, qs); + responseData = await zoomApiRequestAllItems.call(this, 'meetings', 'GET', `/users/${userId}/meetings`, {}, qs); } else { - const limit = this.getNodeParameter('limit', i) as number; - qs.page_size = limit; + qs.page_size = this.getNodeParameter('limit', i) as number;; responseData = await zoomApiRequest.call(this, 'GET', `/users/${userId}/meetings`, {}, qs); - responseData = responseData.results; + } } From 5d98f5673f7d7637b3944dd63135853b6bd91ddc Mon Sep 17 00:00:00 2001 From: shraddha shaligram Date: Tue, 23 Jun 2020 20:53:49 -0700 Subject: [PATCH 10/20] fix specific results for registrants --- packages/nodes-base/nodes/Zoom/Zoom.node.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/nodes-base/nodes/Zoom/Zoom.node.ts b/packages/nodes-base/nodes/Zoom/Zoom.node.ts index 18e3614cc4..f33a2a338e 100644 --- a/packages/nodes-base/nodes/Zoom/Zoom.node.ts +++ b/packages/nodes-base/nodes/Zoom/Zoom.node.ts @@ -215,7 +215,7 @@ export class Zoom implements INodeType { if (returnAll) { responseData = await zoomApiRequestAllItems.call(this, 'meetings', 'GET', `/users/${userId}/meetings`, {}, qs); } else { - qs.page_size = this.getNodeParameter('limit', i) as number;; + qs.page_size = this.getNodeParameter('limit', i) as number; responseData = await zoomApiRequest.call(this, 'GET', `/users/${userId}/meetings`, {}, qs); } @@ -559,10 +559,9 @@ export class Zoom implements INodeType { 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; + qs.page_size = this.getNodeParameter('limit', i) as number; responseData = await zoomApiRequest.call(this, 'GET', `/meetings/${meetingId}/registrants`, {}, qs); - responseData = responseData.results; + } } @@ -708,10 +707,9 @@ export class Zoom implements INodeType { 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; + qs.page_size = this.getNodeParameter('limit', i) as number; responseData = await zoomApiRequest.call(this, 'GET', `/users/${userId}/webinars`, {}, qs); - responseData = responseData.results; + } } if (operation === 'delete') { From e3cf858ebc64c78fdf7c3ce5ef4f0772a45f61ba Mon Sep 17 00:00:00 2001 From: shraddha shaligram Date: Wed, 24 Jun 2020 10:47:35 -0700 Subject: [PATCH 11/20] fix naming conventions --- .../nodes/Zoom/MeetingDescription.ts | 52 +++++++++--------- .../Zoom/MeetingRegistrantDescription.ts | 20 +++---- .../nodes/Zoom/WebinarDescription.ts | 54 +++++++++---------- packages/nodes-base/nodes/Zoom/Zoom.node.ts | 2 +- 4 files changed, 64 insertions(+), 64 deletions(-) diff --git a/packages/nodes-base/nodes/Zoom/MeetingDescription.ts b/packages/nodes-base/nodes/Zoom/MeetingDescription.ts index 5a8a5966a9..d335901bdf 100644 --- a/packages/nodes-base/nodes/Zoom/MeetingDescription.ts +++ b/packages/nodes-base/nodes/Zoom/MeetingDescription.ts @@ -69,7 +69,7 @@ export const meetingFields = [ description: 'User ID or email address of user.', }, { - displayName: 'Additional fields', + displayName: 'Additional Fields', name: 'additionalFields', type: 'collection', placeholder: 'Add Field', @@ -101,7 +101,7 @@ export const meetingFields = [ description: 'Alternative hosts email IDs.', }, { - displayName: 'Auto recording', + displayName: 'Auto Recording', name: 'auto_recording', type: 'options', options: [ @@ -179,14 +179,14 @@ export const meetingFields = [ description: 'Allow participants to join the meeting before host starts it.', }, { - displayName: 'Meeting topic', + displayName: 'Meeting Topic', name: 'topic', type: 'string', default: '', description: `Meeting topic.`, }, { - displayName: 'Meeting type', + displayName: 'Meeting Type', name: 'type', type: 'options', options: [ @@ -199,11 +199,11 @@ export const meetingFields = [ value: 2, }, { - name: 'Recurring meeting with no fixed time', + name: 'Recurring Meeting with no fixed time', value: 3, }, { - name: 'Recurring meeting with no fixed time', + name: 'Recurring Meeting with fixed time', value: 8, }, @@ -219,7 +219,7 @@ export const meetingFields = [ description: 'Mute participants upon entry.', }, { - displayName: 'Participant video', + displayName: 'Participant Video', name: 'participant_video', type: 'boolean', default: false, @@ -233,7 +233,7 @@ export const meetingFields = [ description: 'Password to join the meeting with maximum 10 characters.', }, { - displayName: 'Registration type', + displayName: 'Registration Type', name: 'registration_type', type: 'options', options: [ @@ -254,14 +254,14 @@ export const meetingFields = [ description: 'Registration type. Used for recurring meetings with fixed time only', }, { - displayName: 'Schedule for', + displayName: 'Schedule For', name: 'scheduleFor', type: 'string', default: '', description: 'Schedule meeting for someone else from your account, provide their email ID.', }, { - displayName: 'Start time', + displayName: 'Start Time', name: 'startTime', type: 'dateTime', default: '', @@ -308,7 +308,7 @@ export const meetingFields = [ description: 'Meeting ID.', }, { - displayName: 'Additional fields', + displayName: 'Additional Fields', name: 'additionalFields', type: 'collection', placeholder: 'Add Field', @@ -404,7 +404,7 @@ export const meetingFields = [ description: 'How many results to return.', }, { - displayName: 'Additional fields', + displayName: 'Additional Fields', name: 'additionalFields', type: 'collection', placeholder: 'Add Field', @@ -490,7 +490,7 @@ export const meetingFields = [ description: 'Meeting occurrence ID.', }, { - displayName: 'Schedule a reminder', + displayName: 'Schedule Reminder', name: 'scheduleForReminder', type: 'boolean', default: false, @@ -521,7 +521,7 @@ export const meetingFields = [ description: 'Meeting ID.', }, { - displayName: 'Additional fields', + displayName: 'Additional Fields', name: 'additionalFields', type: 'collection', placeholder: 'Add Field', @@ -573,16 +573,16 @@ export const meetingFields = [ description: 'Determine how participants can join audio portion of the meeting.', }, { - displayName: 'Auto recording', + displayName: 'Auto Recording', name: 'auto_recording', type: 'options', options: [ { - name: 'Record on local', + name: 'Record on Local', value: 'local', }, { - name: 'Record on cloud', + name: 'Record on Cloud', value: 'cloud', }, { @@ -602,7 +602,7 @@ export const meetingFields = [ description: 'Duration.', }, { - displayName: 'Join before Host', + displayName: 'Join Before Host', name: 'join_before_host', type: 'boolean', default: false, @@ -637,14 +637,14 @@ export const meetingFields = [ description: 'Occurrence ID.', }, { - displayName: 'Meeting topic', + displayName: 'Meeting Topic', name: 'topic', type: 'string', default: '', description: `Meeting topic.`, }, { - displayName: 'Meeting type', + displayName: 'Meeting Type', name: 'type', type: 'options', options: [ @@ -657,11 +657,11 @@ export const meetingFields = [ value: 2, }, { - name: 'Recurring meeting with no fixed time', + name: 'Recurring Meeting with no fixed time', value: 3, }, { - name: 'Recurring meeting with no fixed time', + name: 'Recurring Meeting with fixed time', value: 8, }, @@ -670,7 +670,7 @@ export const meetingFields = [ description: 'Meeting type.', }, { - displayName: 'Muting before entry', + displayName: 'Muting Before Entry', name: 'mute_upon_entry', type: 'boolean', default: false, @@ -691,7 +691,7 @@ export const meetingFields = [ description: 'Start video when participant joins the meeting.', }, { - displayName: 'Registration type', + displayName: 'Registration Type', name: 'registration_type', type: 'options', options: [ @@ -712,14 +712,14 @@ export const meetingFields = [ description: 'Registration type. Used for recurring meetings with fixed time only', }, { - displayName: 'Schedule for', + displayName: 'Schedule For', name: 'scheduleFor', type: 'string', default: '', description: 'Schedule meeting for someone else from your account, provide their email ID.', }, { - displayName: 'Start time', + displayName: 'Start Time', name: 'startTime', type: 'dateTime', default: '', diff --git a/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts b/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts index b7e5271f55..d1527f165a 100644 --- a/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts +++ b/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts @@ -22,12 +22,12 @@ export const meetingRegistrantOperations = [ { name: 'Update', value: 'update', - description: 'Update Meeting Registrant status', + description: 'Update Meeting Registrant Status', }, { name: 'Get All', value: 'getAll', - description: 'Retrieve all meeting registrants', + description: 'Retrieve all Meeting Registrants', }, ], @@ -77,7 +77,7 @@ export const meetingRegistrantFields = [ description: 'Valid email-id of registrant.', }, { - displayName: 'First name', + displayName: 'First Name', name: 'firstName', required: true, type: 'string', @@ -95,7 +95,7 @@ export const meetingRegistrantFields = [ description: 'First Name.', }, { - displayName: 'Additional fields', + displayName: 'Additional Fields', name: 'additionalFields', type: 'collection', placeholder: 'Add Field', @@ -141,7 +141,7 @@ export const meetingRegistrantFields = [ description: 'Valid country of registrant.', }, { - displayName: 'Job title', + displayName: 'Job Title', name: 'job_title', type: 'string', default: '', @@ -176,7 +176,7 @@ export const meetingRegistrantFields = [ description: 'Valid phone number of registrant.', }, { - displayName: 'Purchasing time frame', + displayName: 'Purchasing Time Frame', name: 'purchasing_time_frame', type: 'options', options: [ @@ -205,7 +205,7 @@ export const meetingRegistrantFields = [ description: 'Meeting type.', }, { - displayName: 'Role in purchase process', + displayName: 'Role in Purchase Process', name: 'role_in_purchase_process', type: 'options', options: [ @@ -238,7 +238,7 @@ export const meetingRegistrantFields = [ description: 'Valid state of registrant.', }, { - displayName: 'Zip code', + displayName: 'Zip Code', name: 'zip', type: 'string', default: '', @@ -310,7 +310,7 @@ export const meetingRegistrantFields = [ description: 'How many results to return.', }, { - displayName: 'Additional fields', + displayName: 'Additional Fields', name: 'additionalFields', type: 'collection', placeholder: 'Add Field', @@ -412,7 +412,7 @@ export const meetingRegistrantFields = [ description: `Registrant Status.`, }, { - displayName: 'Additional fields', + displayName: 'Additional Fields', name: 'additionalFields', type: 'collection', placeholder: 'Add Field', diff --git a/packages/nodes-base/nodes/Zoom/WebinarDescription.ts b/packages/nodes-base/nodes/Zoom/WebinarDescription.ts index 228cf9f1ae..1c0e03e096 100644 --- a/packages/nodes-base/nodes/Zoom/WebinarDescription.ts +++ b/packages/nodes-base/nodes/Zoom/WebinarDescription.ts @@ -69,7 +69,7 @@ export const webinarFields = [ description: 'User ID or email address of user.', }, { - displayName: 'Additional fields', + displayName: 'Additional Fields', name: 'additionalFields', type: 'collection', placeholder: 'Add Field', @@ -101,20 +101,20 @@ export const webinarFields = [ description: 'Alternative hosts email IDs.', }, { - displayName: 'Approval type', + displayName: 'Approval Type', name: 'approval_type', type: 'options', options: [ { - name: 'Automatically approve', + name: 'Automatically Approve', value: 0, }, { - name: 'Manually approve', + name: 'Manually Approve', value: 1, }, { - name: 'No registration required', + name: 'No Registration Required', value: 2, }, ], @@ -144,16 +144,16 @@ export const webinarFields = [ description: 'Determine how participants can join audio portion of the webinar.', }, { - displayName: 'Auto recording', + displayName: 'Auto Recording', name: 'auto_recording', type: 'options', options: [ { - name: 'Record on local', + name: 'Record on Local', value: 'local', }, { - name: 'Record on cloud', + name: 'Record on Cloud', value: 'cloud', }, { @@ -200,7 +200,7 @@ export const webinarFields = [ description: 'Enable Practice session.', }, { - displayName: 'Registration type', + displayName: 'Registration Type', name: 'registration_type', type: 'options', options: [ @@ -221,7 +221,7 @@ export const webinarFields = [ description: 'Registration type. Used for recurring webinar with fixed time only', }, { - displayName: 'Start time', + displayName: 'Start Time', name: 'startTime', type: 'dateTime', default: '', @@ -238,14 +238,14 @@ export const webinarFields = [ description: `Time zone used in the response. The default is the time zone of the calendar.`, }, { - displayName: 'Webinar topic', + displayName: 'Webinar Topic', name: 'topic', type: 'string', default: '', description: `Webinar topic.`, }, { - displayName: 'Webinar type', + displayName: 'Webinar Type', name: 'type', type: 'options', options: [ @@ -258,7 +258,7 @@ export const webinarFields = [ value: 6, }, { - name: 'Recurring webinar with fixed time', + name: 'Recurring webinar with fixed time', value: 9, }, ], @@ -290,7 +290,7 @@ export const webinarFields = [ description: 'Webinar ID.', }, { - displayName: 'Additional fields', + displayName: 'Additional Fields', name: 'additionalFields', type: 'collection', placeholder: 'Add Field', @@ -456,7 +456,7 @@ export const webinarFields = [ description: 'User ID or email address of user.', }, { - displayName: 'Additional fields', + displayName: 'Additional Fields', name: 'additionalFields', type: 'collection', placeholder: 'Add Field', @@ -488,20 +488,20 @@ export const webinarFields = [ description: 'Alternative hosts email IDs.', }, { - displayName: 'Approval type', + displayName: 'Approval Type', name: 'approval_type', type: 'options', options: [ { - name: 'Automatically approve', + name: 'Automatically Approve', value: 0, }, { - name: 'Manually approve', + name: 'Manually Approve', value: 1, }, { - name: 'No registration required', + name: 'No Registration Required', value: 2, }, ], @@ -509,16 +509,16 @@ export const webinarFields = [ description: 'Approval type.', }, { - displayName: 'Auto recording', + displayName: 'Auto Recording', name: 'auto_recording', type: 'options', options: [ { - name: 'Record on local', + name: 'Record on Local', value: 'local', }, { - name: 'Record on cloud', + name: 'Record on Cloud', value: 'cloud', }, { @@ -594,7 +594,7 @@ export const webinarFields = [ description: 'Enable Practice session.', }, { - displayName: 'Registration type', + displayName: 'Registration Type', name: 'registration_type', type: 'options', options: [ @@ -615,7 +615,7 @@ export const webinarFields = [ description: 'Registration type. Used for recurring webinars with fixed time only.', }, { - displayName: 'Start time', + displayName: 'Start Time', name: 'startTime', type: 'dateTime', default: '', @@ -632,14 +632,14 @@ export const webinarFields = [ description: `Time zone used in the response. The default is the time zone of the calendar.`, }, { - displayName: 'Webinar topic', + displayName: 'Webinar Topic', name: 'topic', type: 'string', default: '', description: `Webinar topic.`, }, { - displayName: 'Webinar type', + displayName: 'Webinar Type', name: 'type', type: 'options', options: [ @@ -652,7 +652,7 @@ export const webinarFields = [ value: 6, }, { - name: 'Recurring webinar with fixed time', + name: 'Recurring webinar with fixed time', value: 9, }, ], diff --git a/packages/nodes-base/nodes/Zoom/Zoom.node.ts b/packages/nodes-base/nodes/Zoom/Zoom.node.ts index f33a2a338e..c0d1a05a9e 100644 --- a/packages/nodes-base/nodes/Zoom/Zoom.node.ts +++ b/packages/nodes-base/nodes/Zoom/Zoom.node.ts @@ -483,7 +483,7 @@ export class Zoom implements INodeType { } } - if (resource === 'meetingRegistrant') { + if (resource === 'meetingRegistrants') { if (operation === 'create') { //https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingregistrantcreate const meetingId = this.getNodeParameter('meetingId', i) as string; From 582954008352add0c2b88b5a2094872ae846c34a Mon Sep 17 00:00:00 2001 From: shraddha shaligram Date: Wed, 24 Jun 2020 11:09:11 -0700 Subject: [PATCH 12/20] fix registrants bug --- .../nodes/Zoom/MeetingDescription.ts | 46 +++++----- .../Zoom/MeetingRegistrantDescription.ts | 10 +-- packages/nodes-base/nodes/Zoom/Zoom.node.ts | 87 ++++++++++--------- 3 files changed, 73 insertions(+), 70 deletions(-) diff --git a/packages/nodes-base/nodes/Zoom/MeetingDescription.ts b/packages/nodes-base/nodes/Zoom/MeetingDescription.ts index d335901bdf..3efcc2a2bc 100644 --- a/packages/nodes-base/nodes/Zoom/MeetingDescription.ts +++ b/packages/nodes-base/nodes/Zoom/MeetingDescription.ts @@ -66,7 +66,7 @@ export const meetingFields = [ ], }, }, - description: 'User ID or email address of user.', + description: 'User ID or Email Address.', }, { displayName: 'Additional Fields', @@ -95,22 +95,22 @@ export const meetingFields = [ }, { displayName: 'Alternative Hosts', - name: 'alternative_hosts', + name: 'alternativeHosts', type: 'string', default: '', description: 'Alternative hosts email IDs.', }, { displayName: 'Auto Recording', - name: 'auto_recording', + name: 'autoRecording', type: 'options', options: [ { - name: 'Record on local', + name: 'Record on Local', value: 'local', }, { - name: 'Record on cloud', + name: 'Record on Cloud', value: 'cloud', }, { @@ -152,28 +152,28 @@ export const meetingFields = [ }, { displayName: 'Host Meeting in China', - name: 'cn_meeting', + name: 'cnMeeting', type: 'boolean', default: false, description: 'Host Meeting in China.', }, { displayName: 'Host Meeting in India', - name: 'in_meeting', + name: 'inMeeting', type: 'boolean', default: false, description: 'Host Meeting in India.', }, { displayName: 'Host Video', - name: 'host_video', + name: 'hostVideo', type: 'boolean', default: false, description: 'Start video when host joins the meeting.', }, { - displayName: 'Join before Host', - name: 'join_before_host', + displayName: 'Join Before Host', + name: 'joinBeforeHost', type: 'boolean', default: false, description: 'Allow participants to join the meeting before host starts it.', @@ -213,14 +213,14 @@ export const meetingFields = [ }, { displayName: 'Muting before entry', - name: 'mute_upon_entry', + name: 'muteUponEntry', type: 'boolean', default: false, description: 'Mute participants upon entry.', }, { displayName: 'Participant Video', - name: 'participant_video', + name: 'participantVideo', type: 'boolean', default: false, description: 'Start video when participant joins the meeting.', @@ -234,7 +234,7 @@ export const meetingFields = [ }, { displayName: 'Registration Type', - name: 'registration_type', + name: 'registrationType', type: 'options', options: [ { @@ -546,14 +546,14 @@ export const meetingFields = [ }, { displayName: 'Alternative Hosts', - name: 'alternative_hosts', + name: 'alternativeHosts', type: 'string', default: '', description: 'Alternative hosts email IDs.', }, { displayName: 'Audio', - name: 'auto_recording', + name: 'audio', type: 'options', options: [ { @@ -574,7 +574,7 @@ export const meetingFields = [ }, { displayName: 'Auto Recording', - name: 'auto_recording', + name: 'autoRecording', type: 'options', options: [ { @@ -603,28 +603,28 @@ export const meetingFields = [ }, { displayName: 'Join Before Host', - name: 'join_before_host', + name: 'joinBeforeHost', type: 'boolean', default: false, description: 'Allow participants to join the meeting before host starts it.', }, { displayName: 'Host Meeting in China', - name: 'cn_meeting', + name: 'cnMeeting', type: 'boolean', default: false, description: 'Host Meeting in China.', }, { displayName: 'Host Meeting in India', - name: 'in_meeting', + name: 'inMeeting', type: 'boolean', default: false, description: 'Host Meeting in India.', }, { displayName: 'Host Video', - name: 'host_video', + name: 'hostVideo', type: 'boolean', default: false, description: 'Start video when host joins the meeting.', @@ -671,7 +671,7 @@ export const meetingFields = [ }, { displayName: 'Muting Before Entry', - name: 'mute_upon_entry', + name: 'muteUponEntry', type: 'boolean', default: false, description: 'Mute participants upon entry.', @@ -685,14 +685,14 @@ export const meetingFields = [ }, { displayName: 'Participant Video', - name: 'participant_video', + name: 'participantVideo', type: 'boolean', default: false, description: 'Start video when participant joins the meeting.', }, { displayName: 'Registration Type', - name: 'registration_type', + name: 'registrationType', type: 'options', options: [ { diff --git a/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts b/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts index d1527f165a..5d40aae014 100644 --- a/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts +++ b/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts @@ -74,7 +74,7 @@ export const meetingRegistrantFields = [ ], }, }, - description: 'Valid email-id of registrant.', + description: 'Valid Email-ID.', }, { displayName: 'First Name', @@ -142,7 +142,7 @@ export const meetingRegistrantFields = [ }, { displayName: 'Job Title', - name: 'job_title', + name: 'jobTitle', type: 'string', default: '', description: 'Job title of registrant.', @@ -177,7 +177,7 @@ export const meetingRegistrantFields = [ }, { displayName: 'Purchasing Time Frame', - name: 'purchasing_time_frame', + name: 'purchasingTimeFrame', type: 'options', options: [ { @@ -206,7 +206,7 @@ export const meetingRegistrantFields = [ }, { displayName: 'Role in Purchase Process', - name: 'role_in_purchase_process', + name: 'roleInPurchaseProcess', type: 'options', options: [ { @@ -329,7 +329,7 @@ export const meetingRegistrantFields = [ options: [ { displayName: 'Occurrence ID', - name: 'occurrence_id', + name: 'occurrenceId', type: 'string', default: '', description: `Occurrence ID.`, diff --git a/packages/nodes-base/nodes/Zoom/Zoom.node.ts b/packages/nodes-base/nodes/Zoom/Zoom.node.ts index c0d1a05a9e..43221e8288 100644 --- a/packages/nodes-base/nodes/Zoom/Zoom.node.ts +++ b/packages/nodes-base/nodes/Zoom/Zoom.node.ts @@ -255,23 +255,23 @@ export class Zoom implements INodeType { i ) as IDataObject; const settings: Settings = {}; - if (additionalFields.cn_meeting) { - settings.cn_meeting = additionalFields.cn_meeting as boolean; + if (additionalFields.cnMeeting) { + settings.cn_meeting = additionalFields.cnMeeting as boolean; } - if (additionalFields.in_meeting) { - settings.in_meeting = additionalFields.in_meeting as boolean; + if (additionalFields.inMeeting) { + settings.in_meeting = additionalFields.inMeeting as boolean; } - if (additionalFields.join_before_host) { - settings.join_before_host = additionalFields.join_before_host as boolean; + if (additionalFields.joinBeforeHost) { + settings.join_before_host = additionalFields.joinBeforeHost as boolean; } - if (additionalFields.mute_upon_entry) { - settings.mute_upon_entry = additionalFields.mute_upon_entry as boolean; + if (additionalFields.muteUponEntry) { + settings.mute_upon_entry = additionalFields.muteUponEntry as boolean; } @@ -285,28 +285,28 @@ export class Zoom implements INodeType { } - if (additionalFields.alternative_hosts) { - settings.alternative_hosts = additionalFields.alternative_hosts as string; + if (additionalFields.alternativeHosts) { + settings.alternative_hosts = additionalFields.alternativeHosts as string; } - if (additionalFields.participant_video) { - settings.participant_video = additionalFields.participant_video as boolean; + if (additionalFields.participantVideo) { + settings.participant_video = additionalFields.participantVideo as boolean; } - if (additionalFields.host_video) { - settings.host_video = additionalFields.host_video as boolean; + if (additionalFields.hostVideo) { + settings.host_video = additionalFields.hostVideo as boolean; } - if (additionalFields.auto_recording) { - settings.auto_recording = additionalFields.auto_recording as string; + if (additionalFields.autoRecording) { + settings.auto_recording = additionalFields.autoRecording as string; } - if (additionalFields.registration_type) { - settings.registration_type = additionalFields.registration_type as number; + if (additionalFields.registrationType) { + settings.registration_type = additionalFields.registrationType as number; } @@ -374,23 +374,23 @@ export class Zoom implements INodeType { qs.occurrence_id = additionalFields.occurrenceId as string; } - if (additionalFields.cn_meeting) { - settings.cn_meeting = additionalFields.cn_meeting as boolean; + if (additionalFields.cnMeeting) { + settings.cn_meeting = additionalFields.cnMeeting as boolean; } - if (additionalFields.in_meeting) { - settings.in_meeting = additionalFields.in_meeting as boolean; + if (additionalFields.inMeeting) { + settings.in_meeting = additionalFields.inMeeting as boolean; } - if (additionalFields.join_before_host) { - settings.join_before_host = additionalFields.join_before_host as boolean; + if (additionalFields.joinBeforeHost) { + settings.join_before_host = additionalFields.joinBeforeHost as boolean; } - if (additionalFields.mute_upon_entry) { - settings.mute_upon_entry = additionalFields.mute_upon_entry as boolean; + if (additionalFields.muteUponEntry) { + settings.mute_upon_entry = additionalFields.muteUponEntry as boolean; } @@ -404,28 +404,28 @@ export class Zoom implements INodeType { } - if (additionalFields.alternative_hosts) { - settings.alternative_hosts = additionalFields.alternative_hosts as string; + if (additionalFields.alternativeHosts) { + settings.alternative_hosts = additionalFields.alternativeHosts as string; } - if (additionalFields.participant_video) { - settings.participant_video = additionalFields.participant_video as boolean; + if (additionalFields.participantVideo) { + settings.participant_video = additionalFields.participantVideo as boolean; } - if (additionalFields.host_video) { - settings.host_video = additionalFields.host_video as boolean; + if (additionalFields.hostVideo) { + settings.host_video = additionalFields.hostVideo as boolean; } - if (additionalFields.auto_recording) { - settings.auto_recording = additionalFields.auto_recording as string; + if (additionalFields.autoRecording) { + settings.auto_recording = additionalFields.autoRecording as string; } - if (additionalFields.registration_type) { - settings.registration_type = additionalFields.registration_type as number; + if (additionalFields.registrationType) { + settings.registration_type = additionalFields.registrationType as number; } @@ -525,14 +525,14 @@ export class Zoom implements INodeType { if (additionalFields.org) { body.org = additionalFields.org as string; } - if (additionalFields.job_title) { - body.job_title = additionalFields.job_title as string; + if (additionalFields.jobTitle) { + body.job_title = additionalFields.jobTitle as string; } - if (additionalFields.purchasing_time_frame) { - body.purchasing_time_frame = additionalFields.purchasing_time_frame as string; + if (additionalFields.purchasingTimeFrame) { + body.purchasing_time_frame = additionalFields.purchasingTimeFrame as string; } - if (additionalFields.role_in_purchase_process) { - body.role_in_purchase_process = additionalFields.role_in_purchase_process as string; + if (additionalFields.roleInPurchaseProcess) { + body.role_in_purchase_process = additionalFields.roleInPurchaseProcess as string; } responseData = await zoomApiRequest.call( this, @@ -575,6 +575,9 @@ export class Zoom implements INodeType { if (additionalFields.occurenceId) { qs.occurrence_id = additionalFields.occurrenceId as string; } + if (additionalFields.action) { + body.action = additionalFields.action as string; + } responseData = await zoomApiRequest.call( this, 'PUT', From 7fea380af557151b0419032d04f3336e06d2429b Mon Sep 17 00:00:00 2001 From: shraddha shaligram Date: Wed, 24 Jun 2020 11:18:56 -0700 Subject: [PATCH 13/20] fix webinar resource --- .../nodes/Zoom/WebinarDescription.ts | 20 ++++++------- packages/nodes-base/nodes/Zoom/Zoom.node.ts | 30 +++++++++++-------- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/packages/nodes-base/nodes/Zoom/WebinarDescription.ts b/packages/nodes-base/nodes/Zoom/WebinarDescription.ts index 1c0e03e096..eff6f4159c 100644 --- a/packages/nodes-base/nodes/Zoom/WebinarDescription.ts +++ b/packages/nodes-base/nodes/Zoom/WebinarDescription.ts @@ -66,7 +66,7 @@ export const webinarFields = [ ], }, }, - description: 'User ID or email address of user.', + description: 'User ID or email ID.', }, { displayName: 'Additional Fields', @@ -95,14 +95,14 @@ export const webinarFields = [ }, { displayName: 'Alternative Hosts', - name: 'alternative_hosts', + name: 'alternativeHosts', type: 'string', default: '', description: 'Alternative hosts email IDs.', }, { displayName: 'Approval Type', - name: 'approval_type', + name: 'approvalType', type: 'options', options: [ { @@ -145,7 +145,7 @@ export const webinarFields = [ }, { displayName: 'Auto Recording', - name: 'auto_recording', + name: 'autoRecording', type: 'options', options: [ { @@ -173,14 +173,14 @@ export const webinarFields = [ }, { displayName: 'Host Video', - name: 'host_video', + name: 'hostVideo', type: 'boolean', default: false, description: 'Start video when host joins the webinar.', }, { displayName: 'Panelists Video', - name: 'panelists_video', + name: 'panelistsVideo', type: 'boolean', default: false, description: 'Start video when panelists joins the webinar.', @@ -194,14 +194,14 @@ export const webinarFields = [ }, { displayName: 'Practice Session', - name: 'practice_session', + name: 'practiceSession', type: 'boolean', default: false, description: 'Enable Practice session.', }, { displayName: 'Registration Type', - name: 'registration_type', + name: 'registrationType', type: 'options', options: [ { @@ -438,8 +438,8 @@ export const webinarFields = [ /* webinar:update */ /* -------------------------------------------------------------------------- */ { - displayName: 'User ID', - name: 'userId', + displayName: 'Webinar ID', + name: 'webinarId', type: 'string', default: '', required: true, diff --git a/packages/nodes-base/nodes/Zoom/Zoom.node.ts b/packages/nodes-base/nodes/Zoom/Zoom.node.ts index 43221e8288..60f186b31a 100644 --- a/packages/nodes-base/nodes/Zoom/Zoom.node.ts +++ b/packages/nodes-base/nodes/Zoom/Zoom.node.ts @@ -603,30 +603,34 @@ export class Zoom implements INodeType { } - if (additionalFields.alternative_hosts) { - settings.alternative_hosts = additionalFields.alternative_hosts as string; + if (additionalFields.alternativeHosts) { + settings.alternative_hosts = additionalFields.alternativeHosts as string; } - if (additionalFields.panelists_video) { - settings.panelists_video = additionalFields.panelists_video as boolean; + if (additionalFields.panelistsVideo) { + settings.panelists_video = additionalFields.panelistsVideo as boolean; } - if (additionalFields.practice_session) { - settings.practice_session = additionalFields.practice_session as boolean; + if (additionalFields.hostVideo) { + settings.host_video = additionalFields.hostVideo as boolean; } - if (additionalFields.auto_recording) { - settings.auto_recording = additionalFields.auto_recording as string; + if (additionalFields.practiceSession) { + settings.practice_session = additionalFields.practiceSession as boolean; + + } + if (additionalFields.autoRecording) { + settings.auto_recording = additionalFields.autoRecording as string; } - if (additionalFields.registration_type) { - settings.registration_type = additionalFields.registration_type as number; + if (additionalFields.registrationType) { + settings.registration_type = additionalFields.registrationType as number; } - if (additionalFields.approval_type) { - settings.approval_type = additionalFields.approval_type as number; + if (additionalFields.approvalType) { + settings.approval_type = additionalFields.approvalType as number; } @@ -823,7 +827,7 @@ export class Zoom implements INodeType { responseData = await zoomApiRequest.call( this, 'PATCH', - `/users/${webinarId}/webinars`, + `webinars/${webinarId}`, body, qs ); From f9fe9de235184f13d2871356a830173f8787083b Mon Sep 17 00:00:00 2001 From: shraddha shaligram Date: Wed, 24 Jun 2020 11:25:07 -0700 Subject: [PATCH 14/20] fix webinar naming conventions --- .../nodes/Zoom/WebinarDescription.ts | 16 +++++----- packages/nodes-base/nodes/Zoom/Zoom.node.ts | 32 +++++++++++-------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/packages/nodes-base/nodes/Zoom/WebinarDescription.ts b/packages/nodes-base/nodes/Zoom/WebinarDescription.ts index eff6f4159c..421eb2cf50 100644 --- a/packages/nodes-base/nodes/Zoom/WebinarDescription.ts +++ b/packages/nodes-base/nodes/Zoom/WebinarDescription.ts @@ -482,14 +482,14 @@ export const webinarFields = [ }, { displayName: 'Alternative Hosts', - name: 'alternative_hosts', + name: 'alternativeHosts', type: 'string', default: '', description: 'Alternative hosts email IDs.', }, { displayName: 'Approval Type', - name: 'approval_type', + name: 'approvalType', type: 'options', options: [ { @@ -510,7 +510,7 @@ export const webinarFields = [ }, { displayName: 'Auto Recording', - name: 'auto_recording', + name: 'autoRecording', type: 'options', options: [ { @@ -560,14 +560,14 @@ export const webinarFields = [ }, { displayName: 'Host Video', - name: 'host_video', + name: 'hostVideo', type: 'boolean', default: false, description: 'Start video when host joins the webinar.', }, { displayName: 'Occurrence ID', - name: 'occurrence_id', + name: 'occurrenceId', type: 'string', default: '', description: `Webinar occurrence ID.`, @@ -581,21 +581,21 @@ export const webinarFields = [ }, { displayName: 'Panelists Video', - name: 'panelists_video', + name: 'panelistsVideo', type: 'boolean', default: false, description: 'Start video when panelists joins the webinar.', }, { displayName: 'Practice Session', - name: 'practice_session', + name: 'practiceSession', type: 'boolean', default: false, description: 'Enable Practice session.', }, { displayName: 'Registration Type', - name: 'registration_type', + name: 'registrationType', type: 'options', options: [ { diff --git a/packages/nodes-base/nodes/Zoom/Zoom.node.ts b/packages/nodes-base/nodes/Zoom/Zoom.node.ts index 60f186b31a..f7e00b0de7 100644 --- a/packages/nodes-base/nodes/Zoom/Zoom.node.ts +++ b/packages/nodes-base/nodes/Zoom/Zoom.node.ts @@ -749,8 +749,8 @@ export class Zoom implements INodeType { 'additionalFields', i ) as IDataObject; - if (additionalFields.occurrence_id) { - qs.occurrence_id = additionalFields.occurrence_id as string; + if (additionalFields.occurrenceId) { + qs.occurrence_id = additionalFields.occurrenceId as string; } const settings: Settings = {}; @@ -758,30 +758,34 @@ export class Zoom implements INodeType { settings.audio = additionalFields.audio as string; } - if (additionalFields.alternative_hosts) { - settings.alternative_hosts = additionalFields.alternative_hosts as string; + if (additionalFields.alternativeHosts) { + settings.alternative_hosts = additionalFields.alternativeHosts as string; } - if (additionalFields.panelists_video) { - settings.panelists_video = additionalFields.panelists_video as boolean; + if (additionalFields.panelistsVideo) { + settings.panelists_video = additionalFields.panelistsVideo as boolean; } - if (additionalFields.practice_session) { - settings.practice_session = additionalFields.practice_session as boolean; + if (additionalFields.hostVideo) { + settings.host_video = additionalFields.hostVideo as boolean; } - if (additionalFields.auto_recording) { - settings.auto_recording = additionalFields.auto_recording as string; + if (additionalFields.practiceSession) { + settings.practice_session = additionalFields.practiceSession as boolean; + + } + if (additionalFields.autoRecording) { + settings.auto_recording = additionalFields.autoRecording as string; } - if (additionalFields.registration_type) { - settings.registration_type = additionalFields.registration_type as number; + if (additionalFields.registrationType) { + settings.registration_type = additionalFields.registrationType as number; } - if (additionalFields.approval_type) { - settings.approval_type = additionalFields.approval_type as number; + if (additionalFields.approvalType) { + settings.approval_type = additionalFields.approvalType as number; } From 34e05f0f72d1f9726ffd9b1e9c18840470bdee42 Mon Sep 17 00:00:00 2001 From: shraddha shaligram Date: Wed, 24 Jun 2020 12:01:06 -0700 Subject: [PATCH 15/20] add credentials comments --- packages/nodes-base/nodes/Zoom/Zoom.node.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/nodes-base/nodes/Zoom/Zoom.node.ts b/packages/nodes-base/nodes/Zoom/Zoom.node.ts index f7e00b0de7..e6e6a78600 100644 --- a/packages/nodes-base/nodes/Zoom/Zoom.node.ts +++ b/packages/nodes-base/nodes/Zoom/Zoom.node.ts @@ -65,6 +65,9 @@ export class Zoom implements INodeType { outputs: ['main'], credentials: [ { + // create a JWT app on Zoom Marketplace + //https://marketplace.zoom.us/develop/create + //get the JWT token as access token name: 'zoomApi', required: true, displayOptions: { @@ -76,6 +79,8 @@ export class Zoom implements INodeType { }, }, { + //create a account level OAuth app + //https://marketplace.zoom.us/develop/create name: 'zoomOAuth2Api', required: true, displayOptions: { From dee03a5e4c0de14911edcbeb899902774ce93ab1 Mon Sep 17 00:00:00 2001 From: shraddha shaligram Date: Wed, 24 Jun 2020 15:50:23 -0700 Subject: [PATCH 16/20] minor fix --- packages/nodes-base/nodes/Zoom/MeetingDescription.ts | 7 +++++++ packages/nodes-base/nodes/Zoom/Zoom.node.ts | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/packages/nodes-base/nodes/Zoom/MeetingDescription.ts b/packages/nodes-base/nodes/Zoom/MeetingDescription.ts index 3efcc2a2bc..0df1f35b72 100644 --- a/packages/nodes-base/nodes/Zoom/MeetingDescription.ts +++ b/packages/nodes-base/nodes/Zoom/MeetingDescription.ts @@ -277,6 +277,13 @@ export const meetingFields = [ default: '', description: `Time zone used in the response. The default is the time zone of the calendar.`, }, + { + displayName: 'Waiting Room', + name: 'waitingRoom', + type: 'boolean', + default: false, + description: 'Enable waiting room.', + }, { displayName: 'Watermark', name: 'watermark', diff --git a/packages/nodes-base/nodes/Zoom/Zoom.node.ts b/packages/nodes-base/nodes/Zoom/Zoom.node.ts index e6e6a78600..52435e5ab9 100644 --- a/packages/nodes-base/nodes/Zoom/Zoom.node.ts +++ b/packages/nodes-base/nodes/Zoom/Zoom.node.ts @@ -41,6 +41,7 @@ interface Settings { join_before_host?: boolean; mute_upon_entry?: boolean; watermark?: boolean; + waiting_room?: boolean; audio?: string; alternative_hosts?: string; auto_recording?: string; @@ -278,6 +279,10 @@ export class Zoom implements INodeType { if (additionalFields.muteUponEntry) { settings.mute_upon_entry = additionalFields.muteUponEntry as boolean; + } + if (additionalFields.waitingRoom) { + settings.waiting_room = additionalFields.waitingRoom as boolean; + } if (additionalFields.watermark) { From 4555d6bfc9a18df485990968fb34c70de5b2242a Mon Sep 17 00:00:00 2001 From: ricardo Date: Wed, 24 Jun 2020 19:28:08 -0400 Subject: [PATCH 17/20] :zap: Improvements to Zoom-Node --- .../nodes-base/nodes/Zoom/GenericFunctions.ts | 1 + .../nodes/Zoom/MeetingDescription.ts | 592 +++++---- .../Zoom/MeetingRegistrantDescription.ts | 31 +- packages/nodes-base/nodes/Zoom/Zoom.node.ts | 1060 ++++++++--------- 4 files changed, 821 insertions(+), 863 deletions(-) diff --git a/packages/nodes-base/nodes/Zoom/GenericFunctions.ts b/packages/nodes-base/nodes/Zoom/GenericFunctions.ts index 6a8593e3ab..95e07f09b9 100644 --- a/packages/nodes-base/nodes/Zoom/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Zoom/GenericFunctions.ts @@ -33,6 +33,7 @@ export async function zoomApiRequest(this: IExecuteFunctions | IExecuteSingleFun if (Object.keys(query).length === 0) { delete options.qs; } + try { if (authenticationMethod === 'accessToken') { const credentials = this.getCredentials('zoomApi'); diff --git a/packages/nodes-base/nodes/Zoom/MeetingDescription.ts b/packages/nodes-base/nodes/Zoom/MeetingDescription.ts index 3efcc2a2bc..130830b9fe 100644 --- a/packages/nodes-base/nodes/Zoom/MeetingDescription.ts +++ b/packages/nodes-base/nodes/Zoom/MeetingDescription.ts @@ -43,31 +43,13 @@ export const meetingOperations = [ ], default: 'create', description: 'The operation to perform.', - } + }, ] as INodeProperties[]; export const meetingFields = [ /* -------------------------------------------------------------------------- */ - /* meeting:create */ + /* meeting:create */ /* -------------------------------------------------------------------------- */ - { - displayName: 'User ID', - name: 'userId', - type: 'string', - default: '', - required: true, - displayOptions: { - show: { - operation: [ - 'create', - ], - resource: [ - 'meeting', - ], - }, - }, - description: 'User ID or Email Address.', - }, { displayName: 'Additional Fields', name: 'additionalFields', @@ -90,98 +72,29 @@ export const meetingFields = [ displayName: 'Agenda', name: 'agenda', type: 'string', + typeOptions: { + alwaysOpenEditWindow: true, + }, default: '', description: 'Meeting agenda.', }, - { - displayName: 'Alternative Hosts', - name: 'alternativeHosts', - type: 'string', - default: '', - description: 'Alternative hosts email IDs.', - }, - { - displayName: 'Auto Recording', - name: 'autoRecording', - type: 'options', - options: [ - { - name: 'Record on Local', - value: 'local', - }, - { - name: 'Record on Cloud', - value: 'cloud', - }, - { - name: 'Disabled', - value: 'none', - }, - ], - default: 'none', - description: 'Auto recording.', - }, - { - displayName: 'Audio', - name: 'audio', - type: 'options', - options: [ - { - name: 'Both Telephony and VoiP', - value: 'both', - }, - { - name: 'Telephony', - value: 'telephony', - }, - { - name: 'VOIP', - value: 'voip', - }, - - ], - default: 'both', - description: 'Determine how participants can join audio portion of the meeting.', - }, { displayName: 'Duration', name: 'duration', type: 'number', - default: '', - description: 'Duration.', - }, - { - displayName: 'Host Meeting in China', - name: 'cnMeeting', - type: 'boolean', - default: false, - description: 'Host Meeting in China.', - }, - { - displayName: 'Host Meeting in India', - name: 'inMeeting', - type: 'boolean', - default: false, - description: 'Host Meeting in India.', - }, - { - displayName: 'Host Video', - name: 'hostVideo', - type: 'boolean', - default: false, - description: 'Start video when host joins the meeting.', - }, - { - displayName: 'Join Before Host', - name: 'joinBeforeHost', - type: 'boolean', - default: false, - description: 'Allow participants to join the meeting before host starts it.', + typeOptions: { + minValue: 0, + }, + default: 0, + description: 'Meeting duration (minutes).', }, { displayName: 'Meeting Topic', name: 'topic', type: 'string', + typeOptions: { + alwaysOpenEditWindow: true, + }, default: '', description: `Meeting topic.`, }, @@ -211,20 +124,6 @@ export const meetingFields = [ default: 2, description: 'Meeting type.', }, - { - displayName: 'Muting before entry', - name: 'muteUponEntry', - type: 'boolean', - default: false, - description: 'Mute participants upon entry.', - }, - { - displayName: 'Participant Video', - name: 'participantVideo', - type: 'boolean', - default: false, - description: 'Start video when participant joins the meeting.', - }, { displayName: 'Password', name: 'password', @@ -232,27 +131,6 @@ export const meetingFields = [ default: '', description: 'Password to join the meeting with maximum 10 characters.', }, - { - displayName: 'Registration Type', - name: 'registrationType', - type: 'options', - options: [ - { - name: 'Attendees register once and can attend any of the occurences', - value: 1, - }, - { - name: 'Attendees need to register for every occurrence', - value: 2, - }, - { - name: 'Attendees register once and can choose one or more occurrences to attend', - value: 3, - }, - ], - default: 1, - description: 'Registration type. Used for recurring meetings with fixed time only', - }, { displayName: 'Schedule For', name: 'scheduleFor', @@ -260,6 +138,135 @@ export const meetingFields = [ default: '', description: 'Schedule meeting for someone else from your account, provide their email ID.', }, + { + displayName: 'Settings', + name: 'settings', + type: 'collection', + placeholder: 'Add Setting', + default: {}, + options: [ + { + displayName: 'Audio', + name: 'audio', + type: 'options', + options: [ + { + name: 'Both Telephony and VoiP', + value: 'both', + }, + { + name: 'Telephony', + value: 'telephony', + }, + { + name: 'VOIP', + value: 'voip', + }, + + ], + default: 'both', + description: 'Determine how participants can join audio portion of the meeting.', + }, + { + displayName: 'Alternative Hosts', + name: 'alternativeHosts', + type: 'string', + default: '', + description: 'Alternative hosts email IDs.', + }, + { + displayName: 'Auto Recording', + name: 'autoRecording', + type: 'options', + options: [ + { + name: 'Record on Local', + value: 'local', + }, + { + name: 'Record on Cloud', + value: 'cloud', + }, + { + name: 'Disabled', + value: 'none', + }, + ], + default: 'none', + description: 'Auto recording.', + }, + { + displayName: 'Host Meeting in China', + name: 'cnMeeting', + type: 'boolean', + default: false, + description: 'Host Meeting in China.', + }, + { + displayName: 'Host Meeting in India', + name: 'inMeeting', + type: 'boolean', + default: false, + description: 'Host Meeting in India.', + }, + { + displayName: 'Host Video', + name: 'hostVideo', + type: 'boolean', + default: false, + description: 'Start video when host joins the meeting.', + }, + { + displayName: 'Join Before Host', + name: 'joinBeforeHost', + type: 'boolean', + default: false, + description: 'Allow participants to join the meeting before host starts it.', + }, + { + displayName: 'Muting Upon Entry', + name: 'muteUponEntry', + type: 'boolean', + default: false, + description: 'Mute participants upon entry.', + }, + { + displayName: 'Participant Video', + name: 'participantVideo', + type: 'boolean', + default: false, + description: 'Start video when participant joins the meeting.', + }, + { + displayName: 'Registration Type', + name: 'registrationType', + type: 'options', + options: [ + { + name: 'Attendees register once and can attend any of the occurences', + value: 1, + }, + { + name: 'Attendees need to register for every occurrence', + value: 2, + }, + { + name: 'Attendees register once and can choose one or more occurrences to attend', + value: 3, + }, + ], + default: 1, + description: 'Registration type. Used for recurring meetings with fixed time only', + }, + { + displayName: 'Watermark', + name: 'watermark', + type: 'boolean', + default: false, + description: 'Adds watermark when viewing a shared screen.', + }, + ], + }, { displayName: 'Start Time', name: 'startTime', @@ -277,13 +284,6 @@ export const meetingFields = [ default: '', description: `Time zone used in the response. The default is the time zone of the calendar.`, }, - { - displayName: 'Watermark', - name: 'watermark', - type: 'boolean', - default: false, - description: 'Adds watermark when viewing a shared screen.', - }, ], }, /* -------------------------------------------------------------------------- */ @@ -342,26 +342,8 @@ export const meetingFields = [ ], }, /* -------------------------------------------------------------------------- */ - /* meeting:getAll */ + /* meeting:getAll */ /* -------------------------------------------------------------------------- */ - { - displayName: 'User ID', - name: 'userId', - type: 'string', - default: '', - required: true, - displayOptions: { - show: { - operation: [ - 'getAll', - ], - resource: [ - 'meeting', - ], - }, - }, - description: 'User ID or email-ID.', - }, { displayName: 'Return All', name: 'returnAll', @@ -404,10 +386,10 @@ export const meetingFields = [ description: 'How many results to return.', }, { - displayName: 'Additional Fields', - name: 'additionalFields', + displayName: 'Filters', + name: 'filters', type: 'collection', - placeholder: 'Add Field', + placeholder: 'Add Filter', default: {}, displayOptions: { show: { @@ -429,23 +411,26 @@ export const meetingFields = [ { name: 'Scheduled', value: 'scheduled', + description: 'This includes all valid past meetings, live meetings and upcoming scheduled meetings' }, { name: 'Live', value: 'live', + description: 'All ongoing meetings', }, { name: 'Upcoming', value: 'upcoming', + description: 'All upcoming meetings including live meetings', }, ], default: 'live', description: `Meeting type.`, }, - ] + ], }, /* -------------------------------------------------------------------------- */ - /* meeting:delete */ + /* meeting:delete */ /* -------------------------------------------------------------------------- */ { displayName: 'Meeting ID', @@ -500,7 +485,7 @@ export const meetingFields = [ }, /* -------------------------------------------------------------------------- */ - /* meeting:update */ + /* meeting:update */ /* -------------------------------------------------------------------------- */ { displayName: 'Meeting ID', @@ -521,8 +506,8 @@ export const meetingFields = [ description: 'Meeting ID.', }, { - displayName: 'Additional Fields', - name: 'additionalFields', + displayName: 'Update Fields', + name: 'updateFields', type: 'collection', placeholder: 'Add Field', default: {}, @@ -541,100 +526,21 @@ export const meetingFields = [ displayName: 'Agenda', name: 'agenda', type: 'string', + typeOptions: { + alwaysOpenEditWindow: true, + }, default: '', description: 'Meeting agenda.', }, - { - displayName: 'Alternative Hosts', - name: 'alternativeHosts', - type: 'string', - default: '', - description: 'Alternative hosts email IDs.', - }, - { - displayName: 'Audio', - name: 'audio', - type: 'options', - options: [ - { - name: 'Both Telephony and VoiP', - value: 'both', - }, - { - name: 'Telephony', - value: 'telephony', - }, - { - name: 'VOIP', - value: 'voip', - }, - ], - default: 'both', - description: 'Determine how participants can join audio portion of the meeting.', - }, - { - displayName: 'Auto Recording', - name: 'autoRecording', - type: 'options', - options: [ - { - name: 'Record on Local', - value: 'local', - }, - { - name: 'Record on Cloud', - value: 'cloud', - }, - { - name: 'Disabled', - value: 'none', - }, - ], - default: 'none', - description: 'Auto recording.', - }, - { displayName: 'Duration', name: 'duration', type: 'number', - default: '', - description: 'Duration.', - }, - { - displayName: 'Join Before Host', - name: 'joinBeforeHost', - type: 'boolean', - default: false, - description: 'Allow participants to join the meeting before host starts it.', - }, - { - displayName: 'Host Meeting in China', - name: 'cnMeeting', - type: 'boolean', - default: false, - description: 'Host Meeting in China.', - }, - { - displayName: 'Host Meeting in India', - name: 'inMeeting', - type: 'boolean', - default: false, - description: 'Host Meeting in India.', - }, - { - displayName: 'Host Video', - name: 'hostVideo', - type: 'boolean', - default: false, - description: 'Start video when host joins the meeting.', - }, - { - displayName: 'Occurrence ID', - name: 'occurrenceId', - type: 'string', - default: '', - description: 'Occurrence ID.', + typeOptions: { + minValue: 0, + }, + default: 0, + description: 'Meeting duration (minutes).', }, { displayName: 'Meeting Topic', @@ -669,13 +575,6 @@ export const meetingFields = [ default: 2, description: 'Meeting type.', }, - { - displayName: 'Muting Before Entry', - name: 'muteUponEntry', - type: 'boolean', - default: false, - description: 'Mute participants upon entry.', - }, { displayName: 'Password', name: 'password', @@ -683,34 +582,6 @@ export const meetingFields = [ default: '', description: 'Password to join the meeting with maximum 10 characters.', }, - { - displayName: 'Participant Video', - name: 'participantVideo', - type: 'boolean', - default: false, - description: 'Start video when participant joins the meeting.', - }, - { - displayName: 'Registration Type', - name: 'registrationType', - type: 'options', - options: [ - { - name: 'Attendees register once and can attend any of the occurrences', - value: 1, - }, - { - name: 'Attendees need to register for every occurrence', - value: 2, - }, - { - name: 'Attendees register once and can choose one or more occurrences to attend', - value: 3, - }, - ], - default: 1, - description: 'Registration type. Used for recurring meetings with fixed time only', - }, { displayName: 'Schedule For', name: 'scheduleFor', @@ -718,6 +589,135 @@ export const meetingFields = [ default: '', description: 'Schedule meeting for someone else from your account, provide their email ID.', }, + { + displayName: 'Settings', + name: 'settings', + type: 'collection', + placeholder: 'Add Setting', + default: {}, + options: [ + { + displayName: 'Audio', + name: 'audio', + type: 'options', + options: [ + { + name: 'Both Telephony and VoiP', + value: 'both', + }, + { + name: 'Telephony', + value: 'telephony', + }, + { + name: 'VOIP', + value: 'voip', + }, + + ], + default: 'both', + description: 'Determine how participants can join audio portion of the meeting.', + }, + { + displayName: 'Alternative Hosts', + name: 'alternativeHosts', + type: 'string', + default: '', + description: 'Alternative hosts email IDs.', + }, + { + displayName: 'Auto Recording', + name: 'autoRecording', + type: 'options', + options: [ + { + name: 'Record on Local', + value: 'local', + }, + { + name: 'Record on Cloud', + value: 'cloud', + }, + { + name: 'Disabled', + value: 'none', + }, + ], + default: 'none', + description: 'Auto recording.', + }, + { + displayName: 'Host Meeting in China', + name: 'cnMeeting', + type: 'boolean', + default: false, + description: 'Host Meeting in China.', + }, + { + displayName: 'Host Meeting in India', + name: 'inMeeting', + type: 'boolean', + default: false, + description: 'Host Meeting in India.', + }, + { + displayName: 'Host Video', + name: 'hostVideo', + type: 'boolean', + default: false, + description: 'Start video when host joins the meeting.', + }, + { + displayName: 'Join Before Host', + name: 'joinBeforeHost', + type: 'boolean', + default: false, + description: 'Allow participants to join the meeting before host starts it.', + }, + { + displayName: 'Muting Upon Entry', + name: 'muteUponEntry', + type: 'boolean', + default: false, + description: 'Mute participants upon entry.', + }, + { + displayName: 'Participant Video', + name: 'participantVideo', + type: 'boolean', + default: false, + description: 'Start video when participant joins the meeting.', + }, + { + displayName: 'Registration Type', + name: 'registrationType', + type: 'options', + options: [ + { + name: 'Attendees register once and can attend any of the occurences', + value: 1, + }, + { + name: 'Attendees need to register for every occurrence', + value: 2, + }, + { + name: 'Attendees register once and can choose one or more occurrences to attend', + value: 3, + }, + ], + default: 1, + description: 'Registration type. Used for recurring meetings with fixed time only', + }, + { + displayName: 'Watermark', + name: 'watermark', + type: 'boolean', + default: false, + description: 'Adds watermark when viewing a shared screen.', + }, + ], + }, { displayName: 'Start Time', name: 'startTime', @@ -735,16 +735,6 @@ export const meetingFields = [ default: '', description: `Time zone used in the response. The default is the time zone of the calendar.`, }, - { - displayName: 'Watermark', - name: 'watermark', - type: 'boolean', - default: false, - description: 'Adds watermark when viewing a shared screen.', - }, - - ], }, - ] as INodeProperties[]; diff --git a/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts b/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts index 5d40aae014..5438f18fa3 100644 --- a/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts +++ b/packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts @@ -1,6 +1,7 @@ import { INodeProperties, } from 'n8n-workflow'; + export const meetingRegistrantOperations = [ { displayName: 'Operation', @@ -9,7 +10,7 @@ export const meetingRegistrantOperations = [ displayOptions: { show: { resource: [ - 'meetingRegistrants', + 'meetingRegistrant', ], }, }, @@ -38,7 +39,7 @@ export const meetingRegistrantOperations = [ export const meetingRegistrantFields = [ /* -------------------------------------------------------------------------- */ - /* meetingRegistrants:create */ + /* meetingRegistrant:create */ /* -------------------------------------------------------------------------- */ { displayName: 'Meeting Id', @@ -52,7 +53,7 @@ export const meetingRegistrantFields = [ 'create', ], resource: [ - 'meetingRegistrants', + 'meetingRegistrant', ], }, }, @@ -70,7 +71,7 @@ export const meetingRegistrantFields = [ 'create', ], resource: [ - 'meetingRegistrants', + 'meetingRegistrant', ], }, }, @@ -88,7 +89,7 @@ export const meetingRegistrantFields = [ 'create', ], resource: [ - 'meetingRegistrants', + 'meetingRegistrant', ], }, }, @@ -107,7 +108,7 @@ export const meetingRegistrantFields = [ ], resource: [ - 'meetingRegistrants', + 'meetingRegistrant', ], }, }, @@ -248,7 +249,7 @@ export const meetingRegistrantFields = [ ], }, /* -------------------------------------------------------------------------- */ - /* meetingRegistrants:getAll */ + /* meetingRegistrant:getAll */ /* -------------------------------------------------------------------------- */ { displayName: 'Meeting ID', @@ -262,7 +263,7 @@ export const meetingRegistrantFields = [ 'getAll', ], resource: [ - 'meetingRegistrants', + 'meetingRegistrant', ], }, }, @@ -278,7 +279,7 @@ export const meetingRegistrantFields = [ 'getAll', ], resource: [ - 'meetingRegistrants', + 'meetingRegistrant', ], }, }, @@ -295,7 +296,7 @@ export const meetingRegistrantFields = [ 'getAll', ], resource: [ - 'meetingRegistrants', + 'meetingRegistrant', ], returnAll: [ false, @@ -322,7 +323,7 @@ export const meetingRegistrantFields = [ ], resource: [ - 'meetingRegistrants', + 'meetingRegistrant', ], }, }, @@ -359,7 +360,7 @@ export const meetingRegistrantFields = [ ] }, /* -------------------------------------------------------------------------- */ - /* meetingRegistrants:update */ + /* meetingRegistrant:update */ /* -------------------------------------------------------------------------- */ { displayName: 'Meeting ID', @@ -373,7 +374,7 @@ export const meetingRegistrantFields = [ 'update', ], resource: [ - 'meetingRegistrants', + 'meetingRegistrant', ], }, }, @@ -390,7 +391,7 @@ export const meetingRegistrantFields = [ 'update', ], resource: [ - 'meetingRegistrants', + 'meetingRegistrant', ], }, }, @@ -423,7 +424,7 @@ export const meetingRegistrantFields = [ 'update', ], resource: [ - 'meetingRegistrants', + 'meetingRegistrant', ], }, }, diff --git a/packages/nodes-base/nodes/Zoom/Zoom.node.ts b/packages/nodes-base/nodes/Zoom/Zoom.node.ts index e6e6a78600..e3c9a083a5 100644 --- a/packages/nodes-base/nodes/Zoom/Zoom.node.ts +++ b/packages/nodes-base/nodes/Zoom/Zoom.node.ts @@ -1,14 +1,16 @@ import { IExecuteFunctions, } from 'n8n-core'; + import { IDataObject, - INodeExecutionData, - INodeType, ILoadOptionsFunctions, - INodeTypeDescription, + INodeExecutionData, INodePropertyOptions, + INodeType, + INodeTypeDescription, } from 'n8n-workflow'; + import { zoomApiRequest, zoomApiRequestAllItems, @@ -19,16 +21,15 @@ import { meetingFields, } from './MeetingDescription'; -import { - meetingRegistrantOperations, - meetingRegistrantFields, +// import { +// meetingRegistrantOperations, +// meetingRegistrantFields, +// } from './MeetingRegistrantDescription'; -} from './MeetingRegistrantDescription'; - -import { - webinarOperations, - webinarFields, -} from './WebinarDescription'; +// import { +// webinarOperations, +// webinarFields, +// } from './WebinarDescription'; import * as moment from 'moment-timezone'; @@ -48,6 +49,7 @@ interface Settings { approval_type?: number; practice_session?: boolean; } + export class Zoom implements INodeType { description: INodeTypeDescription = { displayName: 'Zoom', @@ -119,14 +121,14 @@ export class Zoom implements INodeType { name: 'Meeting', value: 'meeting' }, - { - name: 'Meeting Registrant', - value: 'meetingRegistrants' - }, - { - name: 'Webinar', - value: 'webinar' - } + // { + // name: 'Meeting Registrant', + // value: 'meetingRegistrant' + // }, + // { + // name: 'Webinar', + // value: 'webinar' + // } ], default: 'meeting', description: 'The resource to operate on.' @@ -135,13 +137,13 @@ export class Zoom implements INodeType { ...meetingOperations, ...meetingFields, - //MEETING REGISTRANTS - ...meetingRegistrantOperations, - ...meetingRegistrantFields, + // //MEETING REGISTRANTS + // ...meetingRegistrantOperations, + // ...meetingRegistrantFields, - //WEBINARS - ...webinarOperations, - ...webinarFields, + // //WEBINARS + // ...webinarOperations, + // ...webinarFields, ] }; @@ -169,7 +171,6 @@ export class Zoom implements INodeType { const items = this.getInputData(); const returnData: IDataObject[] = []; let qs: IDataObject = {}; - let body: IDataObject = {}; let responseData; const resource = this.getNodeParameter('resource', 0) as string; const operation = this.getNodeParameter('operation', 0) as string; @@ -186,14 +187,13 @@ export class Zoom implements INodeType { 'additionalFields', i ) as IDataObject; + if (additionalFields.showPreviousOccurrences) { qs.show_previous_occurrences = additionalFields.showPreviousOccurrences as boolean; - } if (additionalFields.occurrenceId) { qs.occurrence_id = additionalFields.occurrenceId as string; - } responseData = await zoomApiRequest.call( @@ -206,23 +206,22 @@ export class Zoom implements INodeType { } if (operation === 'getAll') { //https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetings - const userId = this.getNodeParameter('userId', i) as string; const returnAll = this.getNodeParameter('returnAll', i) as boolean; - const additionalFields = this.getNodeParameter( - 'additionalFields', + const filters = this.getNodeParameter( + 'filters', i ) as IDataObject; - if (additionalFields.type) { - qs.type = additionalFields.type as string; - + if (filters.type) { + qs.type = filters.type as string; } + if (returnAll) { - responseData = await zoomApiRequestAllItems.call(this, 'meetings', 'GET', `/users/${userId}/meetings`, {}, qs); + responseData = await zoomApiRequestAllItems.call(this, 'meetings', 'GET', '/users/me/meetings', {}, qs); } else { qs.page_size = this.getNodeParameter('limit', i) as number; - responseData = await zoomApiRequest.call(this, 'GET', `/users/${userId}/meetings`, {}, qs); - + responseData = await zoomApiRequest.call(this, 'GET', '/users/me/meetings', {}, qs); + responseData = responseData.meetings; } } @@ -235,12 +234,10 @@ export class Zoom implements INodeType { ) as IDataObject; if (additionalFields.scheduleForReminder) { qs.schedule_for_reminder = additionalFields.scheduleForReminder as boolean; - } if (additionalFields.occurrenceId) { qs.occurrence_id = additionalFields.occurrenceId; - } responseData = await zoomApiRequest.call( @@ -254,114 +251,100 @@ export class Zoom implements INodeType { } 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.cnMeeting) { - settings.cn_meeting = additionalFields.cnMeeting as boolean; + const body: IDataObject = {}; + + if (additionalFields.settings) { + const settingValues: Settings = {}; + const settings = additionalFields.settings as IDataObject; + + if (settings.cnMeeting) { + settingValues.cn_meeting = settings.cnMeeting as boolean; + } + + if (settings.inMeeting) { + settingValues.in_meeting = settings.inMeeting as boolean; + } + + if (settings.joinBeforeHost) { + settingValues.join_before_host = settings.joinBeforeHost as boolean; + } + + if (settings.muteUponEntry) { + settingValues.mute_upon_entry = settings.muteUponEntry as boolean; + } + + if (settings.watermark) { + settingValues.watermark = settings.watermark as boolean; + } + + if (settings.audio) { + settingValues.audio = settings.audio as string; + } + + if (settings.alternativeHosts) { + settingValues.alternative_hosts = settings.alternativeHosts as string; + } + + if (settings.participantVideo) { + settingValues.participant_video = settings.participantVideo as boolean; + } + + if (settings.hostVideo) { + settingValues.host_video = settings.hostVideo as boolean; + } + + if (settings.autoRecording) { + settingValues.auto_recording = settings.autoRecording as string; + } + + if (settings.registrationType) { + settingValues.registration_type = settings.registrationType as number; + } + + body.settings = settingValues; } - if (additionalFields.inMeeting) { - settings.in_meeting = additionalFields.inMeeting as boolean; - - } - - if (additionalFields.joinBeforeHost) { - settings.join_before_host = additionalFields.joinBeforeHost as boolean; - - } - - if (additionalFields.muteUponEntry) { - settings.mute_upon_entry = additionalFields.muteUponEntry as boolean; - - } - - if (additionalFields.watermark) { - settings.watermark = additionalFields.watermark as boolean; - - } - - if (additionalFields.audio) { - settings.audio = additionalFields.audio as string; - - } - - if (additionalFields.alternativeHosts) { - settings.alternative_hosts = additionalFields.alternativeHosts as string; - - } - - if (additionalFields.participantVideo) { - settings.participant_video = additionalFields.participantVideo as boolean; - - } - - if (additionalFields.hostVideo) { - settings.host_video = additionalFields.hostVideo as boolean; - - } - - if (additionalFields.autoRecording) { - settings.auto_recording = additionalFields.autoRecording as string; - - } - - if (additionalFields.registrationType) { - settings.registration_type = additionalFields.registrationType 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`, + `/users/me/meetings`, body, qs ); @@ -369,112 +352,94 @@ export class Zoom implements INodeType { if (operation === 'update') { //https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingupdate const meetingId = this.getNodeParameter('meetingId', i) as string; - const settings: Settings = {}; - const additionalFields = this.getNodeParameter( - 'additionalFields', + const updateFields = this.getNodeParameter( + 'updateFields', i ) as IDataObject; - if (additionalFields.occurrenceId) { - qs.occurrence_id = additionalFields.occurrenceId as string; + const body: IDataObject = {}; + + if (updateFields.settings) { + const settingValues: Settings = {}; + const settings = updateFields.settings as IDataObject; + + if (settings.cnMeeting) { + settingValues.cn_meeting = settings.cnMeeting as boolean; + } + + if (settings.inMeeting) { + settingValues.in_meeting = settings.inMeeting as boolean; + } + + if (settings.joinBeforeHost) { + settingValues.join_before_host = settings.joinBeforeHost as boolean; + } + + if (settings.muteUponEntry) { + settingValues.mute_upon_entry = settings.muteUponEntry as boolean; + } + + if (settings.watermark) { + settingValues.watermark = settings.watermark as boolean; + } + + if (settings.audio) { + settingValues.audio = settings.audio as string; + } + + if (settings.alternativeHosts) { + settingValues.alternative_hosts = settings.alternativeHosts as string; + } + + if (settings.participantVideo) { + settingValues.participant_video = settings.participantVideo as boolean; + } + + if (settings.hostVideo) { + settingValues.host_video = settings.hostVideo as boolean; + } + + if (settings.autoRecording) { + settingValues.auto_recording = settings.autoRecording as string; + } + + if (settings.registrationType) { + settingValues.registration_type = settings.registrationType as number; + } + + body.settings = settingValues; } - if (additionalFields.cnMeeting) { - settings.cn_meeting = additionalFields.cnMeeting as boolean; - + if (updateFields.topic) { + body.topic = updateFields.topic as string; } - if (additionalFields.inMeeting) { - settings.in_meeting = additionalFields.inMeeting as boolean; - + if (updateFields.type) { + body.type = updateFields.type as string; } - if (additionalFields.joinBeforeHost) { - settings.join_before_host = additionalFields.joinBeforeHost as boolean; - + if (updateFields.startTime) { + body.start_time = updateFields.startTime as string; } - if (additionalFields.muteUponEntry) { - settings.mute_upon_entry = additionalFields.muteUponEntry as boolean; - + if (updateFields.duration) { + body.duration = updateFields.duration as number; } - if (additionalFields.watermark) { - settings.watermark = additionalFields.watermark as boolean; - + if (updateFields.scheduleFor) { + body.schedule_for = updateFields.scheduleFor as string; } - if (additionalFields.audio) { - settings.audio = additionalFields.audio as string; - + if (updateFields.timeZone) { + body.timezone = updateFields.timeZone as string; } - if (additionalFields.alternativeHosts) { - settings.alternative_hosts = additionalFields.alternativeHosts as string; - + if (updateFields.password) { + body.password = updateFields.password as string; } - if (additionalFields.participantVideo) { - settings.participant_video = additionalFields.participantVideo as boolean; - - } - - if (additionalFields.hostVideo) { - settings.host_video = additionalFields.hostVideo as boolean; - - } - - if (additionalFields.autoRecording) { - settings.auto_recording = additionalFields.autoRecording as string; - - } - - if (additionalFields.registrationType) { - settings.registration_type = additionalFields.registrationType 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; - + if (updateFields.agenda) { + body.agenda = updateFields.agenda as string; } responseData = await zoomApiRequest.call( @@ -484,364 +449,365 @@ export class Zoom implements INodeType { body, qs ); - responseData = { updated: true }; - } - } - if (resource === 'meetingRegistrants') { - if (operation === 'create') { - //https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingregistrantcreate - const meetingId = this.getNodeParameter('meetingId', i) as string; - 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; - if (additionalFields.occurrenceId) { - qs.occurrence_ids = additionalFields.occurrenceId as string; - } - 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.jobTitle) { - body.job_title = additionalFields.jobTitle as string; - } - if (additionalFields.purchasingTimeFrame) { - body.purchasing_time_frame = additionalFields.purchasingTimeFrame as string; - } - if (additionalFields.roleInPurchaseProcess) { - body.role_in_purchase_process = additionalFields.roleInPurchaseProcess as string; - } - responseData = await zoomApiRequest.call( - this, - 'POST', - `/meetings/${meetingId}/registrants`, - body, - qs - ); - } - if (operation === 'getAll') { - //https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingregistrants - const meetingId = this.getNodeParameter('meetingId', i) as string; - const additionalFields = this.getNodeParameter( - 'additionalFields', - i - ) as IDataObject; - if (additionalFields.occurrenceId) { - qs.occurrence_id = additionalFields.occurrenceId as string; - } - 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 { - qs.page_size = this.getNodeParameter('limit', i) as number; - responseData = await zoomApiRequest.call(this, 'GET', `/meetings/${meetingId}/registrants`, {}, qs); - - } - - } - if (operation === 'update') { - //https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingregistrantstatus - const meetingId = this.getNodeParameter('meetingId', i) as string; - const additionalFields = this.getNodeParameter( - 'additionalFields', - i - ) as IDataObject; - if (additionalFields.occurenceId) { - qs.occurrence_id = additionalFields.occurrenceId as string; - } - if (additionalFields.action) { - body.action = additionalFields.action as string; - } - 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.alternativeHosts) { - settings.alternative_hosts = additionalFields.alternativeHosts as string; - - } - - if (additionalFields.panelistsVideo) { - settings.panelists_video = additionalFields.panelistsVideo as boolean; - - } - if (additionalFields.hostVideo) { - settings.host_video = additionalFields.hostVideo as boolean; - - } - if (additionalFields.practiceSession) { - settings.practice_session = additionalFields.practiceSession as boolean; - - } - if (additionalFields.autoRecording) { - settings.auto_recording = additionalFields.autoRecording as string; - - } - - if (additionalFields.registrationType) { - settings.registration_type = additionalFields.registrationType as number; - - } - if (additionalFields.approvalType) { - settings.approval_type = additionalFields.approvalType 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; - if (additionalFields.showPreviousOccurrences) { - qs.show_previous_occurrences = additionalFields.showPreviousOccurrences as boolean; - - } - - if (additionalFields.occurrenceId) { - qs.occurrence_id = additionalFields.occurrenceId as string; - - } - - 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 { - qs.page_size = this.getNodeParameter('limit', i) as number; - responseData = await zoomApiRequest.call(this, 'GET', `/users/${userId}/webinars`, {}, qs); - - } - } - 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; - - - if (additionalFields.occurrenceId) { - qs.occurrence_id = additionalFields.occurrenceId; - - } - - 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; - if (additionalFields.occurrenceId) { - qs.occurrence_id = additionalFields.occurrenceId as string; - } - const settings: Settings = {}; - if (additionalFields.audio) { - settings.audio = additionalFields.audio as string; - - } - if (additionalFields.alternativeHosts) { - settings.alternative_hosts = additionalFields.alternativeHosts as string; - - } - - if (additionalFields.panelistsVideo) { - settings.panelists_video = additionalFields.panelistsVideo as boolean; - - } - if (additionalFields.hostVideo) { - settings.host_video = additionalFields.hostVideo as boolean; - - } - if (additionalFields.practiceSession) { - settings.practice_session = additionalFields.practiceSession as boolean; - - } - if (additionalFields.autoRecording) { - settings.auto_recording = additionalFields.autoRecording as string; - - } - - if (additionalFields.registrationType) { - settings.registration_type = additionalFields.registrationType as number; - - } - if (additionalFields.approvalType) { - settings.approval_type = additionalFields.approvalType 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', - `webinars/${webinarId}`, - body, - qs - ); } } + // 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; + // 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; + // if (additionalFields.occurrenceId) { + // qs.occurrence_ids = additionalFields.occurrenceId as string; + // } + // 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.jobTitle) { + // body.job_title = additionalFields.jobTitle as string; + // } + // if (additionalFields.purchasingTimeFrame) { + // body.purchasing_time_frame = additionalFields.purchasingTimeFrame as string; + // } + // if (additionalFields.roleInPurchaseProcess) { + // body.role_in_purchase_process = additionalFields.roleInPurchaseProcess as string; + // } + // responseData = await zoomApiRequest.call( + // this, + // 'POST', + // `/meetings/${meetingId}/registrants`, + // body, + // qs + // ); + // } + // if (operation === 'getAll') { + // //https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingregistrants + // const meetingId = this.getNodeParameter('meetingId', i) as string; + // const additionalFields = this.getNodeParameter( + // 'additionalFields', + // i + // ) as IDataObject; + // if (additionalFields.occurrenceId) { + // qs.occurrence_id = additionalFields.occurrenceId as string; + // } + // 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 { + // qs.page_size = this.getNodeParameter('limit', i) as number; + // responseData = await zoomApiRequest.call(this, 'GET', `/meetings/${meetingId}/registrants`, {}, qs); + + // } + + // } + // if (operation === 'update') { + // //https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingregistrantstatus + // const meetingId = this.getNodeParameter('meetingId', i) as string; + // const additionalFields = this.getNodeParameter( + // 'additionalFields', + // i + // ) as IDataObject; + // if (additionalFields.occurenceId) { + // qs.occurrence_id = additionalFields.occurrenceId as string; + // } + // if (additionalFields.action) { + // body.action = additionalFields.action as string; + // } + // 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.alternativeHosts) { + // settings.alternative_hosts = additionalFields.alternativeHosts as string; + + // } + + // if (additionalFields.panelistsVideo) { + // settings.panelists_video = additionalFields.panelistsVideo as boolean; + + // } + // if (additionalFields.hostVideo) { + // settings.host_video = additionalFields.hostVideo as boolean; + + // } + // if (additionalFields.practiceSession) { + // settings.practice_session = additionalFields.practiceSession as boolean; + + // } + // if (additionalFields.autoRecording) { + // settings.auto_recording = additionalFields.autoRecording as string; + + // } + + // if (additionalFields.registrationType) { + // settings.registration_type = additionalFields.registrationType as number; + + // } + // if (additionalFields.approvalType) { + // settings.approval_type = additionalFields.approvalType 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; + // if (additionalFields.showPreviousOccurrences) { + // qs.show_previous_occurrences = additionalFields.showPreviousOccurrences as boolean; + + // } + + // if (additionalFields.occurrenceId) { + // qs.occurrence_id = additionalFields.occurrenceId as string; + + // } + + // 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 { + // qs.page_size = this.getNodeParameter('limit', i) as number; + // responseData = await zoomApiRequest.call(this, 'GET', `/users/${userId}/webinars`, {}, qs); + + // } + // } + // 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; + + + // if (additionalFields.occurrenceId) { + // qs.occurrence_id = additionalFields.occurrenceId; + + // } + + // 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; + // if (additionalFields.occurrenceId) { + // qs.occurrence_id = additionalFields.occurrenceId as string; + + // } + // const settings: Settings = {}; + // if (additionalFields.audio) { + // settings.audio = additionalFields.audio as string; + + // } + // if (additionalFields.alternativeHosts) { + // settings.alternative_hosts = additionalFields.alternativeHosts as string; + + // } + + // if (additionalFields.panelistsVideo) { + // settings.panelists_video = additionalFields.panelistsVideo as boolean; + + // } + // if (additionalFields.hostVideo) { + // settings.host_video = additionalFields.hostVideo as boolean; + + // } + // if (additionalFields.practiceSession) { + // settings.practice_session = additionalFields.practiceSession as boolean; + + // } + // if (additionalFields.autoRecording) { + // settings.auto_recording = additionalFields.autoRecording as string; + + // } + + // if (additionalFields.registrationType) { + // settings.registration_type = additionalFields.registrationType as number; + + // } + // if (additionalFields.approvalType) { + // settings.approval_type = additionalFields.approvalType 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', + // `webinars/${webinarId}`, + // body, + // qs + // ); + // } + // } } if (Array.isArray(responseData)) { returnData.push.apply(returnData, responseData as IDataObject[]); From 591630abd16c6a18e803071ca85650aaf800e9d2 Mon Sep 17 00:00:00 2001 From: ricardo Date: Fri, 26 Jun 2020 09:27:41 -0400 Subject: [PATCH 18/20] :bug: Fix timezone issue --- packages/nodes-base/nodes/Zoom/Zoom.node.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/nodes-base/nodes/Zoom/Zoom.node.ts b/packages/nodes-base/nodes/Zoom/Zoom.node.ts index 2395f8a318..7f735d33b8 100644 --- a/packages/nodes-base/nodes/Zoom/Zoom.node.ts +++ b/packages/nodes-base/nodes/Zoom/Zoom.node.ts @@ -319,7 +319,12 @@ export class Zoom implements INodeType { } if (additionalFields.startTime) { - body.start_time = additionalFields.startTime as string; + if (additionalFields.timeZone) { + body.start_time = moment(additionalFields.startTime as string).format('YYYY-MM-DDTHH:mm:ss'); + } else { + // if none timezone it's defined used n8n timezone + body.start_time = moment.tz(additionalFields.startTime as string, this.getTimezone()).format(); + } } if (additionalFields.duration) { @@ -342,6 +347,8 @@ export class Zoom implements INodeType { body.agenda = additionalFields.agenda as string; } + console.log(body); + responseData = await zoomApiRequest.call( this, 'POST', From 3660f535ac4ced653f7257c8c2f9f363f17ba064 Mon Sep 17 00:00:00 2001 From: ricardo Date: Fri, 26 Jun 2020 17:48:07 -0400 Subject: [PATCH 19/20] :zap: Add .svg to gulpfile --- packages/nodes-base/gulpfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nodes-base/gulpfile.js b/packages/nodes-base/gulpfile.js index 9771a4017c..58ba6ec51a 100644 --- a/packages/nodes-base/gulpfile.js +++ b/packages/nodes-base/gulpfile.js @@ -1,7 +1,7 @@ const { src, dest } = require('gulp'); function copyIcons() { - return src('nodes/**/*.png') + return src('nodes/**/*.{png,svg}') .pipe(dest('dist/nodes')); } From af4333f268bf3de5422bcdac4ec3e41dc25ac983 Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Mon, 6 Jul 2020 15:05:05 +0200 Subject: [PATCH 20/20] :zap: Some minior improvements on Zoom-Node --- .../credentials/ZoomApi.credentials.ts | 2 +- .../nodes/Zoom/MeetingDescription.ts | 155 ++++++++++-------- packages/nodes-base/nodes/Zoom/Zoom.node.ts | 11 +- 3 files changed, 86 insertions(+), 82 deletions(-) diff --git a/packages/nodes-base/credentials/ZoomApi.credentials.ts b/packages/nodes-base/credentials/ZoomApi.credentials.ts index 3db4aadbe0..dbef996429 100644 --- a/packages/nodes-base/credentials/ZoomApi.credentials.ts +++ b/packages/nodes-base/credentials/ZoomApi.credentials.ts @@ -5,7 +5,7 @@ export class ZoomApi implements ICredentialType { displayName = 'Zoom API'; properties = [ { - displayName: 'Access Token', + displayName: 'JTW Token', name: 'accessToken', type: 'string' as NodePropertyTypes, default: '' diff --git a/packages/nodes-base/nodes/Zoom/MeetingDescription.ts b/packages/nodes-base/nodes/Zoom/MeetingDescription.ts index 130830b9fe..f412235396 100644 --- a/packages/nodes-base/nodes/Zoom/MeetingDescription.ts +++ b/packages/nodes-base/nodes/Zoom/MeetingDescription.ts @@ -50,6 +50,27 @@ export const meetingFields = [ /* -------------------------------------------------------------------------- */ /* meeting:create */ /* -------------------------------------------------------------------------- */ + { + displayName: 'Topic', + name: 'topic', + type: 'string', + typeOptions: { + alwaysOpenEditWindow: true, + }, + default: '', + displayOptions: { + show: { + operation: [ + 'create', + + ], + resource: [ + 'meeting', + ], + }, + }, + description: `Topic of the meeting.`, + }, { displayName: 'Additional Fields', name: 'additionalFields', @@ -88,42 +109,6 @@ export const meetingFields = [ default: 0, description: 'Meeting duration (minutes).', }, - { - displayName: 'Meeting Topic', - name: 'topic', - type: 'string', - typeOptions: { - alwaysOpenEditWindow: true, - }, - default: '', - description: `Meeting topic.`, - }, - { - displayName: 'Meeting Type', - name: 'type', - type: 'options', - options: [ - { - name: 'Instant Meeting', - value: 1, - }, - { - name: 'Scheduled Meeting', - value: 2, - }, - { - name: 'Recurring Meeting with no fixed time', - value: 3, - }, - { - name: 'Recurring Meeting with fixed time', - value: 8, - }, - - ], - default: 2, - description: 'Meeting type.', - }, { displayName: 'Password', name: 'password', @@ -284,13 +269,39 @@ export const meetingFields = [ default: '', description: `Time zone used in the response. The default is the time zone of the calendar.`, }, + { + displayName: 'Type', + name: 'type', + type: 'options', + options: [ + { + name: 'Instant Meeting', + value: 1, + }, + { + name: 'Scheduled Meeting', + value: 2, + }, + { + name: 'Recurring Meeting with no fixed time', + value: 3, + }, + { + name: 'Recurring Meeting with fixed time', + value: 8, + }, + + ], + default: 2, + description: 'Meeting type.', + }, ], }, /* -------------------------------------------------------------------------- */ /* meeting:get */ /* -------------------------------------------------------------------------- */ { - displayName: 'Meeting ID', + displayName: 'ID', name: 'meetingId', type: 'string', default: '', @@ -433,7 +444,7 @@ export const meetingFields = [ /* meeting:delete */ /* -------------------------------------------------------------------------- */ { - displayName: 'Meeting ID', + displayName: 'ID', name: 'meetingId', type: 'string', default: '', @@ -488,7 +499,7 @@ export const meetingFields = [ /* meeting:update */ /* -------------------------------------------------------------------------- */ { - displayName: 'Meeting ID', + displayName: 'ID', name: 'meetingId', type: 'string', default: '', @@ -542,39 +553,6 @@ export const meetingFields = [ default: 0, description: 'Meeting duration (minutes).', }, - { - displayName: 'Meeting Topic', - name: 'topic', - type: 'string', - default: '', - description: `Meeting topic.`, - }, - { - displayName: 'Meeting Type', - name: 'type', - type: 'options', - options: [ - { - name: 'Instant Meeting', - value: 1, - }, - { - name: 'Scheduled Meeting', - value: 2, - }, - { - name: 'Recurring Meeting with no fixed time', - value: 3, - }, - { - name: 'Recurring Meeting with fixed time', - value: 8, - }, - - ], - default: 2, - description: 'Meeting type.', - }, { displayName: 'Password', name: 'password', @@ -735,6 +713,39 @@ export const meetingFields = [ default: '', description: `Time zone used in the response. The default is the time zone of the calendar.`, }, + { + displayName: 'Topic', + name: 'topic', + type: 'string', + default: '', + description: `Meeting topic.`, + }, + { + displayName: 'Type', + name: 'type', + type: 'options', + options: [ + { + name: 'Instant Meeting', + value: 1, + }, + { + name: 'Scheduled Meeting', + value: 2, + }, + { + name: 'Recurring Meeting with no fixed time', + value: 3, + }, + { + name: 'Recurring Meeting with fixed time', + value: 8, + }, + + ], + default: 2, + description: 'Meeting type.', + }, ], }, ] as INodeProperties[]; diff --git a/packages/nodes-base/nodes/Zoom/Zoom.node.ts b/packages/nodes-base/nodes/Zoom/Zoom.node.ts index 7f735d33b8..f7ecff0de8 100644 --- a/packages/nodes-base/nodes/Zoom/Zoom.node.ts +++ b/packages/nodes-base/nodes/Zoom/Zoom.node.ts @@ -252,10 +252,7 @@ export class Zoom implements INodeType { } if (operation === 'create') { //https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingcreate - const additionalFields = this.getNodeParameter( - 'additionalFields', - i - ) as IDataObject; + const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; const body: IDataObject = {}; @@ -310,9 +307,7 @@ export class Zoom implements INodeType { body.settings = settingValues; } - if (additionalFields.topic) { - body.topic = additionalFields.topic as string; - } + body.topic = this.getNodeParameter('topic', i) as string; if (additionalFields.type) { body.type = additionalFields.type as string; @@ -347,8 +342,6 @@ export class Zoom implements INodeType { body.agenda = additionalFields.agenda as string; } - console.log(body); - responseData = await zoomApiRequest.call( this, 'POST',