From cd46fcffcc2c3d96544dca73171a9fd2b532dbad Mon Sep 17 00:00:00 2001 From: Guillaume Faas <59444272+Tr00d@users.noreply.github.com> Date: Wed, 15 Nov 2023 16:49:16 +0100 Subject: [PATCH] fix: align meetings snippets with expected snippets (#138) --- meetings/allow-participant-recording.js | 23 ------------------- meetings/apply-language-all-participants.js | 23 ------------------- ...ding-options.js => create-instant-room.js} | 4 +--- ...with-theme.js => create-long-term-room.js} | 7 ++---- meetings/individual-language-selection.js | 23 ------------------- ...-expiration.js => list-dial-in-numbers.js} | 6 ++--- meetings/list-recordings.js | 1 - meetings/list-rooms.js | 1 - ...date-room-with-theme.js => list-themes.js} | 9 ++++---- ...move-theme-from-room.js => update-room.js} | 3 ++- 10 files changed, 11 insertions(+), 89 deletions(-) delete mode 100644 meetings/allow-participant-recording.js delete mode 100644 meetings/apply-language-all-participants.js rename meetings/{pre-configured-recording-options.js => create-instant-room.js} (93%) rename meetings/{create-room-with-theme.js => create-long-term-room.js} (85%) delete mode 100644 meetings/individual-language-selection.js rename meetings/{update-room-with-expiration.js => list-dial-in-numbers.js} (75%) rename meetings/{update-room-with-theme.js => list-themes.js} (73%) rename meetings/{remove-theme-from-room.js => update-room.js} (87%) diff --git a/meetings/allow-participant-recording.js b/meetings/allow-participant-recording.js deleted file mode 100644 index 67df89f..0000000 --- a/meetings/allow-participant-recording.js +++ /dev/null @@ -1,23 +0,0 @@ -require('dotenv').config({ path: __dirname + '/../../.env' }); - -const VONAGE_APPLICATION_ID = process.env.VONAGE_APPLICATION_ID; -const VONAGE_APPLICATION_PRIVATE_KEY_PATH = __dirname + "/../../" + process.env.VONAGE_APPLICATION_PRIVATE_KEY_PATH; -const ROOM_DISPLAY_NAME = process.env.ROOM_DISPLAY_NAME; - -const { Auth } = require('@vonage/auth'); -const { Meetings, MeetingType } = require('@vonage/meetings'); - -const credentials = new Auth({ - privateKey: VONAGE_APPLICATION_PRIVATE_KEY_PATH, - applicationId: VONAGE_APPLICATION_ID, -}); -const options = {}; - -const meetingsClient = new Meetings(credentials, options); -await meetingsClient.createRoom({ - type: MeetingType.INSTANT, - displayName: ROOM_DISPLAY_NAME, - availableFeatures: { - isRecordingAvailable: true, - }, -}); diff --git a/meetings/apply-language-all-participants.js b/meetings/apply-language-all-participants.js deleted file mode 100644 index d09dccc..0000000 --- a/meetings/apply-language-all-participants.js +++ /dev/null @@ -1,23 +0,0 @@ -require('dotenv').config({ path: __dirname + '/../../.env' }); - -const VONAGE_APPLICATION_ID = process.env.VONAGE_APPLICATION_ID; -const VONAGE_APPLICATION_PRIVATE_KEY_PATH = __dirname + "/../../" + process.env.VONAGE_APPLICATION_PRIVATE_KEY_PATH; -const ROOM_DISPLAY_NAME = process.env.ROOM_DISPLAY_NAME; - -const { Auth } = require('@vonage/auth'); -const { Meetings, MeetingType, RoomLanguage } = require('@vonage/meetings'); - -const credentials = new Auth({ - privateKey: VONAGE_APPLICATION_PRIVATE_KEY_PATH, - applicationId: VONAGE_APPLICATION_ID, -}); -const options = {}; - -const meetingsClient = new Meetings(credentials, options); -await meetingsClient.createRoom({ - type: MeetingType.INSTANT, - displayName: ROOM_DISPLAY_NAME, - uiSettings: { - language: RoomLanguage.ES, - }, -}); diff --git a/meetings/pre-configured-recording-options.js b/meetings/create-instant-room.js similarity index 93% rename from meetings/pre-configured-recording-options.js rename to meetings/create-instant-room.js index 9ae2b0a..f0e669d 100644 --- a/meetings/pre-configured-recording-options.js +++ b/meetings/create-instant-room.js @@ -3,6 +3,7 @@ require('dotenv').config({ path: __dirname + '/../../.env' }); const VONAGE_APPLICATION_ID = process.env.VONAGE_APPLICATION_ID; const VONAGE_APPLICATION_PRIVATE_KEY_PATH = __dirname + "/../../" + process.env.VONAGE_APPLICATION_PRIVATE_KEY_PATH; const ROOM_DISPLAY_NAME = process.env.ROOM_DISPLAY_NAME; +const THEME_ID = process.env.THEME_ID; const { Auth } = require('@vonage/auth'); const { Meetings, MeetingType } = require('@vonage/meetings'); @@ -17,7 +18,4 @@ const meetingsClient = new Meetings(credentials, options); await meetingsClient.createRoom({ type: MeetingType.INSTANT, displayName: ROOM_DISPLAY_NAME, - recordingOptions: { - autoRecord: true, - }, }); diff --git a/meetings/create-room-with-theme.js b/meetings/create-long-term-room.js similarity index 85% rename from meetings/create-room-with-theme.js rename to meetings/create-long-term-room.js index 87f700f..5278444 100644 --- a/meetings/create-room-with-theme.js +++ b/meetings/create-long-term-room.js @@ -3,7 +3,7 @@ require('dotenv').config({ path: __dirname + '/../../.env' }); const VONAGE_APPLICATION_ID = process.env.VONAGE_APPLICATION_ID; const VONAGE_APPLICATION_PRIVATE_KEY_PATH = __dirname + "/../../" + process.env.VONAGE_APPLICATION_PRIVATE_KEY_PATH; const ROOM_DISPLAY_NAME = process.env.ROOM_DISPLAY_NAME; -const THEME_ID = process.env.THEME_ID; +const ROOM_EXPIRATION_DATE = process.env.ROOM_EXPIRATION_DATE; const { Auth } = require('@vonage/auth'); const { Meetings, MeetingType } = require('@vonage/meetings'); @@ -18,8 +18,5 @@ const meetingsClient = new Meetings(credentials, options); await meetingsClient.createRoom({ type: MeetingType.LONG_TERM, displayName: ROOM_DISPLAY_NAME, - availableFeatures: { - isRecordingAvailable: true, - }, - themeId: THEME_ID, + expiresAt: ROOM_EXPIRATION_DATE, }); diff --git a/meetings/individual-language-selection.js b/meetings/individual-language-selection.js deleted file mode 100644 index c94c385..0000000 --- a/meetings/individual-language-selection.js +++ /dev/null @@ -1,23 +0,0 @@ -require('dotenv').config({ path: __dirname + '/../../.env' }); - -const VONAGE_APPLICATION_ID = process.env.VONAGE_APPLICATION_ID; -const VONAGE_APPLICATION_PRIVATE_KEY_PATH = __dirname + "/../../" + process.env.VONAGE_APPLICATION_PRIVATE_KEY_PATH; -const ROOM_DISPLAY_NAME = process.env.ROOM_DISPLAY_NAME; - -const { Auth } = require('@vonage/auth'); -const { Meetings, MeetingType } = require('@vonage/meetings'); - -const credentials = new Auth({ - privateKey: VONAGE_APPLICATION_PRIVATE_KEY_PATH, - applicationId: VONAGE_APPLICATION_ID, -}); -const options = {}; - -const meetingsClient = new Meetings(credentials, options); -await meetingsClient.createRoom({ - type: MeetingType.INSTANT, - displayName: ROOM_DISPLAY_NAME, - availableFeatures: { - isLocaleSwitcherAvailable: true, - }, -}); diff --git a/meetings/update-room-with-expiration.js b/meetings/list-dial-in-numbers.js similarity index 75% rename from meetings/update-room-with-expiration.js rename to meetings/list-dial-in-numbers.js index 38b951f..ea838e9 100644 --- a/meetings/update-room-with-expiration.js +++ b/meetings/list-dial-in-numbers.js @@ -2,7 +2,7 @@ require('dotenv').config({ path: __dirname + '/../../.env' }); const VONAGE_APPLICATION_ID = process.env.VONAGE_APPLICATION_ID; const VONAGE_APPLICATION_PRIVATE_KEY_PATH = __dirname + "/../../" + process.env.VONAGE_APPLICATION_PRIVATE_KEY_PATH; -const ROOM_ID = process.env.ROOM_ID; +const SESSION_ID = process.env.SESSION_ID; const { Auth } = require('@vonage/auth'); const { Meetings } = require('@vonage/meetings'); @@ -14,6 +14,4 @@ const credentials = new Auth({ const options = {}; const meetingsClient = new Meetings(credentials, options); -const room = await meetingsClient.getRoom(ROOM_ID); -room.expiresAt = '1997-08-29T20:14:00Z'; -await meetingsClient.updateRoom(ROOM_ID, room); +const numbers = await meetingsClient.getDialInNumbers(SESSION_ID); diff --git a/meetings/list-recordings.js b/meetings/list-recordings.js index 7112b6a..e04c3f5 100644 --- a/meetings/list-recordings.js +++ b/meetings/list-recordings.js @@ -14,7 +14,6 @@ const credentials = new Auth({ const options = {}; const meetingsClient = new Meetings(credentials, options); - const recordings = await meetingsClient.getSessionRecordings(SESSION_ID); const recording = await recordings.next(); console.log(recording); diff --git a/meetings/list-rooms.js b/meetings/list-rooms.js index 0596167..de36d41 100644 --- a/meetings/list-rooms.js +++ b/meetings/list-rooms.js @@ -15,5 +15,4 @@ const options = {}; const meetingsClient = new Meetings(credentials, options); for await (const room of meetingsClient.getRooms()) { console.log(room); - }; diff --git a/meetings/update-room-with-theme.js b/meetings/list-themes.js similarity index 73% rename from meetings/update-room-with-theme.js rename to meetings/list-themes.js index b44fae1..a8c3b34 100644 --- a/meetings/update-room-with-theme.js +++ b/meetings/list-themes.js @@ -2,8 +2,6 @@ require('dotenv').config({ path: __dirname + '/../../.env' }); const VONAGE_APPLICATION_ID = process.env.VONAGE_APPLICATION_ID; const VONAGE_APPLICATION_PRIVATE_KEY_PATH = __dirname + "/../../" + process.env.VONAGE_APPLICATION_PRIVATE_KEY_PATH; -const ROOM_ID = process.env.ROOM_ID; -const THEME_ID = process.env.THEME_ID; const { Auth } = require('@vonage/auth'); const { Meetings } = require('@vonage/meetings'); @@ -15,6 +13,7 @@ const credentials = new Auth({ const options = {}; const meetingsClient = new Meetings(credentials, options); -const room = await meetingsClient.getRoom(ROOM_ID); -room.themeId = THEME_ID; -await meetingsClient.updateRoom(ROOM_ID, room); +for await (const theme of meetingsClient.getThemes()) { + console.log(theme); + +}; diff --git a/meetings/remove-theme-from-room.js b/meetings/update-room.js similarity index 87% rename from meetings/remove-theme-from-room.js rename to meetings/update-room.js index c4a3547..7436c55 100644 --- a/meetings/remove-theme-from-room.js +++ b/meetings/update-room.js @@ -3,6 +3,7 @@ require('dotenv').config({ path: __dirname + '/../../.env' }); const VONAGE_APPLICATION_ID = process.env.VONAGE_APPLICATION_ID; const VONAGE_APPLICATION_PRIVATE_KEY_PATH = __dirname + "/../../" + process.env.VONAGE_APPLICATION_PRIVATE_KEY_PATH; const ROOM_ID = process.env.ROOM_ID; +const ROOM_EXPIRATION_DATE = process.env.ROOM_EXPIRATION_DATE; const { Auth } = require('@vonage/auth'); const { Meetings } = require('@vonage/meetings'); @@ -15,5 +16,5 @@ const options = {}; const meetingsClient = new Meetings(credentials, options); const room = await meetingsClient.getRoom(ROOM_ID); -room.themeId = null; +room.expiresAt = ROOM_EXPIRATION_DATE; await meetingsClient.updateRoom(ROOM_ID, room);