UNPKG

azure-devops-node-api

Version:
1,059 lines (1,058 loc) 133 kB
"use strict"; /* * --------------------------------------------------------- * Copyright(C) Microsoft Corporation. All rights reserved. * --------------------------------------------------------- * * --------------------------------------------------------- * Generated file, DO NOT EDIT * --------------------------------------------------------- */ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.WorkItemTrackingApi = void 0; const basem = require("./ClientApiBases"); const WorkItemTrackingInterfaces = require("./interfaces/WorkItemTrackingInterfaces"); class WorkItemTrackingApi extends basem.ClientApiBase { constructor(baseUrl, handlers, options) { super(baseUrl, handlers, 'node-WorkItemTracking-api', options); } /** * INTERNAL ONLY: USED BY ACCOUNT MY WORK PAGE. This returns Doing, Done, Follows and activity work items details. * * @param {WorkItemTrackingInterfaces.QueryOption} queryOption */ getAccountMyWorkData(queryOption) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = {}; let queryValues = { '$queryOption': queryOption, }; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "def3d688-ddf5-4096-9024-69beea15cdbd", routeValues, queryValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.get(url, options); let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.AccountMyWorkResult, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Gets recent work item activities * */ getRecentActivityData() { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = {}; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "1bc988f4-c15f-4072-ad35-497c87e3a909", routeValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.get(url, options); let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.AccountRecentActivityWorkItemModel2, true); resolve(ret); } catch (err) { reject(err); } })); }); } /** * INTERNAL ONLY: USED BY ACCOUNT MY WORK PAGE. * */ getRecentMentions() { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = {}; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "d60eeb6e-e18c-4478-9e94-a0094e28f41c", routeValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.get(url, options); let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.AccountRecentMentionWorkItemModel, true); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Get the list of work item tracking outbound artifact link types. * */ getWorkArtifactLinkTypes() { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = {}; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "1a31de40-e318-41cd-a6c6-881077df52e3", routeValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.get(url, options); let ret = this.formatResponse(res.result, null, true); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Queries work items linked to a given list of artifact URI. * * @param {WorkItemTrackingInterfaces.ArtifactUriQuery} artifactUriQuery - Defines a list of artifact URI for querying work items. * @param {string} project - Project ID or project name */ queryWorkItemsForArtifactUris(artifactUriQuery, project) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project }; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "a9a9aa7a-8c09-44d3-ad1b-46e855c1e3d3", routeValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.create(url, artifactUriQuery, options); let ret = this.formatResponse(res.result, null, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Uploads an attachment. * * @param {NodeJS.ReadableStream} contentStream - Content to upload * @param {string} fileName - The name of the file * @param {string} uploadType - Attachment upload type: Simple or Chunked * @param {string} project - Project ID or project name * @param {string} areaPath - Target project Area Path */ createAttachment(customHeaders, contentStream, fileName, uploadType, project, areaPath) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project }; let queryValues = { fileName: fileName, uploadType: uploadType, areaPath: areaPath, }; customHeaders = customHeaders || {}; customHeaders["Content-Type"] = "application/octet-stream"; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "e07b5fa4-1499-494d-a496-64b860fd64ff", routeValues, queryValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); options.additionalHeaders = customHeaders; let res; res = yield this.rest.uploadStream("POST", url, contentStream, options); let ret = this.formatResponse(res.result, null, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Downloads an attachment. * * @param {string} id - Attachment ID * @param {string} fileName - Name of the file * @param {string} project - Project ID or project name * @param {boolean} download - If set to <c>true</c> always download attachment */ getAttachmentContent(id, fileName, project, download) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, id: id }; let queryValues = { fileName: fileName, download: download, }; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "e07b5fa4-1499-494d-a496-64b860fd64ff", routeValues, queryValues); let url = verData.requestUrl; let apiVersion = verData.apiVersion; let accept = this.createAcceptHeader("application/octet-stream", apiVersion); resolve((yield this.http.get(url, { "Accept": accept })).message); } catch (err) { reject(err); } })); }); } /** * Downloads an attachment. * * @param {string} id - Attachment ID * @param {string} fileName - Name of the file * @param {string} project - Project ID or project name * @param {boolean} download - If set to <c>true</c> always download attachment */ getAttachmentZip(id, fileName, project, download) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, id: id }; let queryValues = { fileName: fileName, download: download, }; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "e07b5fa4-1499-494d-a496-64b860fd64ff", routeValues, queryValues); let url = verData.requestUrl; let apiVersion = verData.apiVersion; let accept = this.createAcceptHeader("application/zip", apiVersion); resolve((yield this.http.get(url, { "Accept": accept })).message); } catch (err) { reject(err); } })); }); } /** * Gets root classification nodes or list of classification nodes for a given list of nodes ids, for a given project. In case ids parameter is supplied you will get list of classification nodes for those ids. Otherwise you will get root classification nodes for this project. * * @param {string} project - Project ID or project name * @param {number[]} ids - Comma separated integer classification nodes ids. It's not required, if you want root nodes. * @param {number} depth - Depth of children to fetch. * @param {WorkItemTrackingInterfaces.ClassificationNodesErrorPolicy} errorPolicy - Flag to handle errors in getting some nodes. Possible options are Fail and Omit. */ getClassificationNodes(project, ids, depth, errorPolicy) { return __awaiter(this, void 0, void 0, function* () { if (ids == null) { throw new TypeError('ids can not be null or undefined'); } return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project }; let queryValues = { ids: ids && ids.join(","), '$depth': depth, errorPolicy: errorPolicy, }; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "a70579d1-f53a-48ee-a5be-7be8659023b9", routeValues, queryValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.get(url, options); let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemClassificationNode, true); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Gets root classification nodes under the project. * * @param {string} project - Project ID or project name * @param {number} depth - Depth of children to fetch. */ getRootNodes(project, depth) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project }; let queryValues = { '$depth': depth, }; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "a70579d1-f53a-48ee-a5be-7be8659023b9", routeValues, queryValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.get(url, options); let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemClassificationNode, true); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Create new or update an existing classification node. * * @param {WorkItemTrackingInterfaces.WorkItemClassificationNode} postedNode - Node to create or update. * @param {string} project - Project ID or project name * @param {WorkItemTrackingInterfaces.TreeStructureGroup} structureGroup - Structure group of the classification node, area or iteration. * @param {string} path - Path of the classification node. */ createOrUpdateClassificationNode(postedNode, project, structureGroup, path) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, structureGroup: structureGroup, path: path }; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "5a172953-1b41-49d3-840a-33f79c3ce89f", routeValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.create(url, postedNode, options); let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemClassificationNode, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Delete an existing classification node. * * @param {string} project - Project ID or project name * @param {WorkItemTrackingInterfaces.TreeStructureGroup} structureGroup - Structure group of the classification node, area or iteration. * @param {string} path - Path of the classification node. * @param {number} reclassifyId - Id of the target classification node for reclassification. */ deleteClassificationNode(project, structureGroup, path, reclassifyId) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, structureGroup: structureGroup, path: path }; let queryValues = { '$reclassifyId': reclassifyId, }; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "5a172953-1b41-49d3-840a-33f79c3ce89f", routeValues, queryValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.del(url, options); let ret = this.formatResponse(res.result, null, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Gets the classification node for a given node path. * * @param {string} project - Project ID or project name * @param {WorkItemTrackingInterfaces.TreeStructureGroup} structureGroup - Structure group of the classification node, area or iteration. * @param {string} path - Path of the classification node. * @param {number} depth - Depth of children to fetch. */ getClassificationNode(project, structureGroup, path, depth) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, structureGroup: structureGroup, path: path }; let queryValues = { '$depth': depth, }; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "5a172953-1b41-49d3-840a-33f79c3ce89f", routeValues, queryValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.get(url, options); let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemClassificationNode, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Update an existing classification node. * * @param {WorkItemTrackingInterfaces.WorkItemClassificationNode} postedNode - Node to create or update. * @param {string} project - Project ID or project name * @param {WorkItemTrackingInterfaces.TreeStructureGroup} structureGroup - Structure group of the classification node, area or iteration. * @param {string} path - Path of the classification node. */ updateClassificationNode(postedNode, project, structureGroup, path) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, structureGroup: structureGroup, path: path }; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "5a172953-1b41-49d3-840a-33f79c3ce89f", routeValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.update(url, postedNode, options); let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemClassificationNode, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Get users who reacted on the comment. * * @param {string} project - Project ID or project name * @param {number} workItemId - WorkItem ID. * @param {number} commentId - Comment ID. * @param {WorkItemTrackingInterfaces.CommentReactionType} reactionType - Type of the reaction. * @param {number} top * @param {number} skip */ getEngagedUsers(project, workItemId, commentId, reactionType, top, skip) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, workItemId: workItemId, commentId: commentId, reactionType: reactionType }; let queryValues = { '$top': top, '$skip': skip, }; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "e33ca5e0-2349-4285-af3d-d72d86781c35", routeValues, queryValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.get(url, options); let ret = this.formatResponse(res.result, null, true); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Add a comment on a work item. * * @param {WorkItemTrackingInterfaces.CommentCreate} request - Comment create request. * @param {string} project - Project ID or project name * @param {number} workItemId - Id of a work item. */ addComment(request, project, workItemId) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, workItemId: workItemId }; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "608aac0a-32e1-4493-a863-b9cf4566d257", routeValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.create(url, request, options); let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.Comment, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Delete a comment on a work item. * * @param {string} project - Project ID or project name * @param {number} workItemId - Id of a work item. * @param {number} commentId */ deleteComment(project, workItemId, commentId) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, workItemId: workItemId, commentId: commentId }; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "608aac0a-32e1-4493-a863-b9cf4566d257", routeValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.del(url, options); let ret = this.formatResponse(res.result, null, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Returns a work item comment. * * @param {string} project - Project ID or project name * @param {number} workItemId - Id of a work item to get the comment. * @param {number} commentId - Id of the comment to return. * @param {boolean} includeDeleted - Specify if the deleted comment should be retrieved. * @param {WorkItemTrackingInterfaces.CommentExpandOptions} expand - Specifies the additional data retrieval options for work item comments. */ getComment(project, workItemId, commentId, includeDeleted, expand) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, workItemId: workItemId, commentId: commentId }; let queryValues = { includeDeleted: includeDeleted, '$expand': expand, }; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "608aac0a-32e1-4493-a863-b9cf4566d257", routeValues, queryValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.get(url, options); let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.Comment, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Returns a list of work item comments, pageable. * * @param {string} project - Project ID or project name * @param {number} workItemId - Id of a work item to get comments for. * @param {number} top - Max number of comments to return. * @param {string} continuationToken - Used to query for the next page of comments. * @param {boolean} includeDeleted - Specify if the deleted comments should be retrieved. * @param {WorkItemTrackingInterfaces.CommentExpandOptions} expand - Specifies the additional data retrieval options for work item comments. * @param {WorkItemTrackingInterfaces.CommentSortOrder} order - Order in which the comments should be returned. */ getComments(project, workItemId, top, continuationToken, includeDeleted, expand, order) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, workItemId: workItemId }; let queryValues = { '$top': top, continuationToken: continuationToken, includeDeleted: includeDeleted, '$expand': expand, order: order, }; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "608aac0a-32e1-4493-a863-b9cf4566d257", routeValues, queryValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.get(url, options); let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.CommentList, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Returns a list of work item comments by ids. * * @param {string} project - Project ID or project name * @param {number} workItemId - Id of a work item to get comments for. * @param {number[]} ids - Comma-separated list of comment ids to return. * @param {boolean} includeDeleted - Specify if the deleted comments should be retrieved. * @param {WorkItemTrackingInterfaces.CommentExpandOptions} expand - Specifies the additional data retrieval options for work item comments. */ getCommentsBatch(project, workItemId, ids, includeDeleted, expand) { return __awaiter(this, void 0, void 0, function* () { if (ids == null) { throw new TypeError('ids can not be null or undefined'); } return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, workItemId: workItemId }; let queryValues = { ids: ids && ids.join(","), includeDeleted: includeDeleted, '$expand': expand, }; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "608aac0a-32e1-4493-a863-b9cf4566d257", routeValues, queryValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.get(url, options); let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.CommentList, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Update a comment on a work item. * * @param {WorkItemTrackingInterfaces.CommentUpdate} request - Comment update request. * @param {string} project - Project ID or project name * @param {number} workItemId - Id of a work item. * @param {number} commentId */ updateComment(request, project, workItemId, commentId) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, workItemId: workItemId, commentId: commentId }; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "608aac0a-32e1-4493-a863-b9cf4566d257", routeValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.update(url, request, options); let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.Comment, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Adds a new reaction to a comment. * * @param {string} project - Project ID or project name * @param {number} workItemId - WorkItem ID * @param {number} commentId - Comment ID * @param {WorkItemTrackingInterfaces.CommentReactionType} reactionType - Type of the reaction */ createCommentReaction(project, workItemId, commentId, reactionType) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, workItemId: workItemId, commentId: commentId, reactionType: reactionType }; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "f6cb3f27-1028-4851-af96-887e570dc21f", routeValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.replace(url, null, options); let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.CommentReaction, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Deletes an existing reaction on a comment. * * @param {string} project - Project ID or project name * @param {number} workItemId - WorkItem ID * @param {number} commentId - Comment ID * @param {WorkItemTrackingInterfaces.CommentReactionType} reactionType - Type of the reaction */ deleteCommentReaction(project, workItemId, commentId, reactionType) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, workItemId: workItemId, commentId: commentId, reactionType: reactionType }; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "f6cb3f27-1028-4851-af96-887e570dc21f", routeValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.del(url, options); let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.CommentReaction, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Gets reactions of a comment. * * @param {string} project - Project ID or project name * @param {number} workItemId - WorkItem ID * @param {number} commentId - Comment ID */ getCommentReactions(project, workItemId, commentId) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, workItemId: workItemId, commentId: commentId }; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "f6cb3f27-1028-4851-af96-887e570dc21f", routeValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.get(url, options); let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.CommentReaction, true); resolve(ret); } catch (err) { reject(err); } })); }); } /** * @param {string} project - Project ID or project name * @param {number} workItemId * @param {number} commentId * @param {number} version */ getCommentVersion(project, workItemId, commentId, version) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, workItemId: workItemId, commentId: commentId, version: version }; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "49e03b34-3be0-42e3-8a5d-e8dfb88ac954", routeValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.get(url, options); let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.CommentVersion, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * @param {string} project - Project ID or project name * @param {number} workItemId * @param {number} commentId */ getCommentVersions(project, workItemId, commentId) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, workItemId: workItemId, commentId: commentId }; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "49e03b34-3be0-42e3-8a5d-e8dfb88ac954", routeValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.get(url, options); let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.CommentVersion, true); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Create a new field. * * @param {WorkItemTrackingInterfaces.WorkItemField} workItemField - New field definition * @param {string} project - Project ID or project name */ createField(workItemField, project) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project }; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "b51fd764-e5c2-4b9b-aaf7-3395cf4bdd94", routeValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.create(url, workItemField, options); let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemField, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Deletes the field. To undelete a filed, see "Update Field" API. * * @param {string} fieldNameOrRefName - Field simple name or reference name * @param {string} project - Project ID or project name */ deleteField(fieldNameOrRefName, project) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, fieldNameOrRefName: fieldNameOrRefName }; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "b51fd764-e5c2-4b9b-aaf7-3395cf4bdd94", routeValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.del(url, options); let ret = this.formatResponse(res.result, null, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Gets information on a specific field. * * @param {string} fieldNameOrRefName - Field simple name or reference name * @param {string} project - Project ID or project name */ getField(fieldNameOrRefName, project) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, fieldNameOrRefName: fieldNameOrRefName }; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "b51fd764-e5c2-4b9b-aaf7-3395cf4bdd94", routeValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.get(url, options); let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemField, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Returns information for all fields. The project ID/name parameter is optional. * * @param {string} project - Project ID or project name * @param {WorkItemTrackingInterfaces.GetFieldsExpand} expand - Use ExtensionFields to include extension fields, otherwise exclude them. Unless the feature flag for this parameter is enabled, extension fields are always included. */ getFields(project, expand) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project }; let queryValues = { '$expand': expand, }; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "b51fd764-e5c2-4b9b-aaf7-3395cf4bdd94", routeValues, queryValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.get(url, options); let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemField, true); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Update a field. * * @param {WorkItemTrackingInterfaces.UpdateWorkItemField} payload - Payload contains desired value of the field's properties * @param {string} fieldNameOrRefName - Name/reference name of the field to be updated * @param {string} project - Project ID or project name */ updateField(payload, fieldNameOrRefName, project) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, fieldNameOrRefName: fieldNameOrRefName }; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "b51fd764-e5c2-4b9b-aaf7-3395cf4bdd94", routeValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.update(url, payload, options); let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemField, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Migrates a project to a different process within the same OOB type. For example, you can only migrate a project from agile/custom-agile to agile/custom-agile. * * @param {WorkItemTrackingInterfaces.ProcessIdModel} newProcess * @param {string} project - Project ID or project name */ migrateProjectsProcess(newProcess, project) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project }; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "19801631-d4e5-47e9-8166-0330de0ff1e6", routeValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.create(url, newProcess, options); let ret = this.formatResponse(res.result, null, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Creates a query, or moves a query. * * @param {WorkItemTrackingInterfaces.QueryHierarchyItem} postedQuery - The query to create. * @param {string} project - Project ID or project name * @param {string} query - The parent id or path under which the query is to be created. * @param {boolean} validateWiqlOnly - If you only want to validate your WIQL query without actually creating one, set it to true. Default is false. */ createQuery(postedQuery, project, query, validateWiqlOnly) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, query: query }; let queryValues = { validateWiqlOnly: validateWiqlOnly, }; try { let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "a67d190c-c41f-424b-814d-0e906f659301", routeValues, queryValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.create(url, postedQuery, options); let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.QueryHierarchyItem, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Delete a query or a folder. This deletes any permission change on the deleted query or folder and any of its descendants if it is a folder. It is important to note that the deleted permission changes cannot be recovered upon undeleting the query or folder. * * @param {string} project - Project ID or project name * @param {string} query - ID or path of the query or folder to delete. */ deleteQuery(project, query) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, query: query