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.
26 lines
749 B
26 lines
749 B
4 weeks ago
|
import { formatObjKey } from '../utils/formatObjKey';
|
||
|
|
||
|
/*
|
||
|
* getAsyncFetch
|
||
|
* @param {String} asyncFetch taskId
|
||
|
* @param {Object} options
|
||
|
*/
|
||
|
export async function getAsyncFetch(this: any, taskId, options: any = {}): Promise<object> {
|
||
|
options.subres = Object.assign({ asyncFetch: '' }, options.subres);
|
||
|
options.headers = options.headers || {};
|
||
|
|
||
|
const params = this._objectRequestParams('GET', '', options);
|
||
|
params.headers['x-oss-task-id'] = taskId;
|
||
|
params.successStatuses = [200];
|
||
|
params.xmlResponse = true;
|
||
|
|
||
|
const result = await this.request(params);
|
||
|
const taskInfo = formatObjKey(result.data.TaskInfo, 'firstLowerCase');
|
||
|
return {
|
||
|
res: result.res,
|
||
|
status: result.status,
|
||
|
state: result.data.State,
|
||
|
taskInfo
|
||
|
};
|
||
|
}
|