@@ -2,6 +2,7 @@ const _ = require('lodash')
2
2
const axios = require ( 'axios' )
3
3
const jwt = require ( 'jsonwebtoken' )
4
4
const config = require ( 'config' )
5
+ const moment = require ( 'moment' )
5
6
6
7
// get & parse all Zoom account credentials in an in-memory array
7
8
const ALL_ZOOM_ACCOUNTS = _ . split ( config . ZOOM_ACCOUNTS , ',' )
@@ -66,18 +67,16 @@ async function generateZoomJWTBearerAccessToken (apiKey) {
66
67
*
67
68
* @param {Date } startTime the start time of the meeting
68
69
* @param {Integer } duration the duration of the meeting
69
- * @param {String } timezone the timezone of the meeting
70
70
* @returns Zoom API response
71
71
*/
72
- async function createZoomMeeting ( startTime , duration , timezone ) {
72
+ async function createZoomMeeting ( startTime , duration ) {
73
73
const { accessToken, zoomAccountApiKey } = await generateZoomJWTBearerAccessToken ( )
74
74
75
75
// POST request details in Zoom API docs:
76
76
// https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingcreate
77
77
const res = await axios . post ( 'https://api.zoom.us/v2/users/me/meetings' , {
78
78
type : 2 ,
79
- start_time : startTime . toISOString ( ) ,
80
- timezone,
79
+ start_time : moment ( startTime ) . utc ( ) . format ( ) ,
81
80
duration
82
81
} , {
83
82
headers : {
@@ -96,12 +95,11 @@ async function createZoomMeeting (startTime, duration, timezone) {
96
95
*
97
96
* @param {Date } startTime the start time of the meeting
98
97
* @param {Integer } duration the duration of the meeting
99
- * @param {String } timezone the timezone of the meeting
100
98
* @returns The meeting urls for the Zoom meeting
101
99
*/
102
- async function generateZoomMeetingLink ( startTime , duration , timezone ) {
100
+ async function generateZoomMeetingLink ( startTime , duration ) {
103
101
try {
104
- const { meeting, zoomAccountApiKey } = await createZoomMeeting ( startTime , duration , timezone )
102
+ const { meeting, zoomAccountApiKey } = await createZoomMeeting ( startTime , duration )
105
103
106
104
// learn more: https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingcreate#responses
107
105
console . log ( meeting . start_url , 'Zoom meeting link for host' )
@@ -121,16 +119,14 @@ async function generateZoomMeetingLink (startTime, duration, timezone) {
121
119
* @param {Integer } duration the duration of the meeting
122
120
* @param {String } apiKey zoom account api key
123
121
* @param {Integer } zoomMeetingId zoom meeting id
124
- * @param {String } timezone the timezone of the meeting
125
122
* @returns {undefined }
126
123
*/
127
- async function updateZoomMeeting ( startTime , duration , zoomAccountApiKey , zoomMeetingId , timezone ) {
124
+ async function updateZoomMeeting ( startTime , duration , zoomAccountApiKey , zoomMeetingId ) {
128
125
const { accessToken } = await generateZoomJWTBearerAccessToken ( zoomAccountApiKey )
129
126
// PATCH request details in Zoom API docs:
130
127
// https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingupdate
131
128
await axios . patch ( `https://api.zoom.us/v2/meetings/${ zoomMeetingId } ` , {
132
- start_time : startTime . toISOString ( ) ,
133
- timezone,
129
+ start_time : moment ( startTime ) . utc ( ) . format ( ) ,
134
130
duration
135
131
} , {
136
132
headers : {
0 commit comments