Repository URL to install this package:
|
Version:
0.0.11-rc1 ▾
|
var fetch = require('fetch-everywhere');
var responseHelpers = require('./helpers/fetch');
var buildUrl = require('./helpers/buildUrl');
/**
* Set the global toggle to enable or disable a connected Zoom account.
*
* `PUT` /api/v2.0/users/me
*
* @param {Boolean} zoomIntegrationEnabled - the value you want to toggle to
* @param {String} token - the user's access-token
* @param {String} baseUrl
* @returns {*} Promise
*/
function setGlobalZoom(zoomIntegrationEnabled, token, baseUrl) {
var fetchOptions;
var url;
if (typeof zoomIntegrationEnabled !== 'boolean') {
throw new TypeError('zoomIntegrationEnabled param must be a boolean, got ' + typeof token);
}
if (typeof token !== 'string') {
throw new TypeError('token param must be a string, got ' + typeof token);
}
if (typeof baseUrl !== 'string') {
throw new TypeError('baseUrl param must be a string, got ' + typeof baseUrl);
}
url = buildUrl(baseUrl, '/api/svc-zoom-integration/v1.0/me');
fetchOptions = {
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
'Access-Token': token,
},
method: 'PATCH',
mode: 'cors',
credentials: 'include',
body: JSON.stringify({
zoomIntegrationEnabled: zoomIntegrationEnabled,
}),
};
return fetch(url, fetchOptions)
.then(responseHelpers.responseHandler)
.catch(responseHelpers.errorHandler);
}
module.exports = setGlobalZoom;