'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var _regeneratorRuntime = require('@babel/runtime/regenerator');
var tslib_es6 = require('../tslib.es6-0d92ef81.js');
var axios = require('axios');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime);
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);

function refreshTencentDocToken(_ref) {
  var clientId = _ref.clientId,
    clientSecret = _ref.clientSecret,
    refreshToken = _ref.refreshToken;
  return tslib_es6.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
    var result;
    return _regeneratorRuntime__default["default"].wrap(function (_context) {
      while (1) switch (_context.prev = _context.next) {
        case 0:
          _context.next = 1;
          return axios__default["default"]({
            method: 'GET',
            url: 'https://docs.qq.com/oauth/v2/token',
            params: {
              client_id: clientId,
              client_secret: clientSecret,
              grant_type: 'refresh_token',
              refresh_token: refreshToken
            }
          });
        case 1:
          result = _context.sent;
          return _context.abrupt("return", result.data);
        case 2:
        case "end":
          return _context.stop();
      }
    }, _callee);
  }));
}

exports.refreshTencentDocToken = refreshTencentDocToken;
