Repository URL to install this package:
|
Version:
0.0.6 ▾
|
var fetch = require('fetch-everywhere');
var responseHelpers = require('./helpers/fetch');
var buildUrl = require('./helpers/buildUrl');
/**
* Delete a Zoom Account from the Doodle user.
*
* @param {Number} accountId - The zoom account id
* @param {String} token - The user's access-token
* @param {String} baseUrl
* @returns {*} Promise
*/
function deleteAccount(accountId, token, baseUrl) {
var url;
var fetchOptions;
if (typeof accountId !== 'number') {
throw new TypeError('accountId param must be a number, got ' + typeof accountId);
}
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/accounts/' + accountId);
fetchOptions = {
method: 'DELETE',
mode: 'cors',
credentials: 'include',
headers: {
Accept: 'application/json',
'Access-Token': token,
},
};
return fetch(url, fetchOptions)
.catch(responseHelpers.errorHandler)
.then(responseHelpers.responseHandler);
}
module.exports = deleteAccount;