in api/TaskApi.ts [175:235]
public async createAttachmentFromArtifact(
scopeIdentifier: string,
hubName: string,
planId: string,
timelineId: string,
recordId: string,
type: string,
name: string,
artifactHash: string,
length: number
): Promise<TaskAgentInterfaces.TaskAttachment> {
if (artifactHash == null) {
throw new TypeError('artifactHash can not be null or undefined');
}
if (length == null) {
throw new TypeError('length can not be null or undefined');
}
return new Promise<TaskAgentInterfaces.TaskAttachment>(async (resolve, reject) => {
let routeValues: any = {
scopeIdentifier: scopeIdentifier,
hubName: hubName,
planId: planId,
timelineId: timelineId,
recordId: recordId,
type: type,
name: name
};
let queryValues: any = {
artifactHash: artifactHash,
length: length,
};
try {
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
"6.1-preview.1",
"distributedtask",
"7898f959-9cdf-4096-b29e-7f293031629e",
routeValues,
queryValues);
let url: string = verData.requestUrl!;
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
verData.apiVersion);
let res: restm.IRestResponse<TaskAgentInterfaces.TaskAttachment>;
res = await this.rest.replace<TaskAgentInterfaces.TaskAttachment>(url, null, options);
let ret = this.formatResponse(res.result,
TaskAgentInterfaces.TypeInfo.TaskAttachment,
false);
resolve(ret);
}
catch (err) {
reject(err);
}
});
}