租房小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.5 KiB

3 months ago
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.postAsyncFetch = void 0;
  4. const obj2xml_1 = require("../utils/obj2xml");
  5. /*
  6. * postAsyncFetch
  7. * @param {String} name the object key
  8. * @param {String} url
  9. * @param {Object} options
  10. * {String} options.host
  11. * {String} options.contentMD5
  12. * {String} options.callback
  13. * {String} options.storageClass Standard/IA/Archive
  14. * {Boolean} options.ignoreSameKey default value true
  15. */
  16. async function postAsyncFetch(object, url, options = {}) {
  17. options.subres = Object.assign({ asyncFetch: '' }, options.subres);
  18. options.headers = options.headers || {};
  19. object = this._objectName(object);
  20. const { host = '', contentMD5 = '', callback = '', storageClass = '', ignoreSameKey = true } = options;
  21. const paramXMLObj = {
  22. AsyncFetchTaskConfiguration: {
  23. Url: url,
  24. Object: object,
  25. Host: host,
  26. ContentMD5: contentMD5,
  27. Callback: callback,
  28. StorageClass: storageClass,
  29. IgnoreSameKey: ignoreSameKey
  30. }
  31. };
  32. const params = this._objectRequestParams('POST', '', options);
  33. params.mime = 'xml';
  34. params.xmlResponse = true;
  35. params.successStatuses = [200];
  36. params.content = obj2xml_1.obj2xml(paramXMLObj);
  37. const result = await this.request(params);
  38. return {
  39. res: result.res,
  40. status: result.status,
  41. taskId: result.data.TaskId
  42. };
  43. }
  44. exports.postAsyncFetch = postAsyncFetch;