Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@doodle/zoom-client / src / getUserZoomInfo.js
Size: Mime:
var fetch = require('fetch-everywhere');
var responseHelpers = require('./helpers/fetch');
var buildUrl = require('./helpers/buildUrl');

/**
 * Gets all the information we have about the zoom user.
 *
 * `GET` /me
 *
 * @param {Boolean} zoomIntegrationEnabled - the value you want to toggle to
 * @param {String} token - the user's access-token
 * @returns {*} Promise
 */
function getUserZoomInfo(token, baseUrl) {
  var fetchOptions;
  var url;

  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: 'GET',
    mode: 'cors',
    credentials: 'include',
  };

  return fetch(url, fetchOptions)
    .then(responseHelpers.responseHandler)
    .catch(responseHelpers.errorHandler);
}

module.exports = getUserZoomInfo;