'use strict';

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

var _regeneratorRuntime = require('@babel/runtime/regenerator');
var tslib_es6 = require('../../tslib.es6-0d92ef81.js');
var tencentCloud_base_base = require('../base/base.js');
var tencentCloud_cdn_config = require('./config.js');
require('axios');
require('../../nodejs/crypto.js');

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

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

function pushUrlCache(_ref) {
  var secretId = _ref.secretId,
    secretKey = _ref.secretKey,
    _ref$area = _ref.area,
    area = _ref$area === void 0 ? tencentCloud_cdn_config.AREA_MAP_WITH_GLOBAL.GLOBAL : _ref$area,
    urls = _ref.urls;
  return tslib_es6.__awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
    return _regeneratorRuntime__default["default"].wrap(function (_context) {
      while (1) switch (_context.prev = _context.next) {
        case 0:
          return _context.abrupt("return", tencentCloud_base_base.fetchCloudData({
            secretId: secretId,
            secretKey: secretKey,
            action: 'PushUrlsCache',
            version: '2018-06-06',
            endpoint: 'cdn.tencentcloudapi.com',
            service: 'cdn',
            region: '',
            payload: JSON.stringify({
              Urls: urls,
              Area: area
            })
          }));
        case 1:
        case "end":
          return _context.stop();
      }
    }, _callee);
  }));
}

exports.pushUrlCache = pushUrlCache;
