-
Notifications
You must be signed in to change notification settings - Fork 8
Simultatneous Interpretation code added for create #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Joezanini
wants to merge
4
commits into
WebexSamples:main
Choose a base branch
from
Joezanini:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
/** | ||
* _ | ||
* __ _____| |__ _____ __ | ||
* \ \ /\ / / _ \ '_ \ / _ \ \/ / | ||
* \ V V / __/ |_) | __/> < @WebexDevs | ||
* \_/\_/ \___|_.__/ \___/_/\_\ | ||
* | ||
* CREATE a meeting in Webex with the REST API in Node | ||
* https://developer.webex.com/docs/api/v1/meetings/create-a-meeting | ||
* | ||
* Step 0: Have a (free) Webex account: https://cart.webex.com/sign-up | ||
* Step 1: Log in to https://developer.webex.com/login | ||
* Step 2: Find your bearer token at | ||
* https://developer.webex.com/docs/getting-started under "Your | ||
* Personal Access Token" in the middle of the page. | ||
* Step 3: Replace the string on the line that defines const myWebexDeveloperToken | ||
* and interpreterAry values for an interpreter object, | ||
* just below, with your personal bearer (access) token. Hit "save". | ||
* Step 4: Run this file with node from within | ||
* this directory on the command line: | ||
* | ||
* node ./create_si_meeting.js | ||
* | ||
* Step 5: Profit. Get your app listed in the Webex App Hub! | ||
* https://apphub.webex.com/ | ||
* | ||
*/ | ||
|
||
const https = require('https'); // https://nodejs.org/api/https.html | ||
|
||
const myWebexDeveloperToken = 'REPLACE ME WITH YOUR WEBEX DEVELOPER PERSONAL ACCESS TOKEN'; | ||
//REPLACE languageCode1/2 VARIABLES WITH REQUIRED LANGUAGES, BELOW IS EXAMPLE OF ENGLISH TO SPANSISH AND SPANISH TO ENGLISH | ||
interpreterAry = [ | ||
{"languageCode1":"en", "languageCode2":"es", "email":"REPLACE WITH INTERPRETER EMAIL", "displayName":"REPLACE WITH INTERPRETER DISPLAY NAME"}, | ||
{"languageCode1":"es", "languageCode2":"en", "email":"REPLACE WITH INTERPRETER EMAIL", "displayName":"REPLACE WITH INTERPRETER DISPLAY NAME"} | ||
]; | ||
|
||
const body = JSON.stringify({ | ||
title: 'WebDev Meeting w/ Simultaneous Interpretation', // String, Required | Meeting title. The title can be a maximum of 128 characters long. | ||
start: '2022-08-12T13:51:43-04:00', // String, Required | https://en.wikipedia.org/wiki/ISO_8601 format | ||
end: '2022-08-12T14:38:16-04:00', // String, Required | Replace the start/end with the times you'd like | ||
simultaneousInterpretation: {"enabled":true,"interpreters":interpreterAry} | ||
}); | ||
|
||
const options = { | ||
method: 'POST', // https://en.wikipedia.org/wiki/Representational_state_transfer#Semantics_of_HTTP_methods | ||
hostname: 'webexapis.com', // https://developer.webex.com/docs/basics | ||
path: '/v1/meetings', // https://developer.webex.com/docs/meetings | ||
port: 443, // https://en.wikipedia.org/wiki/HTTPS#Technical | ||
headers: { | ||
Authorization: `Bearer ${myWebexDeveloperToken}`, // https://oauth.net/2/bearer-tokens/ | ||
'Content-Type': 'application/json', // https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/JSON | ||
'Content-Length': body.length, // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Length | ||
}, | ||
}; | ||
|
||
const req = https.request(options, (res) => { | ||
console.log(`statusCode: ${res.statusCode}`); // https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html | ||
|
||
let data = ''; | ||
|
||
res.on('data', (chunk) => { | ||
data += chunk; | ||
}); | ||
|
||
res.on('end', () => { | ||
console.log(JSON.parse(data)); // https://nodejs.org/en/knowledge/javascript-conventions/what-is-json/ | ||
}); | ||
|
||
res.on('error', (e) => { | ||
console.error(`Error: ${e.message}`); // https://nodejs.org/api/errors.html#errormessage_1 | ||
}); | ||
}); | ||
|
||
req.on('error', (e) => { | ||
console.error(e); | ||
}); | ||
|
||
req.write(body); | ||
|
||
req.end(); | ||
|
||
/** | ||
* Expected output: | ||
* | ||
* The HTTPS request should receive a status code. We expect a 200. | ||
* | ||
* The body of the response is JSON text. We expect a single object | ||
* containing details of the newly-created meeting. These details | ||
* should include at least the following fields: | ||
* | ||
* - id | ||
* - meetingNumber | ||
* - title | ||
* - password | ||
* - phoneAndVideoSystemPassword | ||
* - meetingType | ||
* - state | ||
* - timezone | ||
* - start | ||
* - end | ||
* - hostUserId | ||
* - hostDisplayName | ||
* - hostEmail | ||
* - hostKey | ||
* - siteUrl | ||
* - webLink | ||
* - sipAddress | ||
* - dialInIpAddress | ||
* - enabledAutoRecordMeeting | ||
* - allowAnyUserToBeCoHost | ||
* - allowFirstUserToBeCoHost | ||
* - allowAuthenticatedDevices | ||
* - enabledJoinBeforeHost | ||
* - joinBeforeHostMinutes | ||
* - enableConnectAudioBeforeHost | ||
* - excludePassword | ||
* - publicMeeting | ||
* - enableAutomaticLock | ||
* - telephony | ||
* - accessCode | ||
* - callInNumbers | ||
* - links | ||
* | ||
* An example of the response JSON may be found | ||
* in this directory: ./example_response.json | ||
* | ||
*/ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
/** | ||
* _ | ||
* __ _____| |__ _____ __ | ||
* \ \ /\ / / _ \ '_ \ / _ \ \/ / | ||
* \ V V / __/ |_) | __/> < @WebexDevs | ||
* \_/\_/ \___|_.__/ \___/_/\_\ | ||
* | ||
* UPDATE a meeting in Webex with the REST API in Node | ||
* https://developer.webex.com/docs/api/v1/meetings/create-a-meeting | ||
* | ||
* Step 0: Have a (free) Webex account: https://cart.webex.com/sign-up | ||
* Step 1: Log in to https://developer.webex.com/login | ||
* Step 2: Find your bearer token at | ||
* https://developer.webex.com/docs/getting-started under "Your | ||
* Personal Access Token" in the middle of the page. | ||
* Step 3: Replace the string on the line that defines const myWebexDeveloperToken, | ||
* just below, with your personal bearer (access) token. Hit "save". | ||
* Step 4: Run an example from https://github.com/WebexSamples/rest-api-samples/tree/main/meetings/read | ||
* to obtain a meeting ID and password. Replace lines that define | ||
* const `meetingID` & `meetingPassword` with your meeting ID & password. | ||
* Step 5: Run this file with node from within | ||
* this directory on the command line: | ||
* | ||
* node ./update_si_meeting.js | ||
* | ||
* Step 6: Profit. Get your app listed in the Webex App Hub! | ||
* https://apphub.webex.com/ | ||
* | ||
*/ | ||
|
||
const https = require('https'); // https://nodejs.org/api/https.html | ||
|
||
const myWebexDeveloperToken = 'REPLACE WITH API KEY'; | ||
const meetingID = 'REPLACE WITH MEETING ID'; | ||
const meetingPassword = 'REPLACE WITH MEETING PASSWORD'; | ||
//REPLACE languageCode1/2 VARIABLES WITH REQUIRED LANGUAGES, BELOW IS EXAMPLE OF ENGLISH TO SPANSISH AND SPANISH TO ENGLISH | ||
interpreterAry = [ | ||
{"languageCode1":"en", "languageCode2":"es", "email":"REPLACE WITH INTERPRETER EMAIL", "displayName":"REPLACE WITH INTERPRETER DISPLAY NAME"}, | ||
{"languageCode1":"es", "languageCode2":"en", "email":"REPLACE WITH INTERPRETER EMAIL", "displayName":"REPLACE WITH INTERPRETER DISPLAY NAME"} | ||
]; | ||
|
||
const body = JSON.stringify({ | ||
title: 'WebDev Update a Meeting w/ Simultaneous Interpretation', // String, Required | Meeting title. The title can be a maximum of 128 characters long. | ||
agenda: 'This meeting\'s agenda includes discussing plans to incorporate new, extremely conductive copper alloys which create their own electro-magnetic fields. This meeting should be MARVELous! *wink*', // example of one of many options to update | ||
password: meetingPassword, // String, Required | ||
start: '2022-06-19T19:00:00Z', // String, Required | https://en.wikipedia.org/wiki/ISO_8601 format | ||
end: '2022-06-19T21:00:00Z', // String, Required | Replace the start/end with the times you'd like | ||
simultaneousInterpretation: {"enabled":true,"interpreters":interpreterAry} | ||
}); | ||
|
||
const options = { | ||
method: 'PUT', // https://en.wikipedia.org/wiki/Representational_state_transfer#Semantics_of_HTTP_methods | ||
hostname: 'webexapis.com', // https://developer.webex.com/docs/basics | ||
path: `/v1/meetings/${meetingID}`, // https://developer.webex.com/docs/meetings | ||
port: 443, // https://en.wikipedia.org/wiki/HTTPS#Technical | ||
headers: { | ||
Authorization: `Bearer ${myWebexDeveloperToken}`, // https://oauth.net/2/bearer-tokens/ | ||
'Content-Type': 'application/json', // https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/JSON | ||
'Content-Length': body.length, // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Length | ||
}, | ||
}; | ||
|
||
const req = https.request(options, (res) => { | ||
console.log(`statusCode: ${res.statusCode}`); // https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html | ||
|
||
let data = ''; | ||
|
||
res.on('data', (chunk) => { | ||
data += chunk; | ||
}); | ||
|
||
res.on('end', () => { | ||
console.log(JSON.parse(data)); // https://nodejs.org/en/knowledge/javascript-conventions/what-is-json/ | ||
}); | ||
|
||
res.on('error', (e) => { | ||
console.error(`Error: ${e.message}`); // https://nodejs.org/api/errors.html#errormessage_1 | ||
}); | ||
}); | ||
|
||
req.on('error', (e) => { | ||
console.error(e); | ||
}); | ||
|
||
req.write(body); | ||
|
||
req.end(); | ||
|
||
/** | ||
* Expected output: | ||
* | ||
* The HTTPS request should receive a status code. We expect a 200. | ||
* | ||
* The body of the response is JSON text. We expect a single object | ||
* containing details of the newly-created meeting. These details | ||
* should include at least the following fields: | ||
* | ||
* - id | ||
* - meetingNumber | ||
* - title | ||
* - password | ||
* - phoneAndVideoSystemPassword | ||
* - meetingType | ||
* - state | ||
* - timezone | ||
* - start | ||
* - end | ||
* - hostUserId | ||
* - hostDisplayName | ||
* - hostEmail | ||
* - hostKey | ||
* - siteUrl | ||
* - webLink | ||
* - sipAddress | ||
* - dialInIpAddress | ||
* - enabledAutoRecordMeeting | ||
* - allowAnyUserToBeCoHost | ||
* - allowFirstUserToBeCoHost | ||
* - allowAuthenticatedDevices | ||
* - enabledJoinBeforeHost | ||
* - joinBeforeHostMinutes | ||
* - enableConnectAudioBeforeHost | ||
* - excludePassword | ||
* - publicMeeting | ||
* - enableAutomaticLock | ||
* - telephony | ||
* - accessCode | ||
* - callInNumbers | ||
* - links | ||
* | ||
* An example of the response JSON may be found | ||
* in this directory: ./example_response.json | ||
* | ||
*/ | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there links to docs we can add to this? Listing of supported language codes?