UNPKG

zaccl

Version:

The Zoom App Complete Connection Library, a project that handles everything required to build a zoom-integrated app.

351 lines (324 loc) 18.1 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>ECatCloudRecording.js - Documentation</title> <script src="scripts/prettify/prettify.js"></script> <script src="scripts/prettify/lang-css.js"></script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> <script src="scripts/nav.js" defer></script> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <input type="checkbox" id="nav-trigger" class="nav-trigger" /> <label for="nav-trigger" class="navicon-button x"> <div class="navicon"></div> </label> <label for="nav-trigger" class="overlay"></label> <nav style="border-right: 2px solid #ccc; padding-bottom: 25px;" > <h2><a style="font-size: 30px;" href="index.html">ZACCL API</a></h2><h3>Endpoint Functions</h3><ul><li><a href="api.cloudRecording.html">api.cloudRecording</a><ul class='methods'><li data-type='method'><a href="api.cloudRecording.html#listAccountRecordings">listAccountRecordings</a></li><li data-type='method'><a href="api.cloudRecording.html#listMeetingRecordings">listMeetingRecordings</a></li><li data-type='method'><a href="api.cloudRecording.html#listUserRecordings">listUserRecordings</a></li><li data-type='method'><a href="api.cloudRecording.html#recoverMeetingRecordings">recoverMeetingRecordings</a></li></ul></li><li><a href="api.group.html">api.group</a><ul class='methods'><li data-type='method'><a href="api.group.html#listGroupMembers">listGroupMembers</a></li></ul></li><li><a href="api.meeting.html">api.meeting</a><ul class='methods'><li data-type='method'><a href="api.meeting.html#addAltHost">addAltHost</a></li><li data-type='method'><a href="api.meeting.html#create">create</a></li><li data-type='method'><a href="api.meeting.html#delete">delete</a></li><li data-type='method'><a href="api.meeting.html#get">get</a></li><li data-type='method'><a href="api.meeting.html#getActivitiesReport">getActivitiesReport</a></li><li data-type='method'><a href="api.meeting.html#getParticipantReport">getParticipantReport</a></li><li data-type='method'><a href="api.meeting.html#getPastMeetingDetails">getPastMeetingDetails</a></li><li data-type='method'><a href="api.meeting.html#getPollInfo">getPollInfo</a></li><li data-type='method'><a href="api.meeting.html#getQAReport">getQAReport</a></li><li data-type='method'><a href="api.meeting.html#getTranscript">getTranscript</a></li><li data-type='method'><a href="api.meeting.html#listPastInstances">listPastInstances</a></li><li data-type='method'><a href="api.meeting.html#listPastMeetingParticipants">listPastMeetingParticipants</a></li><li data-type='method'><a href="api.meeting.html#listPastPollOccurrences">listPastPollOccurrences</a></li><li data-type='method'><a href="api.meeting.html#update">update</a></li></ul></li><li><a href="api.user.html">api.user</a><ul class='methods'><li data-type='method'><a href="api.user.html#activate">activate</a></li><li data-type='method'><a href="api.user.html#addWebinarLicense">addWebinarLicense</a></li><li data-type='method'><a href="api.user.html#get">get</a></li><li data-type='method'><a href="api.user.html#getZAKToken">getZAKToken</a></li><li data-type='method'><a href="api.user.html#promoteToLicensed">promoteToLicensed</a></li></ul></li><li><a href="api.webinar.html">api.webinar</a><ul class='methods'><li data-type='method'><a href="api.webinar.html#addPanelist">addPanelist</a></li><li data-type='method'><a href="api.webinar.html#create">create</a></li><li data-type='method'><a href="api.webinar.html#get">get</a></li><li data-type='method'><a href="api.webinar.html#getParticipantReport">getParticipantReport</a></li><li data-type='method'><a href="api.webinar.html#getPollReport">getPollReport</a></li><li data-type='method'><a href="api.webinar.html#getQAReport">getQAReport</a></li><li data-type='method'><a href="api.webinar.html#listPanelists">listPanelists</a></li></ul></li></ul> </nav> <div id="main"> <section> <article> <pre class="prettyprint source linenums"><code>"use strict"; /** * Category of endpoints for Zoom cloud recordings * @author Gabe Abrams * @author Aryan Pandey * @namespace api.cloudRecording */ var __awaiter = (this &amp;&amp; this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __importDefault = (this &amp;&amp; this.__importDefault) || function (mod) { return (mod &amp;&amp; mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); // Import shared interfaces const EndpointCategory_1 = __importDefault(require("../shared/interfaces/EndpointCategory")); // Import shared classes const ZACCLError_1 = __importDefault(require("../shared/classes/ZACCLError")); const ErrorCode_1 = __importDefault(require("../shared/types/ErrorCode")); // Import shared helper const utils_1 = require("../shared/helpers/utils"); class ECatCloudRecording extends EndpointCategory_1.default { /** * List recordings in the account (Medium) * @author Gabe Abrams * @instance * @memberof api.cloudRecording * @method listAccountRecordings * @param opts object containing all arguments * @param opts.fromYear the start of the date range to list recordings for (e.g. 2026) * @param opts.fromMonth the month of the date range to list recordings for (1-12) * @param [opts.fromDay] the day of the month of the date range to list recordings for (1-31, defaults to 1) * @param [opts.toYear] the end of the date range to list recordings for (e.g. 2026, defaults to 1 month later) * @param [opts.toMonth] the month of the end of the date range to list recordings for (1-12, defaults to 1 month later) * @param [opts.toDay] the day of the month of the end of the date range to list recordings for (1-31, defaults to 1 month later) * @param [opts.accountId] the account ID of the account of interest (defaults to the account * associated with the current access) * @param [opts.onNewPage] callback function that is called when a new page of results is received. * The function is passed the new page of results as an argument. * @param [opts.minMsBetweenPageRequests] minimum time (in ms) to wait between paginated requests, * for custom throttle control * @returns the list of recordings in the account */ listAccountRecordings(opts) { var _a, _b, _c; return __awaiter(this, void 0, void 0, function* () { // Generate from date const { fromYear, fromMonth, minMsBetweenPageRequests, } = opts; const fromMonthPadded = fromMonth &lt; 10 ? `0${fromMonth}` : fromMonth; const fromDay = (_a = opts.fromDay) !== null &amp;&amp; _a !== void 0 ? _a : 1; const fromDayPadded = fromDay &lt; 10 ? `0${fromDay}` : fromDay; const fromDateString = `${fromYear}-${fromMonthPadded}-${fromDayPadded}`; // Generate to date let toYear; let toMonth; let toDay; if (opts.toYear &amp;&amp; opts.toMonth) { toYear = opts.toYear; toMonth = opts.toMonth; toDay = (_b = opts.toDay) !== null &amp;&amp; _b !== void 0 ? _b : 1; } else { // Generate to date const fromDate = new Date(fromYear, fromMonth - 1, fromDay); fromDate.setMonth(fromDate.getMonth() + 1); toYear = fromDate.getFullYear(); toMonth = fromDate.getMonth() + 1; toDay = fromDate.getDate(); } const toMonthPadded = toMonth &lt; 10 ? `0${toMonth}` : toMonth; const toDayPadded = toDay &lt; 10 ? `0${toDay}` : toDay; const toDateString = `${toYear}-${toMonthPadded}-${toDayPadded}`; return this.visitEndpoint({ path: `/accounts/${(_c = opts.accountId) !== null &amp;&amp; _c !== void 0 ? _c : 'me'}/recordings`, action: 'list recordings in the account', method: 'GET', params: { page_size: 300, from: fromDateString, to: toDateString, }, onNewPage: opts.onNewPage, minMsBetweenPageRequests, itemKey: 'meetings', errorMap: { 400: 'Bad request', 404: 'No recordings found', }, }); }); } /** * Recover recordings for a meeting (Light) * @author Gabe Abrams * @instance * @memberof api.cloudRecording * @method recoverMeetingRecordings * @param opts object containing all arguments * @param opts.meetingId the Zoom meeting ID or UUID */ recoverMeetingRecordings(opts) { return __awaiter(this, void 0, void 0, function* () { // Check if required param is present if (!opts.meetingId) { throw new ZACCLError_1.default({ message: 'Meeting ID is a required parameter', code: ErrorCode_1.default.InvalidMeetingId, }); } return this.visitEndpoint({ path: `/meetings/${(0, utils_1.doubleEncode)(String(opts.meetingId))}/recordings/status`, method: 'PUT', params: { action: 'recover', }, action: 'recover recordings of a meeting', errorMap: { 400: { 1010: 'We could not find the user on this account', 3309: 'Not enough cloud storage available. Either purchase additional storage or delete cloud recordings to free up storage.', }, 404: { 1001: 'We could not find that user', 3301: `There are no recordings for the meeting ${opts.meetingId}`, }, }, }); }); } /** * Get all recordings of a meeting (Light) * @author Aryan Pandey * @instance * @memberof api.cloudRecording * @method listMeetingRecordings * @param opts object containing all arguments * @param opts.meetingId the Zoom meeting ID or UUID * @param opts.includeDownloadAccessToken if true, the response will include a download_access_token * that can be used to download the recording files * @param opts.attemptRecoverOnNotFound if true, when Zoom returns a "not found" error, * attempt to recover the recording and then fetch the recording info again * @returns list of Zoom meeting recording objects {@link https://marketplace.zoom.us/docs/api-reference/zoom-api/cloud-recording/recordingget#responses} */ listMeetingRecordings(opts) { return __awaiter(this, void 0, void 0, function* () { // Check if required param is present if (!opts.meetingId) { throw new ZACCLError_1.default({ message: 'Meeting ID is a required parameter', code: ErrorCode_1.default.InvalidMeetingId, }); } // Create params const params = {}; if (opts.includeDownloadAccessToken) { params.include_fields = 'download_access_token'; params.ttl = 604800; // Max TTL } // Create full visitEndpoint opts const path = `/meetings/${(0, utils_1.doubleEncode)(String(opts.meetingId))}/recordings`; const method = 'GET'; const action = 'get all recordings of a meeting'; const errorMap = { 400: { 1010: 'We could not find the user on this account', }, 404: { 1001: 'We could not find that user', 3301: `There are no recordings for the meeting ${opts.meetingId}`, }, }; try { const output = yield this.visitEndpoint({ path, method, action, errorMap, params, }); return output; } catch (err) { if ( // Attempt recovery opts.attemptRecoverOnNotFound // Recording not found &amp;&amp; (err || {}).code === 'ZOOM404-3301') { try { // Try recovering the recording yield this.recoverMeetingRecordings({ meetingId: opts.meetingId }); // Recovered! Try fetching again const output = yield this.visitEndpoint({ path, method, action, errorMap, params, }); return output; } catch (err2) { // Failed to recover throw new ZACCLError_1.default({ message: `The recording for meeting ${opts.meetingId} could not be found, and we were unable to recover it. Error: ${(err2 === null || err2 === void 0 ? void 0 : err2.message) || 'unknown recovery error'}`, code: ErrorCode_1.default.NotFoundAndUnrecoverable, }); } } // Not an error we handle. Rethrow it. throw err; } }); } /** * List all cloud recordings of a user (Medium) * @author Aryan Pandey * @instance * @memberof api.cloudRecording * @method listUserRecordings * @param opts object containing all arguments * @param opts.userId the user ID or email address of the user * @param [opts.searchTrash=false] set to true to retrieve * meeting recordings from the trash. * @param [opts.startDate=1 month before today] * string accepted by JS Date constructor or instance of Date object. * Date needs to be within past 6 months. Time data (hours and seconds) * is discarded * @param [opts.endDate] string accepted by JS Date * constructor or instance of Date object. * Date needs to be within past 6 months. Time data (hours and seconds) * is discarded * @param [opts.onNewPage] callback function that is called when a new page of results is received. * @param [opts.minMsBetweenPageRequests] minimum time (in ms) to wait between paginated requests, * for custom throttle control * @returns List of Zoom Recordings {@link https://marketplace.zoom.us/docs/api-reference/zoom-api/cloud-recording/recordingslist#responses} */ listUserRecordings(opts) { return __awaiter(this, void 0, void 0, function* () { // Destructure arguments const { userId, searchTrash, startDate, endDate, onNewPage, minMsBetweenPageRequests, } = opts; // Declare default start Date to 1 month before const defaultDate = new Date(); defaultDate.setMonth(defaultDate.getMonth() - 1); // Initialize params object with default values and only add // optional params if they are defined const params = { page_size: 300, trash: !!searchTrash, from: (0, utils_1.formatDate)(defaultDate, 'startDate'), }; if (startDate) { params.from = (0, utils_1.formatDate)(startDate, 'startDate'); } if (endDate) { params.to = (0, utils_1.formatDate)(endDate, 'endDate'); } return this.visitEndpoint({ path: `/users/${userId}/recordings`, action: 'list all cloud recordings of a user', method: 'GET', params, onNewPage: opts.onNewPage, minMsBetweenPageRequests, itemKey: 'meetings', errorMap: { 404: { 1001: `We could not find the Zoom user ${userId} on this account`, }, }, }); }); } ; } /*------------------------------------------------------------------------*/ /* Export */ /*------------------------------------------------------------------------*/ exports.default = ECatCloudRecording; //# sourceMappingURL=ECatCloudRecording.js.map</code></pre> </article> </section> </div> <br class="clear"> <footer> We use <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> and the <a href="https://github.com/clenemt/docdash">docdash</a> theme to generate our docs. </footer> <script>prettyPrint();</script> <script src="scripts/polyfill.js"></script> <script src="scripts/linenumber.js"></script> </body> </html>