UNPKG

133 kBJavaScriptView Raw
1"use strict";
2/*
3 * ---------------------------------------------------------
4 * Copyright(C) Microsoft Corporation. All rights reserved.
5 * ---------------------------------------------------------
6 *
7 * ---------------------------------------------------------
8 * Generated file, DO NOT EDIT
9 * ---------------------------------------------------------
10 */
11var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13 return new (P || (P = Promise))(function (resolve, reject) {
14 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17 step((generator = generator.apply(thisArg, _arguments || [])).next());
18 });
19};
20Object.defineProperty(exports, "__esModule", { value: true });
21exports.WorkItemTrackingApi = void 0;
22const basem = require("./ClientApiBases");
23const WorkItemTrackingInterfaces = require("./interfaces/WorkItemTrackingInterfaces");
24class WorkItemTrackingApi extends basem.ClientApiBase {
25 constructor(baseUrl, handlers, options) {
26 super(baseUrl, handlers, 'node-WorkItemTracking-api', options);
27 }
28 /**
29 * INTERNAL ONLY: USED BY ACCOUNT MY WORK PAGE. This returns Doing, Done, Follows and activity work items details.
30 *
31 * @param {WorkItemTrackingInterfaces.QueryOption} queryOption
32 */
33 getAccountMyWorkData(queryOption) {
34 return __awaiter(this, void 0, void 0, function* () {
35 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
36 let routeValues = {};
37 let queryValues = {
38 '$queryOption': queryOption,
39 };
40 try {
41 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "def3d688-ddf5-4096-9024-69beea15cdbd", routeValues, queryValues);
42 let url = verData.requestUrl;
43 let options = this.createRequestOptions('application/json', verData.apiVersion);
44 let res;
45 res = yield this.rest.get(url, options);
46 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.AccountMyWorkResult, false);
47 resolve(ret);
48 }
49 catch (err) {
50 reject(err);
51 }
52 }));
53 });
54 }
55 /**
56 * Gets recent work item activities
57 *
58 */
59 getRecentActivityData() {
60 return __awaiter(this, void 0, void 0, function* () {
61 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
62 let routeValues = {};
63 try {
64 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "1bc988f4-c15f-4072-ad35-497c87e3a909", routeValues);
65 let url = verData.requestUrl;
66 let options = this.createRequestOptions('application/json', verData.apiVersion);
67 let res;
68 res = yield this.rest.get(url, options);
69 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.AccountRecentActivityWorkItemModel2, true);
70 resolve(ret);
71 }
72 catch (err) {
73 reject(err);
74 }
75 }));
76 });
77 }
78 /**
79 * INTERNAL ONLY: USED BY ACCOUNT MY WORK PAGE.
80 *
81 */
82 getRecentMentions() {
83 return __awaiter(this, void 0, void 0, function* () {
84 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
85 let routeValues = {};
86 try {
87 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "d60eeb6e-e18c-4478-9e94-a0094e28f41c", routeValues);
88 let url = verData.requestUrl;
89 let options = this.createRequestOptions('application/json', verData.apiVersion);
90 let res;
91 res = yield this.rest.get(url, options);
92 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.AccountRecentMentionWorkItemModel, true);
93 resolve(ret);
94 }
95 catch (err) {
96 reject(err);
97 }
98 }));
99 });
100 }
101 /**
102 * Get the list of work item tracking outbound artifact link types.
103 *
104 */
105 getWorkArtifactLinkTypes() {
106 return __awaiter(this, void 0, void 0, function* () {
107 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
108 let routeValues = {};
109 try {
110 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "1a31de40-e318-41cd-a6c6-881077df52e3", routeValues);
111 let url = verData.requestUrl;
112 let options = this.createRequestOptions('application/json', verData.apiVersion);
113 let res;
114 res = yield this.rest.get(url, options);
115 let ret = this.formatResponse(res.result, null, true);
116 resolve(ret);
117 }
118 catch (err) {
119 reject(err);
120 }
121 }));
122 });
123 }
124 /**
125 * Queries work items linked to a given list of artifact URI.
126 *
127 * @param {WorkItemTrackingInterfaces.ArtifactUriQuery} artifactUriQuery - Defines a list of artifact URI for querying work items.
128 * @param {string} project - Project ID or project name
129 */
130 queryWorkItemsForArtifactUris(artifactUriQuery, project) {
131 return __awaiter(this, void 0, void 0, function* () {
132 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
133 let routeValues = {
134 project: project
135 };
136 try {
137 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "a9a9aa7a-8c09-44d3-ad1b-46e855c1e3d3", routeValues);
138 let url = verData.requestUrl;
139 let options = this.createRequestOptions('application/json', verData.apiVersion);
140 let res;
141 res = yield this.rest.create(url, artifactUriQuery, options);
142 let ret = this.formatResponse(res.result, null, false);
143 resolve(ret);
144 }
145 catch (err) {
146 reject(err);
147 }
148 }));
149 });
150 }
151 /**
152 * Uploads an attachment.
153 *
154 * @param {NodeJS.ReadableStream} contentStream - Content to upload
155 * @param {string} fileName - The name of the file
156 * @param {string} uploadType - Attachment upload type: Simple or Chunked
157 * @param {string} project - Project ID or project name
158 * @param {string} areaPath - Target project Area Path
159 */
160 createAttachment(customHeaders, contentStream, fileName, uploadType, project, areaPath) {
161 return __awaiter(this, void 0, void 0, function* () {
162 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
163 let routeValues = {
164 project: project
165 };
166 let queryValues = {
167 fileName: fileName,
168 uploadType: uploadType,
169 areaPath: areaPath,
170 };
171 customHeaders = customHeaders || {};
172 customHeaders["Content-Type"] = "application/octet-stream";
173 try {
174 let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "e07b5fa4-1499-494d-a496-64b860fd64ff", routeValues, queryValues);
175 let url = verData.requestUrl;
176 let options = this.createRequestOptions('application/json', verData.apiVersion);
177 options.additionalHeaders = customHeaders;
178 let res;
179 res = yield this.rest.uploadStream("POST", url, contentStream, options);
180 let ret = this.formatResponse(res.result, null, false);
181 resolve(ret);
182 }
183 catch (err) {
184 reject(err);
185 }
186 }));
187 });
188 }
189 /**
190 * Downloads an attachment.
191 *
192 * @param {string} id - Attachment ID
193 * @param {string} fileName - Name of the file
194 * @param {string} project - Project ID or project name
195 * @param {boolean} download - If set to <c>true</c> always download attachment
196 */
197 getAttachmentContent(id, fileName, project, download) {
198 return __awaiter(this, void 0, void 0, function* () {
199 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
200 let routeValues = {
201 project: project,
202 id: id
203 };
204 let queryValues = {
205 fileName: fileName,
206 download: download,
207 };
208 try {
209 let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "e07b5fa4-1499-494d-a496-64b860fd64ff", routeValues, queryValues);
210 let url = verData.requestUrl;
211 let apiVersion = verData.apiVersion;
212 let accept = this.createAcceptHeader("application/octet-stream", apiVersion);
213 resolve((yield this.http.get(url, { "Accept": accept })).message);
214 }
215 catch (err) {
216 reject(err);
217 }
218 }));
219 });
220 }
221 /**
222 * Downloads an attachment.
223 *
224 * @param {string} id - Attachment ID
225 * @param {string} fileName - Name of the file
226 * @param {string} project - Project ID or project name
227 * @param {boolean} download - If set to <c>true</c> always download attachment
228 */
229 getAttachmentZip(id, fileName, project, download) {
230 return __awaiter(this, void 0, void 0, function* () {
231 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
232 let routeValues = {
233 project: project,
234 id: id
235 };
236 let queryValues = {
237 fileName: fileName,
238 download: download,
239 };
240 try {
241 let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "e07b5fa4-1499-494d-a496-64b860fd64ff", routeValues, queryValues);
242 let url = verData.requestUrl;
243 let apiVersion = verData.apiVersion;
244 let accept = this.createAcceptHeader("application/zip", apiVersion);
245 resolve((yield this.http.get(url, { "Accept": accept })).message);
246 }
247 catch (err) {
248 reject(err);
249 }
250 }));
251 });
252 }
253 /**
254 * 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.
255 *
256 * @param {string} project - Project ID or project name
257 * @param {number[]} ids - Comma separated integer classification nodes ids. It's not required, if you want root nodes.
258 * @param {number} depth - Depth of children to fetch.
259 * @param {WorkItemTrackingInterfaces.ClassificationNodesErrorPolicy} errorPolicy - Flag to handle errors in getting some nodes. Possible options are Fail and Omit.
260 */
261 getClassificationNodes(project, ids, depth, errorPolicy) {
262 return __awaiter(this, void 0, void 0, function* () {
263 if (ids == null) {
264 throw new TypeError('ids can not be null or undefined');
265 }
266 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
267 let routeValues = {
268 project: project
269 };
270 let queryValues = {
271 ids: ids && ids.join(","),
272 '$depth': depth,
273 errorPolicy: errorPolicy,
274 };
275 try {
276 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "a70579d1-f53a-48ee-a5be-7be8659023b9", routeValues, queryValues);
277 let url = verData.requestUrl;
278 let options = this.createRequestOptions('application/json', verData.apiVersion);
279 let res;
280 res = yield this.rest.get(url, options);
281 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemClassificationNode, true);
282 resolve(ret);
283 }
284 catch (err) {
285 reject(err);
286 }
287 }));
288 });
289 }
290 /**
291 * Gets root classification nodes under the project.
292 *
293 * @param {string} project - Project ID or project name
294 * @param {number} depth - Depth of children to fetch.
295 */
296 getRootNodes(project, depth) {
297 return __awaiter(this, void 0, void 0, function* () {
298 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
299 let routeValues = {
300 project: project
301 };
302 let queryValues = {
303 '$depth': depth,
304 };
305 try {
306 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "a70579d1-f53a-48ee-a5be-7be8659023b9", routeValues, queryValues);
307 let url = verData.requestUrl;
308 let options = this.createRequestOptions('application/json', verData.apiVersion);
309 let res;
310 res = yield this.rest.get(url, options);
311 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemClassificationNode, true);
312 resolve(ret);
313 }
314 catch (err) {
315 reject(err);
316 }
317 }));
318 });
319 }
320 /**
321 * Create new or update an existing classification node.
322 *
323 * @param {WorkItemTrackingInterfaces.WorkItemClassificationNode} postedNode - Node to create or update.
324 * @param {string} project - Project ID or project name
325 * @param {WorkItemTrackingInterfaces.TreeStructureGroup} structureGroup - Structure group of the classification node, area or iteration.
326 * @param {string} path - Path of the classification node.
327 */
328 createOrUpdateClassificationNode(postedNode, project, structureGroup, path) {
329 return __awaiter(this, void 0, void 0, function* () {
330 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
331 let routeValues = {
332 project: project,
333 structureGroup: structureGroup,
334 path: path
335 };
336 try {
337 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "5a172953-1b41-49d3-840a-33f79c3ce89f", routeValues);
338 let url = verData.requestUrl;
339 let options = this.createRequestOptions('application/json', verData.apiVersion);
340 let res;
341 res = yield this.rest.create(url, postedNode, options);
342 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemClassificationNode, false);
343 resolve(ret);
344 }
345 catch (err) {
346 reject(err);
347 }
348 }));
349 });
350 }
351 /**
352 * Delete an existing classification node.
353 *
354 * @param {string} project - Project ID or project name
355 * @param {WorkItemTrackingInterfaces.TreeStructureGroup} structureGroup - Structure group of the classification node, area or iteration.
356 * @param {string} path - Path of the classification node.
357 * @param {number} reclassifyId - Id of the target classification node for reclassification.
358 */
359 deleteClassificationNode(project, structureGroup, path, reclassifyId) {
360 return __awaiter(this, void 0, void 0, function* () {
361 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
362 let routeValues = {
363 project: project,
364 structureGroup: structureGroup,
365 path: path
366 };
367 let queryValues = {
368 '$reclassifyId': reclassifyId,
369 };
370 try {
371 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "5a172953-1b41-49d3-840a-33f79c3ce89f", routeValues, queryValues);
372 let url = verData.requestUrl;
373 let options = this.createRequestOptions('application/json', verData.apiVersion);
374 let res;
375 res = yield this.rest.del(url, options);
376 let ret = this.formatResponse(res.result, null, false);
377 resolve(ret);
378 }
379 catch (err) {
380 reject(err);
381 }
382 }));
383 });
384 }
385 /**
386 * Gets the classification node for a given node path.
387 *
388 * @param {string} project - Project ID or project name
389 * @param {WorkItemTrackingInterfaces.TreeStructureGroup} structureGroup - Structure group of the classification node, area or iteration.
390 * @param {string} path - Path of the classification node.
391 * @param {number} depth - Depth of children to fetch.
392 */
393 getClassificationNode(project, structureGroup, path, depth) {
394 return __awaiter(this, void 0, void 0, function* () {
395 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
396 let routeValues = {
397 project: project,
398 structureGroup: structureGroup,
399 path: path
400 };
401 let queryValues = {
402 '$depth': depth,
403 };
404 try {
405 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "5a172953-1b41-49d3-840a-33f79c3ce89f", routeValues, queryValues);
406 let url = verData.requestUrl;
407 let options = this.createRequestOptions('application/json', verData.apiVersion);
408 let res;
409 res = yield this.rest.get(url, options);
410 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemClassificationNode, false);
411 resolve(ret);
412 }
413 catch (err) {
414 reject(err);
415 }
416 }));
417 });
418 }
419 /**
420 * Update an existing classification node.
421 *
422 * @param {WorkItemTrackingInterfaces.WorkItemClassificationNode} postedNode - Node to create or update.
423 * @param {string} project - Project ID or project name
424 * @param {WorkItemTrackingInterfaces.TreeStructureGroup} structureGroup - Structure group of the classification node, area or iteration.
425 * @param {string} path - Path of the classification node.
426 */
427 updateClassificationNode(postedNode, project, structureGroup, path) {
428 return __awaiter(this, void 0, void 0, function* () {
429 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
430 let routeValues = {
431 project: project,
432 structureGroup: structureGroup,
433 path: path
434 };
435 try {
436 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "5a172953-1b41-49d3-840a-33f79c3ce89f", routeValues);
437 let url = verData.requestUrl;
438 let options = this.createRequestOptions('application/json', verData.apiVersion);
439 let res;
440 res = yield this.rest.update(url, postedNode, options);
441 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemClassificationNode, false);
442 resolve(ret);
443 }
444 catch (err) {
445 reject(err);
446 }
447 }));
448 });
449 }
450 /**
451 * Get users who reacted on the comment.
452 *
453 * @param {string} project - Project ID or project name
454 * @param {number} workItemId - WorkItem ID.
455 * @param {number} commentId - Comment ID.
456 * @param {WorkItemTrackingInterfaces.CommentReactionType} reactionType - Type of the reaction.
457 * @param {number} top
458 * @param {number} skip
459 */
460 getEngagedUsers(project, workItemId, commentId, reactionType, top, skip) {
461 return __awaiter(this, void 0, void 0, function* () {
462 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
463 let routeValues = {
464 project: project,
465 workItemId: workItemId,
466 commentId: commentId,
467 reactionType: reactionType
468 };
469 let queryValues = {
470 '$top': top,
471 '$skip': skip,
472 };
473 try {
474 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "e33ca5e0-2349-4285-af3d-d72d86781c35", routeValues, queryValues);
475 let url = verData.requestUrl;
476 let options = this.createRequestOptions('application/json', verData.apiVersion);
477 let res;
478 res = yield this.rest.get(url, options);
479 let ret = this.formatResponse(res.result, null, true);
480 resolve(ret);
481 }
482 catch (err) {
483 reject(err);
484 }
485 }));
486 });
487 }
488 /**
489 * Add a comment on a work item.
490 *
491 * @param {WorkItemTrackingInterfaces.CommentCreate} request - Comment create request.
492 * @param {string} project - Project ID or project name
493 * @param {number} workItemId - Id of a work item.
494 */
495 addComment(request, project, workItemId) {
496 return __awaiter(this, void 0, void 0, function* () {
497 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
498 let routeValues = {
499 project: project,
500 workItemId: workItemId
501 };
502 try {
503 let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "608aac0a-32e1-4493-a863-b9cf4566d257", routeValues);
504 let url = verData.requestUrl;
505 let options = this.createRequestOptions('application/json', verData.apiVersion);
506 let res;
507 res = yield this.rest.create(url, request, options);
508 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.Comment, false);
509 resolve(ret);
510 }
511 catch (err) {
512 reject(err);
513 }
514 }));
515 });
516 }
517 /**
518 * Delete a comment on a work item.
519 *
520 * @param {string} project - Project ID or project name
521 * @param {number} workItemId - Id of a work item.
522 * @param {number} commentId
523 */
524 deleteComment(project, workItemId, commentId) {
525 return __awaiter(this, void 0, void 0, function* () {
526 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
527 let routeValues = {
528 project: project,
529 workItemId: workItemId,
530 commentId: commentId
531 };
532 try {
533 let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "608aac0a-32e1-4493-a863-b9cf4566d257", routeValues);
534 let url = verData.requestUrl;
535 let options = this.createRequestOptions('application/json', verData.apiVersion);
536 let res;
537 res = yield this.rest.del(url, options);
538 let ret = this.formatResponse(res.result, null, false);
539 resolve(ret);
540 }
541 catch (err) {
542 reject(err);
543 }
544 }));
545 });
546 }
547 /**
548 * Returns a work item comment.
549 *
550 * @param {string} project - Project ID or project name
551 * @param {number} workItemId - Id of a work item to get the comment.
552 * @param {number} commentId - Id of the comment to return.
553 * @param {boolean} includeDeleted - Specify if the deleted comment should be retrieved.
554 * @param {WorkItemTrackingInterfaces.CommentExpandOptions} expand - Specifies the additional data retrieval options for work item comments.
555 */
556 getComment(project, workItemId, commentId, includeDeleted, expand) {
557 return __awaiter(this, void 0, void 0, function* () {
558 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
559 let routeValues = {
560 project: project,
561 workItemId: workItemId,
562 commentId: commentId
563 };
564 let queryValues = {
565 includeDeleted: includeDeleted,
566 '$expand': expand,
567 };
568 try {
569 let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "608aac0a-32e1-4493-a863-b9cf4566d257", routeValues, queryValues);
570 let url = verData.requestUrl;
571 let options = this.createRequestOptions('application/json', verData.apiVersion);
572 let res;
573 res = yield this.rest.get(url, options);
574 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.Comment, false);
575 resolve(ret);
576 }
577 catch (err) {
578 reject(err);
579 }
580 }));
581 });
582 }
583 /**
584 * Returns a list of work item comments, pageable.
585 *
586 * @param {string} project - Project ID or project name
587 * @param {number} workItemId - Id of a work item to get comments for.
588 * @param {number} top - Max number of comments to return.
589 * @param {string} continuationToken - Used to query for the next page of comments.
590 * @param {boolean} includeDeleted - Specify if the deleted comments should be retrieved.
591 * @param {WorkItemTrackingInterfaces.CommentExpandOptions} expand - Specifies the additional data retrieval options for work item comments.
592 * @param {WorkItemTrackingInterfaces.CommentSortOrder} order - Order in which the comments should be returned.
593 */
594 getComments(project, workItemId, top, continuationToken, includeDeleted, expand, order) {
595 return __awaiter(this, void 0, void 0, function* () {
596 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
597 let routeValues = {
598 project: project,
599 workItemId: workItemId
600 };
601 let queryValues = {
602 '$top': top,
603 continuationToken: continuationToken,
604 includeDeleted: includeDeleted,
605 '$expand': expand,
606 order: order,
607 };
608 try {
609 let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "608aac0a-32e1-4493-a863-b9cf4566d257", routeValues, queryValues);
610 let url = verData.requestUrl;
611 let options = this.createRequestOptions('application/json', verData.apiVersion);
612 let res;
613 res = yield this.rest.get(url, options);
614 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.CommentList, false);
615 resolve(ret);
616 }
617 catch (err) {
618 reject(err);
619 }
620 }));
621 });
622 }
623 /**
624 * Returns a list of work item comments by ids.
625 *
626 * @param {string} project - Project ID or project name
627 * @param {number} workItemId - Id of a work item to get comments for.
628 * @param {number[]} ids - Comma-separated list of comment ids to return.
629 * @param {boolean} includeDeleted - Specify if the deleted comments should be retrieved.
630 * @param {WorkItemTrackingInterfaces.CommentExpandOptions} expand - Specifies the additional data retrieval options for work item comments.
631 */
632 getCommentsBatch(project, workItemId, ids, includeDeleted, expand) {
633 return __awaiter(this, void 0, void 0, function* () {
634 if (ids == null) {
635 throw new TypeError('ids can not be null or undefined');
636 }
637 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
638 let routeValues = {
639 project: project,
640 workItemId: workItemId
641 };
642 let queryValues = {
643 ids: ids && ids.join(","),
644 includeDeleted: includeDeleted,
645 '$expand': expand,
646 };
647 try {
648 let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "608aac0a-32e1-4493-a863-b9cf4566d257", routeValues, queryValues);
649 let url = verData.requestUrl;
650 let options = this.createRequestOptions('application/json', verData.apiVersion);
651 let res;
652 res = yield this.rest.get(url, options);
653 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.CommentList, false);
654 resolve(ret);
655 }
656 catch (err) {
657 reject(err);
658 }
659 }));
660 });
661 }
662 /**
663 * Update a comment on a work item.
664 *
665 * @param {WorkItemTrackingInterfaces.CommentUpdate} request - Comment update request.
666 * @param {string} project - Project ID or project name
667 * @param {number} workItemId - Id of a work item.
668 * @param {number} commentId
669 */
670 updateComment(request, project, workItemId, commentId) {
671 return __awaiter(this, void 0, void 0, function* () {
672 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
673 let routeValues = {
674 project: project,
675 workItemId: workItemId,
676 commentId: commentId
677 };
678 try {
679 let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "608aac0a-32e1-4493-a863-b9cf4566d257", routeValues);
680 let url = verData.requestUrl;
681 let options = this.createRequestOptions('application/json', verData.apiVersion);
682 let res;
683 res = yield this.rest.update(url, request, options);
684 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.Comment, false);
685 resolve(ret);
686 }
687 catch (err) {
688 reject(err);
689 }
690 }));
691 });
692 }
693 /**
694 * Adds a new reaction to a comment.
695 *
696 * @param {string} project - Project ID or project name
697 * @param {number} workItemId - WorkItem ID
698 * @param {number} commentId - Comment ID
699 * @param {WorkItemTrackingInterfaces.CommentReactionType} reactionType - Type of the reaction
700 */
701 createCommentReaction(project, workItemId, commentId, reactionType) {
702 return __awaiter(this, void 0, void 0, function* () {
703 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
704 let routeValues = {
705 project: project,
706 workItemId: workItemId,
707 commentId: commentId,
708 reactionType: reactionType
709 };
710 try {
711 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "f6cb3f27-1028-4851-af96-887e570dc21f", routeValues);
712 let url = verData.requestUrl;
713 let options = this.createRequestOptions('application/json', verData.apiVersion);
714 let res;
715 res = yield this.rest.replace(url, null, options);
716 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.CommentReaction, false);
717 resolve(ret);
718 }
719 catch (err) {
720 reject(err);
721 }
722 }));
723 });
724 }
725 /**
726 * Deletes an existing reaction on a comment.
727 *
728 * @param {string} project - Project ID or project name
729 * @param {number} workItemId - WorkItem ID
730 * @param {number} commentId - Comment ID
731 * @param {WorkItemTrackingInterfaces.CommentReactionType} reactionType - Type of the reaction
732 */
733 deleteCommentReaction(project, workItemId, commentId, reactionType) {
734 return __awaiter(this, void 0, void 0, function* () {
735 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
736 let routeValues = {
737 project: project,
738 workItemId: workItemId,
739 commentId: commentId,
740 reactionType: reactionType
741 };
742 try {
743 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "f6cb3f27-1028-4851-af96-887e570dc21f", routeValues);
744 let url = verData.requestUrl;
745 let options = this.createRequestOptions('application/json', verData.apiVersion);
746 let res;
747 res = yield this.rest.del(url, options);
748 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.CommentReaction, false);
749 resolve(ret);
750 }
751 catch (err) {
752 reject(err);
753 }
754 }));
755 });
756 }
757 /**
758 * Gets reactions of a comment.
759 *
760 * @param {string} project - Project ID or project name
761 * @param {number} workItemId - WorkItem ID
762 * @param {number} commentId - Comment ID
763 */
764 getCommentReactions(project, workItemId, commentId) {
765 return __awaiter(this, void 0, void 0, function* () {
766 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
767 let routeValues = {
768 project: project,
769 workItemId: workItemId,
770 commentId: commentId
771 };
772 try {
773 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "f6cb3f27-1028-4851-af96-887e570dc21f", routeValues);
774 let url = verData.requestUrl;
775 let options = this.createRequestOptions('application/json', verData.apiVersion);
776 let res;
777 res = yield this.rest.get(url, options);
778 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.CommentReaction, true);
779 resolve(ret);
780 }
781 catch (err) {
782 reject(err);
783 }
784 }));
785 });
786 }
787 /**
788 * @param {string} project - Project ID or project name
789 * @param {number} workItemId
790 * @param {number} commentId
791 * @param {number} version
792 */
793 getCommentVersion(project, workItemId, commentId, version) {
794 return __awaiter(this, void 0, void 0, function* () {
795 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
796 let routeValues = {
797 project: project,
798 workItemId: workItemId,
799 commentId: commentId,
800 version: version
801 };
802 try {
803 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "49e03b34-3be0-42e3-8a5d-e8dfb88ac954", routeValues);
804 let url = verData.requestUrl;
805 let options = this.createRequestOptions('application/json', verData.apiVersion);
806 let res;
807 res = yield this.rest.get(url, options);
808 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.CommentVersion, false);
809 resolve(ret);
810 }
811 catch (err) {
812 reject(err);
813 }
814 }));
815 });
816 }
817 /**
818 * @param {string} project - Project ID or project name
819 * @param {number} workItemId
820 * @param {number} commentId
821 */
822 getCommentVersions(project, workItemId, commentId) {
823 return __awaiter(this, void 0, void 0, function* () {
824 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
825 let routeValues = {
826 project: project,
827 workItemId: workItemId,
828 commentId: commentId
829 };
830 try {
831 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "49e03b34-3be0-42e3-8a5d-e8dfb88ac954", routeValues);
832 let url = verData.requestUrl;
833 let options = this.createRequestOptions('application/json', verData.apiVersion);
834 let res;
835 res = yield this.rest.get(url, options);
836 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.CommentVersion, true);
837 resolve(ret);
838 }
839 catch (err) {
840 reject(err);
841 }
842 }));
843 });
844 }
845 /**
846 * Create a new field.
847 *
848 * @param {WorkItemTrackingInterfaces.WorkItemField} workItemField - New field definition
849 * @param {string} project - Project ID or project name
850 */
851 createField(workItemField, project) {
852 return __awaiter(this, void 0, void 0, function* () {
853 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
854 let routeValues = {
855 project: project
856 };
857 try {
858 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "b51fd764-e5c2-4b9b-aaf7-3395cf4bdd94", routeValues);
859 let url = verData.requestUrl;
860 let options = this.createRequestOptions('application/json', verData.apiVersion);
861 let res;
862 res = yield this.rest.create(url, workItemField, options);
863 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemField, false);
864 resolve(ret);
865 }
866 catch (err) {
867 reject(err);
868 }
869 }));
870 });
871 }
872 /**
873 * Deletes the field. To undelete a filed, see "Update Field" API.
874 *
875 * @param {string} fieldNameOrRefName - Field simple name or reference name
876 * @param {string} project - Project ID or project name
877 */
878 deleteField(fieldNameOrRefName, project) {
879 return __awaiter(this, void 0, void 0, function* () {
880 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
881 let routeValues = {
882 project: project,
883 fieldNameOrRefName: fieldNameOrRefName
884 };
885 try {
886 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "b51fd764-e5c2-4b9b-aaf7-3395cf4bdd94", routeValues);
887 let url = verData.requestUrl;
888 let options = this.createRequestOptions('application/json', verData.apiVersion);
889 let res;
890 res = yield this.rest.del(url, options);
891 let ret = this.formatResponse(res.result, null, false);
892 resolve(ret);
893 }
894 catch (err) {
895 reject(err);
896 }
897 }));
898 });
899 }
900 /**
901 * Gets information on a specific field.
902 *
903 * @param {string} fieldNameOrRefName - Field simple name or reference name
904 * @param {string} project - Project ID or project name
905 */
906 getField(fieldNameOrRefName, project) {
907 return __awaiter(this, void 0, void 0, function* () {
908 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
909 let routeValues = {
910 project: project,
911 fieldNameOrRefName: fieldNameOrRefName
912 };
913 try {
914 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "b51fd764-e5c2-4b9b-aaf7-3395cf4bdd94", routeValues);
915 let url = verData.requestUrl;
916 let options = this.createRequestOptions('application/json', verData.apiVersion);
917 let res;
918 res = yield this.rest.get(url, options);
919 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemField, false);
920 resolve(ret);
921 }
922 catch (err) {
923 reject(err);
924 }
925 }));
926 });
927 }
928 /**
929 * Returns information for all fields. The project ID/name parameter is optional.
930 *
931 * @param {string} project - Project ID or project name
932 * @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.
933 */
934 getFields(project, expand) {
935 return __awaiter(this, void 0, void 0, function* () {
936 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
937 let routeValues = {
938 project: project
939 };
940 let queryValues = {
941 '$expand': expand,
942 };
943 try {
944 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "b51fd764-e5c2-4b9b-aaf7-3395cf4bdd94", routeValues, queryValues);
945 let url = verData.requestUrl;
946 let options = this.createRequestOptions('application/json', verData.apiVersion);
947 let res;
948 res = yield this.rest.get(url, options);
949 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemField, true);
950 resolve(ret);
951 }
952 catch (err) {
953 reject(err);
954 }
955 }));
956 });
957 }
958 /**
959 * Update a field.
960 *
961 * @param {WorkItemTrackingInterfaces.UpdateWorkItemField} payload - Payload contains desired value of the field's properties
962 * @param {string} fieldNameOrRefName - Name/reference name of the field to be updated
963 * @param {string} project - Project ID or project name
964 */
965 updateField(payload, fieldNameOrRefName, project) {
966 return __awaiter(this, void 0, void 0, function* () {
967 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
968 let routeValues = {
969 project: project,
970 fieldNameOrRefName: fieldNameOrRefName
971 };
972 try {
973 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "b51fd764-e5c2-4b9b-aaf7-3395cf4bdd94", routeValues);
974 let url = verData.requestUrl;
975 let options = this.createRequestOptions('application/json', verData.apiVersion);
976 let res;
977 res = yield this.rest.update(url, payload, options);
978 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemField, false);
979 resolve(ret);
980 }
981 catch (err) {
982 reject(err);
983 }
984 }));
985 });
986 }
987 /**
988 * 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.
989 *
990 * @param {WorkItemTrackingInterfaces.ProcessIdModel} newProcess
991 * @param {string} project - Project ID or project name
992 */
993 migrateProjectsProcess(newProcess, project) {
994 return __awaiter(this, void 0, void 0, function* () {
995 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
996 let routeValues = {
997 project: project
998 };
999 try {
1000 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "19801631-d4e5-47e9-8166-0330de0ff1e6", routeValues);
1001 let url = verData.requestUrl;
1002 let options = this.createRequestOptions('application/json', verData.apiVersion);
1003 let res;
1004 res = yield this.rest.create(url, newProcess, options);
1005 let ret = this.formatResponse(res.result, null, false);
1006 resolve(ret);
1007 }
1008 catch (err) {
1009 reject(err);
1010 }
1011 }));
1012 });
1013 }
1014 /**
1015 * Creates a query, or moves a query.
1016 *
1017 * @param {WorkItemTrackingInterfaces.QueryHierarchyItem} postedQuery - The query to create.
1018 * @param {string} project - Project ID or project name
1019 * @param {string} query - The parent id or path under which the query is to be created.
1020 * @param {boolean} validateWiqlOnly - If you only want to validate your WIQL query without actually creating one, set it to true. Default is false.
1021 */
1022 createQuery(postedQuery, project, query, validateWiqlOnly) {
1023 return __awaiter(this, void 0, void 0, function* () {
1024 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1025 let routeValues = {
1026 project: project,
1027 query: query
1028 };
1029 let queryValues = {
1030 validateWiqlOnly: validateWiqlOnly,
1031 };
1032 try {
1033 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "a67d190c-c41f-424b-814d-0e906f659301", routeValues, queryValues);
1034 let url = verData.requestUrl;
1035 let options = this.createRequestOptions('application/json', verData.apiVersion);
1036 let res;
1037 res = yield this.rest.create(url, postedQuery, options);
1038 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.QueryHierarchyItem, false);
1039 resolve(ret);
1040 }
1041 catch (err) {
1042 reject(err);
1043 }
1044 }));
1045 });
1046 }
1047 /**
1048 * 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.
1049 *
1050 * @param {string} project - Project ID or project name
1051 * @param {string} query - ID or path of the query or folder to delete.
1052 */
1053 deleteQuery(project, query) {
1054 return __awaiter(this, void 0, void 0, function* () {
1055 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1056 let routeValues = {
1057 project: project,
1058 query: query
1059 };
1060 try {
1061 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "a67d190c-c41f-424b-814d-0e906f659301", routeValues);
1062 let url = verData.requestUrl;
1063 let options = this.createRequestOptions('application/json', verData.apiVersion);
1064 let res;
1065 res = yield this.rest.del(url, options);
1066 let ret = this.formatResponse(res.result, null, false);
1067 resolve(ret);
1068 }
1069 catch (err) {
1070 reject(err);
1071 }
1072 }));
1073 });
1074 }
1075 /**
1076 * Gets the root queries and their children
1077 *
1078 * @param {string} project - Project ID or project name
1079 * @param {WorkItemTrackingInterfaces.QueryExpand} expand - Include the query string (wiql), clauses, query result columns, and sort options in the results.
1080 * @param {number} depth - In the folder of queries, return child queries and folders to this depth.
1081 * @param {boolean} includeDeleted - Include deleted queries and folders
1082 */
1083 getQueries(project, expand, depth, includeDeleted) {
1084 return __awaiter(this, void 0, void 0, function* () {
1085 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1086 let routeValues = {
1087 project: project
1088 };
1089 let queryValues = {
1090 '$expand': expand,
1091 '$depth': depth,
1092 '$includeDeleted': includeDeleted,
1093 };
1094 try {
1095 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "a67d190c-c41f-424b-814d-0e906f659301", routeValues, queryValues);
1096 let url = verData.requestUrl;
1097 let options = this.createRequestOptions('application/json', verData.apiVersion);
1098 let res;
1099 res = yield this.rest.get(url, options);
1100 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.QueryHierarchyItem, true);
1101 resolve(ret);
1102 }
1103 catch (err) {
1104 reject(err);
1105 }
1106 }));
1107 });
1108 }
1109 /**
1110 * Retrieves an individual query and its children
1111 *
1112 * @param {string} project - Project ID or project name
1113 * @param {string} query - ID or path of the query.
1114 * @param {WorkItemTrackingInterfaces.QueryExpand} expand - Include the query string (wiql), clauses, query result columns, and sort options in the results.
1115 * @param {number} depth - In the folder of queries, return child queries and folders to this depth.
1116 * @param {boolean} includeDeleted - Include deleted queries and folders
1117 * @param {boolean} useIsoDateFormat - DateTime query clauses will be formatted using a ISO 8601 compliant format
1118 */
1119 getQuery(project, query, expand, depth, includeDeleted, useIsoDateFormat) {
1120 return __awaiter(this, void 0, void 0, function* () {
1121 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1122 let routeValues = {
1123 project: project,
1124 query: query
1125 };
1126 let queryValues = {
1127 '$expand': expand,
1128 '$depth': depth,
1129 '$includeDeleted': includeDeleted,
1130 '$useIsoDateFormat': useIsoDateFormat,
1131 };
1132 try {
1133 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "a67d190c-c41f-424b-814d-0e906f659301", routeValues, queryValues);
1134 let url = verData.requestUrl;
1135 let options = this.createRequestOptions('application/json', verData.apiVersion);
1136 let res;
1137 res = yield this.rest.get(url, options);
1138 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.QueryHierarchyItem, false);
1139 resolve(ret);
1140 }
1141 catch (err) {
1142 reject(err);
1143 }
1144 }));
1145 });
1146 }
1147 /**
1148 * Searches all queries the user has access to in the current project
1149 *
1150 * @param {string} project - Project ID or project name
1151 * @param {string} filter - The text to filter the queries with.
1152 * @param {number} top - The number of queries to return (Default is 50 and maximum is 200).
1153 * @param {WorkItemTrackingInterfaces.QueryExpand} expand
1154 * @param {boolean} includeDeleted - Include deleted queries and folders
1155 */
1156 searchQueries(project, filter, top, expand, includeDeleted) {
1157 return __awaiter(this, void 0, void 0, function* () {
1158 if (filter == null) {
1159 throw new TypeError('filter can not be null or undefined');
1160 }
1161 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1162 let routeValues = {
1163 project: project
1164 };
1165 let queryValues = {
1166 '$filter': filter,
1167 '$top': top,
1168 '$expand': expand,
1169 '$includeDeleted': includeDeleted,
1170 };
1171 try {
1172 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "a67d190c-c41f-424b-814d-0e906f659301", routeValues, queryValues);
1173 let url = verData.requestUrl;
1174 let options = this.createRequestOptions('application/json', verData.apiVersion);
1175 let res;
1176 res = yield this.rest.get(url, options);
1177 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.QueryHierarchyItemsResult, false);
1178 resolve(ret);
1179 }
1180 catch (err) {
1181 reject(err);
1182 }
1183 }));
1184 });
1185 }
1186 /**
1187 * Update a query or a folder. This allows you to update, rename and move queries and folders.
1188 *
1189 * @param {WorkItemTrackingInterfaces.QueryHierarchyItem} queryUpdate - The query to update.
1190 * @param {string} project - Project ID or project name
1191 * @param {string} query - The ID or path for the query to update.
1192 * @param {boolean} undeleteDescendants - Undelete the children of this folder. It is important to note that this will not bring back the permission changes that were previously applied to the descendants.
1193 */
1194 updateQuery(queryUpdate, project, query, undeleteDescendants) {
1195 return __awaiter(this, void 0, void 0, function* () {
1196 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1197 let routeValues = {
1198 project: project,
1199 query: query
1200 };
1201 let queryValues = {
1202 '$undeleteDescendants': undeleteDescendants,
1203 };
1204 try {
1205 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "a67d190c-c41f-424b-814d-0e906f659301", routeValues, queryValues);
1206 let url = verData.requestUrl;
1207 let options = this.createRequestOptions('application/json', verData.apiVersion);
1208 let res;
1209 res = yield this.rest.update(url, queryUpdate, options);
1210 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.QueryHierarchyItem, false);
1211 resolve(ret);
1212 }
1213 catch (err) {
1214 reject(err);
1215 }
1216 }));
1217 });
1218 }
1219 /**
1220 * Gets a list of queries by ids (Maximum 1000)
1221 *
1222 * @param {WorkItemTrackingInterfaces.QueryBatchGetRequest} queryGetRequest
1223 * @param {string} project - Project ID or project name
1224 */
1225 getQueriesBatch(queryGetRequest, project) {
1226 return __awaiter(this, void 0, void 0, function* () {
1227 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1228 let routeValues = {
1229 project: project
1230 };
1231 try {
1232 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "549816f9-09b0-4e75-9e81-01fbfcd07426", routeValues);
1233 let url = verData.requestUrl;
1234 let options = this.createRequestOptions('application/json', verData.apiVersion);
1235 let res;
1236 res = yield this.rest.create(url, queryGetRequest, options);
1237 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.QueryHierarchyItem, true);
1238 resolve(ret);
1239 }
1240 catch (err) {
1241 reject(err);
1242 }
1243 }));
1244 });
1245 }
1246 /**
1247 * Destroys the specified work item permanently from the Recycle Bin. This action can not be undone.
1248 *
1249 * @param {number} id - ID of the work item to be destroyed permanently
1250 * @param {string} project - Project ID or project name
1251 */
1252 destroyWorkItem(id, project) {
1253 return __awaiter(this, void 0, void 0, function* () {
1254 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1255 let routeValues = {
1256 project: project,
1257 id: id
1258 };
1259 try {
1260 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "b70d8d39-926c-465e-b927-b1bf0e5ca0e0", routeValues);
1261 let url = verData.requestUrl;
1262 let options = this.createRequestOptions('application/json', verData.apiVersion);
1263 let res;
1264 res = yield this.rest.del(url, options);
1265 let ret = this.formatResponse(res.result, null, false);
1266 resolve(ret);
1267 }
1268 catch (err) {
1269 reject(err);
1270 }
1271 }));
1272 });
1273 }
1274 /**
1275 * Gets a deleted work item from Recycle Bin.
1276 *
1277 * @param {number} id - ID of the work item to be returned
1278 * @param {string} project - Project ID or project name
1279 */
1280 getDeletedWorkItem(id, project) {
1281 return __awaiter(this, void 0, void 0, function* () {
1282 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1283 let routeValues = {
1284 project: project,
1285 id: id
1286 };
1287 try {
1288 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "b70d8d39-926c-465e-b927-b1bf0e5ca0e0", routeValues);
1289 let url = verData.requestUrl;
1290 let options = this.createRequestOptions('application/json', verData.apiVersion);
1291 let res;
1292 res = yield this.rest.get(url, options);
1293 let ret = this.formatResponse(res.result, null, false);
1294 resolve(ret);
1295 }
1296 catch (err) {
1297 reject(err);
1298 }
1299 }));
1300 });
1301 }
1302 /**
1303 * Gets the work items from the recycle bin, whose IDs have been specified in the parameters
1304 *
1305 * @param {number[]} ids - Comma separated list of IDs of the deleted work items to be returned
1306 * @param {string} project - Project ID or project name
1307 */
1308 getDeletedWorkItems(ids, project) {
1309 return __awaiter(this, void 0, void 0, function* () {
1310 if (ids == null) {
1311 throw new TypeError('ids can not be null or undefined');
1312 }
1313 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1314 let routeValues = {
1315 project: project
1316 };
1317 let queryValues = {
1318 ids: ids && ids.join(","),
1319 };
1320 try {
1321 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "b70d8d39-926c-465e-b927-b1bf0e5ca0e0", routeValues, queryValues);
1322 let url = verData.requestUrl;
1323 let options = this.createRequestOptions('application/json', verData.apiVersion);
1324 let res;
1325 res = yield this.rest.get(url, options);
1326 let ret = this.formatResponse(res.result, null, true);
1327 resolve(ret);
1328 }
1329 catch (err) {
1330 reject(err);
1331 }
1332 }));
1333 });
1334 }
1335 /**
1336 * Gets a list of the IDs and the URLs of the deleted the work items in the Recycle Bin.
1337 *
1338 * @param {string} project - Project ID or project name
1339 */
1340 getDeletedWorkItemShallowReferences(project) {
1341 return __awaiter(this, void 0, void 0, function* () {
1342 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1343 let routeValues = {
1344 project: project
1345 };
1346 try {
1347 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "b70d8d39-926c-465e-b927-b1bf0e5ca0e0", routeValues);
1348 let url = verData.requestUrl;
1349 let options = this.createRequestOptions('application/json', verData.apiVersion);
1350 let res;
1351 res = yield this.rest.get(url, options);
1352 let ret = this.formatResponse(res.result, null, true);
1353 resolve(ret);
1354 }
1355 catch (err) {
1356 reject(err);
1357 }
1358 }));
1359 });
1360 }
1361 /**
1362 * Restores the deleted work item from Recycle Bin.
1363 *
1364 * @param {WorkItemTrackingInterfaces.WorkItemDeleteUpdate} payload - Paylod with instructions to update the IsDeleted flag to false
1365 * @param {number} id - ID of the work item to be restored
1366 * @param {string} project - Project ID or project name
1367 */
1368 restoreWorkItem(payload, id, project) {
1369 return __awaiter(this, void 0, void 0, function* () {
1370 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1371 let routeValues = {
1372 project: project,
1373 id: id
1374 };
1375 try {
1376 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "b70d8d39-926c-465e-b927-b1bf0e5ca0e0", routeValues);
1377 let url = verData.requestUrl;
1378 let options = this.createRequestOptions('application/json', verData.apiVersion);
1379 let res;
1380 res = yield this.rest.update(url, payload, options);
1381 let ret = this.formatResponse(res.result, null, false);
1382 resolve(ret);
1383 }
1384 catch (err) {
1385 reject(err);
1386 }
1387 }));
1388 });
1389 }
1390 /**
1391 * Returns a fully hydrated work item for the requested revision
1392 *
1393 * @param {number} id
1394 * @param {number} revisionNumber
1395 * @param {WorkItemTrackingInterfaces.WorkItemExpand} expand
1396 * @param {string} project - Project ID or project name
1397 */
1398 getRevision(id, revisionNumber, expand, project) {
1399 return __awaiter(this, void 0, void 0, function* () {
1400 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1401 let routeValues = {
1402 project: project,
1403 id: id,
1404 revisionNumber: revisionNumber
1405 };
1406 let queryValues = {
1407 '$expand': expand,
1408 };
1409 try {
1410 let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "a00c85a5-80fa-4565-99c3-bcd2181434bb", routeValues, queryValues);
1411 let url = verData.requestUrl;
1412 let options = this.createRequestOptions('application/json', verData.apiVersion);
1413 let res;
1414 res = yield this.rest.get(url, options);
1415 let ret = this.formatResponse(res.result, null, false);
1416 resolve(ret);
1417 }
1418 catch (err) {
1419 reject(err);
1420 }
1421 }));
1422 });
1423 }
1424 /**
1425 * Returns the list of fully hydrated work item revisions, paged.
1426 *
1427 * @param {number} id
1428 * @param {number} top
1429 * @param {number} skip
1430 * @param {WorkItemTrackingInterfaces.WorkItemExpand} expand
1431 * @param {string} project - Project ID or project name
1432 */
1433 getRevisions(id, top, skip, expand, project) {
1434 return __awaiter(this, void 0, void 0, function* () {
1435 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1436 let routeValues = {
1437 project: project,
1438 id: id
1439 };
1440 let queryValues = {
1441 '$top': top,
1442 '$skip': skip,
1443 '$expand': expand,
1444 };
1445 try {
1446 let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "a00c85a5-80fa-4565-99c3-bcd2181434bb", routeValues, queryValues);
1447 let url = verData.requestUrl;
1448 let options = this.createRequestOptions('application/json', verData.apiVersion);
1449 let res;
1450 res = yield this.rest.get(url, options);
1451 let ret = this.formatResponse(res.result, null, true);
1452 resolve(ret);
1453 }
1454 catch (err) {
1455 reject(err);
1456 }
1457 }));
1458 });
1459 }
1460 /**
1461 * RESTful method to send mail for selected/queried work items.
1462 *
1463 * @param {WorkItemTrackingInterfaces.SendMailBody} body
1464 * @param {string} project - Project ID or project name
1465 */
1466 sendMail(body, project) {
1467 return __awaiter(this, void 0, void 0, function* () {
1468 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1469 let routeValues = {
1470 project: project
1471 };
1472 try {
1473 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "12438500-2f84-4fa7-9f1a-c31871b4959d", routeValues);
1474 let url = verData.requestUrl;
1475 let options = this.createRequestOptions('application/json', verData.apiVersion);
1476 let res;
1477 res = yield this.rest.create(url, body, options);
1478 let ret = this.formatResponse(res.result, null, false);
1479 resolve(ret);
1480 }
1481 catch (err) {
1482 reject(err);
1483 }
1484 }));
1485 });
1486 }
1487 /**
1488 * @param {string} project - Project ID or project name
1489 * @param {string} tagIdOrName
1490 */
1491 deleteTag(project, tagIdOrName) {
1492 return __awaiter(this, void 0, void 0, function* () {
1493 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1494 let routeValues = {
1495 project: project,
1496 tagIdOrName: tagIdOrName
1497 };
1498 try {
1499 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "bc15bc60-e7a8-43cb-ab01-2106be3983a1", routeValues);
1500 let url = verData.requestUrl;
1501 let options = this.createRequestOptions('application/json', verData.apiVersion);
1502 let res;
1503 res = yield this.rest.del(url, options);
1504 let ret = this.formatResponse(res.result, null, false);
1505 resolve(ret);
1506 }
1507 catch (err) {
1508 reject(err);
1509 }
1510 }));
1511 });
1512 }
1513 /**
1514 * @param {string} project - Project ID or project name
1515 * @param {string} tagIdOrName
1516 */
1517 getTag(project, tagIdOrName) {
1518 return __awaiter(this, void 0, void 0, function* () {
1519 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1520 let routeValues = {
1521 project: project,
1522 tagIdOrName: tagIdOrName
1523 };
1524 try {
1525 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "bc15bc60-e7a8-43cb-ab01-2106be3983a1", routeValues);
1526 let url = verData.requestUrl;
1527 let options = this.createRequestOptions('application/json', verData.apiVersion);
1528 let res;
1529 res = yield this.rest.get(url, options);
1530 let ret = this.formatResponse(res.result, null, false);
1531 resolve(ret);
1532 }
1533 catch (err) {
1534 reject(err);
1535 }
1536 }));
1537 });
1538 }
1539 /**
1540 * @param {string} project - Project ID or project name
1541 */
1542 getTags(project) {
1543 return __awaiter(this, void 0, void 0, function* () {
1544 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1545 let routeValues = {
1546 project: project
1547 };
1548 try {
1549 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "bc15bc60-e7a8-43cb-ab01-2106be3983a1", routeValues);
1550 let url = verData.requestUrl;
1551 let options = this.createRequestOptions('application/json', verData.apiVersion);
1552 let res;
1553 res = yield this.rest.get(url, options);
1554 let ret = this.formatResponse(res.result, null, true);
1555 resolve(ret);
1556 }
1557 catch (err) {
1558 reject(err);
1559 }
1560 }));
1561 });
1562 }
1563 /**
1564 * @param {WorkItemTrackingInterfaces.WorkItemTagDefinition} tagData
1565 * @param {string} project - Project ID or project name
1566 * @param {string} tagIdOrName
1567 */
1568 updateTag(tagData, project, tagIdOrName) {
1569 return __awaiter(this, void 0, void 0, function* () {
1570 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1571 let routeValues = {
1572 project: project,
1573 tagIdOrName: tagIdOrName
1574 };
1575 try {
1576 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "bc15bc60-e7a8-43cb-ab01-2106be3983a1", routeValues);
1577 let url = verData.requestUrl;
1578 let options = this.createRequestOptions('application/json', verData.apiVersion);
1579 let res;
1580 res = yield this.rest.update(url, tagData, options);
1581 let ret = this.formatResponse(res.result, null, false);
1582 resolve(ret);
1583 }
1584 catch (err) {
1585 reject(err);
1586 }
1587 }));
1588 });
1589 }
1590 /**
1591 * Creates a template
1592 *
1593 * @param {WorkItemTrackingInterfaces.WorkItemTemplate} template - Template contents
1594 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
1595 */
1596 createTemplate(template, teamContext) {
1597 return __awaiter(this, void 0, void 0, function* () {
1598 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1599 let project = null;
1600 let team = null;
1601 if (teamContext) {
1602 project = teamContext.projectId || teamContext.project;
1603 team = teamContext.teamId || teamContext.team;
1604 }
1605 let routeValues = {
1606 project: project,
1607 team: team
1608 };
1609 try {
1610 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "6a90345f-a676-4969-afce-8e163e1d5642", routeValues);
1611 let url = verData.requestUrl;
1612 let options = this.createRequestOptions('application/json', verData.apiVersion);
1613 let res;
1614 res = yield this.rest.create(url, template, options);
1615 let ret = this.formatResponse(res.result, null, false);
1616 resolve(ret);
1617 }
1618 catch (err) {
1619 reject(err);
1620 }
1621 }));
1622 });
1623 }
1624 /**
1625 * Gets template
1626 *
1627 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
1628 * @param {string} workitemtypename - Optional, When specified returns templates for given Work item type.
1629 */
1630 getTemplates(teamContext, workitemtypename) {
1631 return __awaiter(this, void 0, void 0, function* () {
1632 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1633 let project = null;
1634 let team = null;
1635 if (teamContext) {
1636 project = teamContext.projectId || teamContext.project;
1637 team = teamContext.teamId || teamContext.team;
1638 }
1639 let routeValues = {
1640 project: project,
1641 team: team
1642 };
1643 let queryValues = {
1644 workitemtypename: workitemtypename,
1645 };
1646 try {
1647 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "6a90345f-a676-4969-afce-8e163e1d5642", routeValues, queryValues);
1648 let url = verData.requestUrl;
1649 let options = this.createRequestOptions('application/json', verData.apiVersion);
1650 let res;
1651 res = yield this.rest.get(url, options);
1652 let ret = this.formatResponse(res.result, null, true);
1653 resolve(ret);
1654 }
1655 catch (err) {
1656 reject(err);
1657 }
1658 }));
1659 });
1660 }
1661 /**
1662 * Deletes the template with given id
1663 *
1664 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
1665 * @param {string} templateId - Template id
1666 */
1667 deleteTemplate(teamContext, templateId) {
1668 return __awaiter(this, void 0, void 0, function* () {
1669 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1670 let project = null;
1671 let team = null;
1672 if (teamContext) {
1673 project = teamContext.projectId || teamContext.project;
1674 team = teamContext.teamId || teamContext.team;
1675 }
1676 let routeValues = {
1677 project: project,
1678 team: team,
1679 templateId: templateId
1680 };
1681 try {
1682 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "fb10264a-8836-48a0-8033-1b0ccd2748d5", routeValues);
1683 let url = verData.requestUrl;
1684 let options = this.createRequestOptions('application/json', verData.apiVersion);
1685 let res;
1686 res = yield this.rest.del(url, options);
1687 let ret = this.formatResponse(res.result, null, false);
1688 resolve(ret);
1689 }
1690 catch (err) {
1691 reject(err);
1692 }
1693 }));
1694 });
1695 }
1696 /**
1697 * Gets the template with specified id
1698 *
1699 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
1700 * @param {string} templateId - Template Id
1701 */
1702 getTemplate(teamContext, templateId) {
1703 return __awaiter(this, void 0, void 0, function* () {
1704 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1705 let project = null;
1706 let team = null;
1707 if (teamContext) {
1708 project = teamContext.projectId || teamContext.project;
1709 team = teamContext.teamId || teamContext.team;
1710 }
1711 let routeValues = {
1712 project: project,
1713 team: team,
1714 templateId: templateId
1715 };
1716 try {
1717 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "fb10264a-8836-48a0-8033-1b0ccd2748d5", routeValues);
1718 let url = verData.requestUrl;
1719 let options = this.createRequestOptions('application/json', verData.apiVersion);
1720 let res;
1721 res = yield this.rest.get(url, options);
1722 let ret = this.formatResponse(res.result, null, false);
1723 resolve(ret);
1724 }
1725 catch (err) {
1726 reject(err);
1727 }
1728 }));
1729 });
1730 }
1731 /**
1732 * Replace template contents
1733 *
1734 * @param {WorkItemTrackingInterfaces.WorkItemTemplate} templateContent - Template contents to replace with
1735 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
1736 * @param {string} templateId - Template id
1737 */
1738 replaceTemplate(templateContent, teamContext, templateId) {
1739 return __awaiter(this, void 0, void 0, function* () {
1740 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1741 let project = null;
1742 let team = null;
1743 if (teamContext) {
1744 project = teamContext.projectId || teamContext.project;
1745 team = teamContext.teamId || teamContext.team;
1746 }
1747 let routeValues = {
1748 project: project,
1749 team: team,
1750 templateId: templateId
1751 };
1752 try {
1753 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "fb10264a-8836-48a0-8033-1b0ccd2748d5", routeValues);
1754 let url = verData.requestUrl;
1755 let options = this.createRequestOptions('application/json', verData.apiVersion);
1756 let res;
1757 res = yield this.rest.replace(url, templateContent, options);
1758 let ret = this.formatResponse(res.result, null, false);
1759 resolve(ret);
1760 }
1761 catch (err) {
1762 reject(err);
1763 }
1764 }));
1765 });
1766 }
1767 /**
1768 * Returns a single update for a work item
1769 *
1770 * @param {number} id
1771 * @param {number} updateNumber
1772 * @param {string} project - Project ID or project name
1773 */
1774 getUpdate(id, updateNumber, project) {
1775 return __awaiter(this, void 0, void 0, function* () {
1776 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1777 let routeValues = {
1778 project: project,
1779 id: id,
1780 updateNumber: updateNumber
1781 };
1782 try {
1783 let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "6570bf97-d02c-4a91-8d93-3abe9895b1a9", routeValues);
1784 let url = verData.requestUrl;
1785 let options = this.createRequestOptions('application/json', verData.apiVersion);
1786 let res;
1787 res = yield this.rest.get(url, options);
1788 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemUpdate, false);
1789 resolve(ret);
1790 }
1791 catch (err) {
1792 reject(err);
1793 }
1794 }));
1795 });
1796 }
1797 /**
1798 * Returns a the deltas between work item revisions
1799 *
1800 * @param {number} id
1801 * @param {number} top
1802 * @param {number} skip
1803 * @param {string} project - Project ID or project name
1804 */
1805 getUpdates(id, top, skip, project) {
1806 return __awaiter(this, void 0, void 0, function* () {
1807 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1808 let routeValues = {
1809 project: project,
1810 id: id
1811 };
1812 let queryValues = {
1813 '$top': top,
1814 '$skip': skip,
1815 };
1816 try {
1817 let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "6570bf97-d02c-4a91-8d93-3abe9895b1a9", routeValues, queryValues);
1818 let url = verData.requestUrl;
1819 let options = this.createRequestOptions('application/json', verData.apiVersion);
1820 let res;
1821 res = yield this.rest.get(url, options);
1822 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemUpdate, true);
1823 resolve(ret);
1824 }
1825 catch (err) {
1826 reject(err);
1827 }
1828 }));
1829 });
1830 }
1831 /**
1832 * Gets the results of the query given its WIQL.
1833 *
1834 * @param {WorkItemTrackingInterfaces.Wiql} wiql - The query containing the WIQL.
1835 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
1836 * @param {boolean} timePrecision - Whether or not to use time precision.
1837 * @param {number} top - The max number of results to return.
1838 */
1839 queryByWiql(wiql, teamContext, timePrecision, top) {
1840 return __awaiter(this, void 0, void 0, function* () {
1841 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1842 let project = null;
1843 let team = null;
1844 if (teamContext) {
1845 project = teamContext.projectId || teamContext.project;
1846 team = teamContext.teamId || teamContext.team;
1847 }
1848 let routeValues = {
1849 project: project,
1850 team: team
1851 };
1852 let queryValues = {
1853 timePrecision: timePrecision,
1854 '$top': top,
1855 };
1856 try {
1857 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "1a9c53f7-f243-4447-b110-35ef023636e4", routeValues, queryValues);
1858 let url = verData.requestUrl;
1859 let options = this.createRequestOptions('application/json', verData.apiVersion);
1860 let res;
1861 res = yield this.rest.create(url, wiql, options);
1862 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemQueryResult, false);
1863 resolve(ret);
1864 }
1865 catch (err) {
1866 reject(err);
1867 }
1868 }));
1869 });
1870 }
1871 /**
1872 * Gets the results of the query given the query ID.
1873 *
1874 * @param {string} id - The query ID.
1875 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
1876 * @param {boolean} timePrecision - Whether or not to use time precision.
1877 * @param {number} top - The max number of results to return.
1878 */
1879 queryById(id, teamContext, timePrecision, top) {
1880 return __awaiter(this, void 0, void 0, function* () {
1881 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1882 let project = null;
1883 let team = null;
1884 if (teamContext) {
1885 project = teamContext.projectId || teamContext.project;
1886 team = teamContext.teamId || teamContext.team;
1887 }
1888 let routeValues = {
1889 project: project,
1890 team: team,
1891 id: id
1892 };
1893 let queryValues = {
1894 timePrecision: timePrecision,
1895 '$top': top,
1896 };
1897 try {
1898 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "a02355f5-5f8a-4671-8e32-369d23aac83d", routeValues, queryValues);
1899 let url = verData.requestUrl;
1900 let options = this.createRequestOptions('application/json', verData.apiVersion);
1901 let res;
1902 res = yield this.rest.get(url, options);
1903 let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemQueryResult, false);
1904 resolve(ret);
1905 }
1906 catch (err) {
1907 reject(err);
1908 }
1909 }));
1910 });
1911 }
1912 /**
1913 * Get a work item icon given the friendly name and icon color.
1914 *
1915 * @param {string} icon - The name of the icon
1916 * @param {string} color - The 6-digit hex color for the icon
1917 * @param {number} v - The version of the icon (used only for cache invalidation)
1918 */
1919 getWorkItemIconJson(icon, color, v) {
1920 return __awaiter(this, void 0, void 0, function* () {
1921 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1922 let routeValues = {
1923 icon: icon
1924 };
1925 let queryValues = {
1926 color: color,
1927 v: v,
1928 };
1929 try {
1930 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "4e1eb4a5-1970-4228-a682-ec48eb2dca30", routeValues, queryValues);
1931 let url = verData.requestUrl;
1932 let options = this.createRequestOptions('application/json', verData.apiVersion);
1933 let res;
1934 res = yield this.rest.get(url, options);
1935 let ret = this.formatResponse(res.result, null, false);
1936 resolve(ret);
1937 }
1938 catch (err) {
1939 reject(err);
1940 }
1941 }));
1942 });
1943 }
1944 /**
1945 * Get a list of all work item icons.
1946 *
1947 */
1948 getWorkItemIcons() {
1949 return __awaiter(this, void 0, void 0, function* () {
1950 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1951 let routeValues = {};
1952 try {
1953 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "4e1eb4a5-1970-4228-a682-ec48eb2dca30", routeValues);
1954 let url = verData.requestUrl;
1955 let options = this.createRequestOptions('application/json', verData.apiVersion);
1956 let res;
1957 res = yield this.rest.get(url, options);
1958 let ret = this.formatResponse(res.result, null, true);
1959 resolve(ret);
1960 }
1961 catch (err) {
1962 reject(err);
1963 }
1964 }));
1965 });
1966 }
1967 /**
1968 * Get a work item icon given the friendly name and icon color.
1969 *
1970 * @param {string} icon - The name of the icon
1971 * @param {string} color - The 6-digit hex color for the icon
1972 * @param {number} v - The version of the icon (used only for cache invalidation)
1973 */
1974 getWorkItemIconSvg(icon, color, v) {
1975 return __awaiter(this, void 0, void 0, function* () {
1976 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1977 let routeValues = {
1978 icon: icon
1979 };
1980 let queryValues = {
1981 color: color,
1982 v: v,
1983 };
1984 try {
1985 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "4e1eb4a5-1970-4228-a682-ec48eb2dca30", routeValues, queryValues);
1986 let url = verData.requestUrl;
1987 let apiVersion = verData.apiVersion;
1988 let accept = this.createAcceptHeader("image/svg+xml", apiVersion);
1989 resolve((yield this.http.get(url, { "Accept": accept })).message);
1990 }
1991 catch (err) {
1992 reject(err);
1993 }
1994 }));
1995 });
1996 }
1997 /**
1998 * Get a work item icon given the friendly name and icon color.
1999 *
2000 * @param {string} icon - The name of the icon
2001 * @param {string} color - The 6-digit hex color for the icon
2002 * @param {number} v - The version of the icon (used only for cache invalidation)
2003 */
2004 getWorkItemIconXaml(icon, color, v) {
2005 return __awaiter(this, void 0, void 0, function* () {
2006 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2007 let routeValues = {
2008 icon: icon
2009 };
2010 let queryValues = {
2011 color: color,
2012 v: v,
2013 };
2014 try {
2015 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "4e1eb4a5-1970-4228-a682-ec48eb2dca30", routeValues, queryValues);
2016 let url = verData.requestUrl;
2017 let apiVersion = verData.apiVersion;
2018 let accept = this.createAcceptHeader("image/xaml+xml", apiVersion);
2019 resolve((yield this.http.get(url, { "Accept": accept })).message);
2020 }
2021 catch (err) {
2022 reject(err);
2023 }
2024 }));
2025 });
2026 }
2027 /**
2028 * Get a batch of work item links
2029 *
2030 * @param {string} project - Project ID or project name
2031 * @param {string[]} linkTypes - A list of types to filter the results to specific link types. Omit this parameter to get work item links of all link types.
2032 * @param {string[]} types - A list of types to filter the results to specific work item types. Omit this parameter to get work item links of all work item types.
2033 * @param {string} continuationToken - Specifies the continuationToken to start the batch from. Omit this parameter to get the first batch of links.
2034 * @param {Date} startDateTime - Date/time to use as a starting point for link changes. Only link changes that occurred after that date/time will be returned. Cannot be used in conjunction with 'watermark' parameter.
2035 */
2036 getReportingLinksByLinkType(project, linkTypes, types, continuationToken, startDateTime) {
2037 return __awaiter(this, void 0, void 0, function* () {
2038 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2039 let routeValues = {
2040 project: project
2041 };
2042 let queryValues = {
2043 linkTypes: linkTypes && linkTypes.join(","),
2044 types: types && types.join(","),
2045 continuationToken: continuationToken,
2046 startDateTime: startDateTime,
2047 };
2048 try {
2049 let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "b5b5b6d0-0308-40a1-b3f4-b9bb3c66878f", routeValues, queryValues);
2050 let url = verData.requestUrl;
2051 let options = this.createRequestOptions('application/json', verData.apiVersion);
2052 let res;
2053 res = yield this.rest.get(url, options);
2054 let ret = this.formatResponse(res.result, null, false);
2055 resolve(ret);
2056 }
2057 catch (err) {
2058 reject(err);
2059 }
2060 }));
2061 });
2062 }
2063 /**
2064 * Gets the work item relation type definition.
2065 *
2066 * @param {string} relation - The relation name
2067 */
2068 getRelationType(relation) {
2069 return __awaiter(this, void 0, void 0, function* () {
2070 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2071 let routeValues = {
2072 relation: relation
2073 };
2074 try {
2075 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "f5d33bc9-5b49-4a3c-a9bd-f3cd46dd2165", routeValues);
2076 let url = verData.requestUrl;
2077 let options = this.createRequestOptions('application/json', verData.apiVersion);
2078 let res;
2079 res = yield this.rest.get(url, options);
2080 let ret = this.formatResponse(res.result, null, false);
2081 resolve(ret);
2082 }
2083 catch (err) {
2084 reject(err);
2085 }
2086 }));
2087 });
2088 }
2089 /**
2090 * Gets the work item relation types.
2091 *
2092 */
2093 getRelationTypes() {
2094 return __awaiter(this, void 0, void 0, function* () {
2095 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2096 let routeValues = {};
2097 try {
2098 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "f5d33bc9-5b49-4a3c-a9bd-f3cd46dd2165", routeValues);
2099 let url = verData.requestUrl;
2100 let options = this.createRequestOptions('application/json', verData.apiVersion);
2101 let res;
2102 res = yield this.rest.get(url, options);
2103 let ret = this.formatResponse(res.result, null, true);
2104 resolve(ret);
2105 }
2106 catch (err) {
2107 reject(err);
2108 }
2109 }));
2110 });
2111 }
2112 /**
2113 * Get a batch of work item revisions with the option of including deleted items
2114 *
2115 * @param {string} project - Project ID or project name
2116 * @param {string[]} fields - A list of fields to return in work item revisions. Omit this parameter to get all reportable fields.
2117 * @param {string[]} types - A list of types to filter the results to specific work item types. Omit this parameter to get work item revisions of all work item types.
2118 * @param {string} continuationToken - Specifies the watermark to start the batch from. Omit this parameter to get the first batch of revisions.
2119 * @param {Date} startDateTime - Date/time to use as a starting point for revisions, all revisions will occur after this date/time. Cannot be used in conjunction with 'watermark' parameter.
2120 * @param {boolean} includeIdentityRef - Return an identity reference instead of a string value for identity fields.
2121 * @param {boolean} includeDeleted - Specify if the deleted item should be returned.
2122 * @param {boolean} includeTagRef - Specify if the tag objects should be returned for System.Tags field.
2123 * @param {boolean} includeLatestOnly - Return only the latest revisions of work items, skipping all historical revisions
2124 * @param {WorkItemTrackingInterfaces.ReportingRevisionsExpand} expand - Return all the fields in work item revisions, including long text fields which are not returned by default
2125 * @param {boolean} includeDiscussionChangesOnly - Return only the those revisions of work items, where only history field was changed
2126 * @param {number} maxPageSize - The maximum number of results to return in this batch
2127 */
2128 readReportingRevisionsGet(project, fields, types, continuationToken, startDateTime, includeIdentityRef, includeDeleted, includeTagRef, includeLatestOnly, expand, includeDiscussionChangesOnly, maxPageSize) {
2129 return __awaiter(this, void 0, void 0, function* () {
2130 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2131 let routeValues = {
2132 project: project
2133 };
2134 let queryValues = {
2135 fields: fields && fields.join(","),
2136 types: types && types.join(","),
2137 continuationToken: continuationToken,
2138 startDateTime: startDateTime,
2139 includeIdentityRef: includeIdentityRef,
2140 includeDeleted: includeDeleted,
2141 includeTagRef: includeTagRef,
2142 includeLatestOnly: includeLatestOnly,
2143 '$expand': expand,
2144 includeDiscussionChangesOnly: includeDiscussionChangesOnly,
2145 '$maxPageSize': maxPageSize,
2146 };
2147 try {
2148 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "f828fe59-dd87-495d-a17c-7a8d6211ca6c", routeValues, queryValues);
2149 let url = verData.requestUrl;
2150 let options = this.createRequestOptions('application/json', verData.apiVersion);
2151 let res;
2152 res = yield this.rest.get(url, options);
2153 let ret = this.formatResponse(res.result, null, false);
2154 resolve(ret);
2155 }
2156 catch (err) {
2157 reject(err);
2158 }
2159 }));
2160 });
2161 }
2162 /**
2163 * Get a batch of work item revisions. This request may be used if your list of fields is large enough that it may run the URL over the length limit.
2164 *
2165 * @param {WorkItemTrackingInterfaces.ReportingWorkItemRevisionsFilter} filter - An object that contains request settings: field filter, type filter, identity format
2166 * @param {string} project - Project ID or project name
2167 * @param {string} continuationToken - Specifies the watermark to start the batch from. Omit this parameter to get the first batch of revisions.
2168 * @param {Date} startDateTime - Date/time to use as a starting point for revisions, all revisions will occur after this date/time. Cannot be used in conjunction with 'watermark' parameter.
2169 * @param {WorkItemTrackingInterfaces.ReportingRevisionsExpand} expand
2170 */
2171 readReportingRevisionsPost(filter, project, continuationToken, startDateTime, expand) {
2172 return __awaiter(this, void 0, void 0, function* () {
2173 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2174 let routeValues = {
2175 project: project
2176 };
2177 let queryValues = {
2178 continuationToken: continuationToken,
2179 startDateTime: startDateTime,
2180 '$expand': expand,
2181 };
2182 try {
2183 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "f828fe59-dd87-495d-a17c-7a8d6211ca6c", routeValues, queryValues);
2184 let url = verData.requestUrl;
2185 let options = this.createRequestOptions('application/json', verData.apiVersion);
2186 let res;
2187 res = yield this.rest.create(url, filter, options);
2188 let ret = this.formatResponse(res.result, null, false);
2189 resolve(ret);
2190 }
2191 catch (err) {
2192 reject(err);
2193 }
2194 }));
2195 });
2196 }
2197 /**
2198 * @param {string} project - Project ID or project name
2199 * @param {string} continuationToken
2200 * @param {number} maxPageSize
2201 */
2202 readReportingDiscussions(project, continuationToken, maxPageSize) {
2203 return __awaiter(this, void 0, void 0, function* () {
2204 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2205 let routeValues = {
2206 project: project
2207 };
2208 let queryValues = {
2209 continuationToken: continuationToken,
2210 '$maxPageSize': maxPageSize,
2211 };
2212 try {
2213 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "4a644469-90c5-4fcc-9a9f-be0827d369ec", routeValues, queryValues);
2214 let url = verData.requestUrl;
2215 let options = this.createRequestOptions('application/json', verData.apiVersion);
2216 let res;
2217 res = yield this.rest.get(url, options);
2218 let ret = this.formatResponse(res.result, null, false);
2219 resolve(ret);
2220 }
2221 catch (err) {
2222 reject(err);
2223 }
2224 }));
2225 });
2226 }
2227 /**
2228 * Creates a single work item.
2229 *
2230 * @param {VSSInterfaces.JsonPatchDocument} document - The JSON Patch document representing the work item
2231 * @param {string} project - Project ID or project name
2232 * @param {string} type - The work item type of the work item to create
2233 * @param {boolean} validateOnly - Indicate if you only want to validate the changes without saving the work item
2234 * @param {boolean} bypassRules - Do not enforce the work item type rules on this update
2235 * @param {boolean} suppressNotifications - Do not fire any notifications for this change
2236 * @param {WorkItemTrackingInterfaces.WorkItemExpand} expand - The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }.
2237 */
2238 createWorkItem(customHeaders, document, project, type, validateOnly, bypassRules, suppressNotifications, expand) {
2239 return __awaiter(this, void 0, void 0, function* () {
2240 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2241 let routeValues = {
2242 project: project,
2243 type: type
2244 };
2245 let queryValues = {
2246 validateOnly: validateOnly,
2247 bypassRules: bypassRules,
2248 suppressNotifications: suppressNotifications,
2249 '$expand': expand,
2250 };
2251 customHeaders = customHeaders || {};
2252 customHeaders["Content-Type"] = "application/json-patch+json";
2253 try {
2254 let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "62d3d110-0047-428c-ad3c-4fe872c91c74", routeValues, queryValues);
2255 let url = verData.requestUrl;
2256 let options = this.createRequestOptions('application/json', verData.apiVersion);
2257 options.additionalHeaders = customHeaders;
2258 let res;
2259 res = yield this.rest.create(url, document, options);
2260 let ret = this.formatResponse(res.result, null, false);
2261 resolve(ret);
2262 }
2263 catch (err) {
2264 reject(err);
2265 }
2266 }));
2267 });
2268 }
2269 /**
2270 * Returns a single work item from a template.
2271 *
2272 * @param {string} project - Project ID or project name
2273 * @param {string} type - The work item type name
2274 * @param {string} fields - Comma-separated list of requested fields
2275 * @param {Date} asOf - AsOf UTC date time string
2276 * @param {WorkItemTrackingInterfaces.WorkItemExpand} expand - The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }.
2277 */
2278 getWorkItemTemplate(project, type, fields, asOf, expand) {
2279 return __awaiter(this, void 0, void 0, function* () {
2280 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2281 let routeValues = {
2282 project: project,
2283 type: type
2284 };
2285 let queryValues = {
2286 fields: fields,
2287 asOf: asOf,
2288 '$expand': expand,
2289 };
2290 try {
2291 let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "62d3d110-0047-428c-ad3c-4fe872c91c74", routeValues, queryValues);
2292 let url = verData.requestUrl;
2293 let options = this.createRequestOptions('application/json', verData.apiVersion);
2294 let res;
2295 res = yield this.rest.get(url, options);
2296 let ret = this.formatResponse(res.result, null, false);
2297 resolve(ret);
2298 }
2299 catch (err) {
2300 reject(err);
2301 }
2302 }));
2303 });
2304 }
2305 /**
2306 * Deletes the specified work item and sends it to the Recycle Bin, so that it can be restored back, if required. Optionally, if the destroy parameter has been set to true, it destroys the work item permanently. WARNING: If the destroy parameter is set to true, work items deleted by this command will NOT go to recycle-bin and there is no way to restore/recover them after deletion. It is recommended NOT to use this parameter. If you do, please use this parameter with extreme caution.
2307 *
2308 * @param {number} id - ID of the work item to be deleted
2309 * @param {string} project - Project ID or project name
2310 * @param {boolean} destroy - Optional parameter, if set to true, the work item is deleted permanently. Please note: the destroy action is PERMANENT and cannot be undone.
2311 */
2312 deleteWorkItem(id, project, destroy) {
2313 return __awaiter(this, void 0, void 0, function* () {
2314 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2315 let routeValues = {
2316 project: project,
2317 id: id
2318 };
2319 let queryValues = {
2320 destroy: destroy,
2321 };
2322 try {
2323 let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "72c7ddf8-2cdc-4f60-90cd-ab71c14a399b", routeValues, queryValues);
2324 let url = verData.requestUrl;
2325 let options = this.createRequestOptions('application/json', verData.apiVersion);
2326 let res;
2327 res = yield this.rest.del(url, options);
2328 let ret = this.formatResponse(res.result, null, false);
2329 resolve(ret);
2330 }
2331 catch (err) {
2332 reject(err);
2333 }
2334 }));
2335 });
2336 }
2337 /**
2338 * Returns a single work item.
2339 *
2340 * @param {number} id - The work item id
2341 * @param {string[]} fields - Comma-separated list of requested fields
2342 * @param {Date} asOf - AsOf UTC date time string
2343 * @param {WorkItemTrackingInterfaces.WorkItemExpand} expand - The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }.
2344 * @param {string} project - Project ID or project name
2345 */
2346 getWorkItem(id, fields, asOf, expand, project) {
2347 return __awaiter(this, void 0, void 0, function* () {
2348 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2349 let routeValues = {
2350 project: project,
2351 id: id
2352 };
2353 let queryValues = {
2354 fields: fields && fields.join(","),
2355 asOf: asOf,
2356 '$expand': expand,
2357 };
2358 try {
2359 let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "72c7ddf8-2cdc-4f60-90cd-ab71c14a399b", routeValues, queryValues);
2360 let url = verData.requestUrl;
2361 let options = this.createRequestOptions('application/json', verData.apiVersion);
2362 let res;
2363 res = yield this.rest.get(url, options);
2364 let ret = this.formatResponse(res.result, null, false);
2365 resolve(ret);
2366 }
2367 catch (err) {
2368 reject(err);
2369 }
2370 }));
2371 });
2372 }
2373 /**
2374 * Returns a list of work items (Maximum 200)
2375 *
2376 * @param {number[]} ids - The comma-separated list of requested work item ids. (Maximum 200 ids allowed).
2377 * @param {string[]} fields - Comma-separated list of requested fields
2378 * @param {Date} asOf - AsOf UTC date time string
2379 * @param {WorkItemTrackingInterfaces.WorkItemExpand} expand - The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }.
2380 * @param {WorkItemTrackingInterfaces.WorkItemErrorPolicy} errorPolicy - The flag to control error policy in a bulk get work items request. Possible options are {Fail, Omit}.
2381 * @param {string} project - Project ID or project name
2382 */
2383 getWorkItems(ids, fields, asOf, expand, errorPolicy, project) {
2384 return __awaiter(this, void 0, void 0, function* () {
2385 if (ids == null) {
2386 throw new TypeError('ids can not be null or undefined');
2387 }
2388 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2389 let routeValues = {
2390 project: project
2391 };
2392 let queryValues = {
2393 ids: ids && ids.join(","),
2394 fields: fields && fields.join(","),
2395 asOf: asOf,
2396 '$expand': expand,
2397 errorPolicy: errorPolicy,
2398 };
2399 try {
2400 let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "72c7ddf8-2cdc-4f60-90cd-ab71c14a399b", routeValues, queryValues);
2401 let url = verData.requestUrl;
2402 let options = this.createRequestOptions('application/json', verData.apiVersion);
2403 let res;
2404 res = yield this.rest.get(url, options);
2405 let ret = this.formatResponse(res.result, null, true);
2406 resolve(ret);
2407 }
2408 catch (err) {
2409 reject(err);
2410 }
2411 }));
2412 });
2413 }
2414 /**
2415 * Updates a single work item.
2416 *
2417 * @param {VSSInterfaces.JsonPatchDocument} document - The JSON Patch document representing the update
2418 * @param {number} id - The id of the work item to update
2419 * @param {string} project - Project ID or project name
2420 * @param {boolean} validateOnly - Indicate if you only want to validate the changes without saving the work item
2421 * @param {boolean} bypassRules - Do not enforce the work item type rules on this update
2422 * @param {boolean} suppressNotifications - Do not fire any notifications for this change
2423 * @param {WorkItemTrackingInterfaces.WorkItemExpand} expand - The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }.
2424 */
2425 updateWorkItem(customHeaders, document, id, project, validateOnly, bypassRules, suppressNotifications, expand) {
2426 return __awaiter(this, void 0, void 0, function* () {
2427 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2428 let routeValues = {
2429 project: project,
2430 id: id
2431 };
2432 let queryValues = {
2433 validateOnly: validateOnly,
2434 bypassRules: bypassRules,
2435 suppressNotifications: suppressNotifications,
2436 '$expand': expand,
2437 };
2438 customHeaders = customHeaders || {};
2439 customHeaders["Content-Type"] = "application/json-patch+json";
2440 try {
2441 let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "72c7ddf8-2cdc-4f60-90cd-ab71c14a399b", routeValues, queryValues);
2442 let url = verData.requestUrl;
2443 let options = this.createRequestOptions('application/json', verData.apiVersion);
2444 options.additionalHeaders = customHeaders;
2445 let res;
2446 res = yield this.rest.update(url, document, options);
2447 let ret = this.formatResponse(res.result, null, false);
2448 resolve(ret);
2449 }
2450 catch (err) {
2451 reject(err);
2452 }
2453 }));
2454 });
2455 }
2456 /**
2457 * Gets work items for a list of work item ids (Maximum 200)
2458 *
2459 * @param {WorkItemTrackingInterfaces.WorkItemBatchGetRequest} workItemGetRequest
2460 * @param {string} project - Project ID or project name
2461 */
2462 getWorkItemsBatch(workItemGetRequest, project) {
2463 return __awaiter(this, void 0, void 0, function* () {
2464 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2465 let routeValues = {
2466 project: project
2467 };
2468 try {
2469 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "908509b6-4248-4475-a1cd-829139ba419f", routeValues);
2470 let url = verData.requestUrl;
2471 let options = this.createRequestOptions('application/json', verData.apiVersion);
2472 let res;
2473 res = yield this.rest.create(url, workItemGetRequest, options);
2474 let ret = this.formatResponse(res.result, null, true);
2475 resolve(ret);
2476 }
2477 catch (err) {
2478 reject(err);
2479 }
2480 }));
2481 });
2482 }
2483 /**
2484 * INTERNAL ONLY: It will be used for My account work experience. Get the work item type state color for multiple projects
2485 *
2486 * @param {string[]} projectNames
2487 */
2488 getWorkItemStateColors(projectNames) {
2489 return __awaiter(this, void 0, void 0, function* () {
2490 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2491 let routeValues = {};
2492 try {
2493 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "0b83df8a-3496-4ddb-ba44-63634f4cda61", routeValues);
2494 let url = verData.requestUrl;
2495 let options = this.createRequestOptions('application/json', verData.apiVersion);
2496 let res;
2497 res = yield this.rest.create(url, projectNames, options);
2498 let ret = this.formatResponse(res.result, null, true);
2499 resolve(ret);
2500 }
2501 catch (err) {
2502 reject(err);
2503 }
2504 }));
2505 });
2506 }
2507 /**
2508 * Returns the next state on the given work item IDs.
2509 *
2510 * @param {number[]} ids - list of work item ids
2511 * @param {string} action - possible actions. Currently only supports checkin
2512 */
2513 getWorkItemNextStatesOnCheckinAction(ids, action) {
2514 return __awaiter(this, void 0, void 0, function* () {
2515 if (ids == null) {
2516 throw new TypeError('ids can not be null or undefined');
2517 }
2518 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2519 let routeValues = {};
2520 let queryValues = {
2521 ids: ids && ids.join(","),
2522 action: action,
2523 };
2524 try {
2525 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "afae844b-e2f6-44c2-8053-17b3bb936a40", routeValues, queryValues);
2526 let url = verData.requestUrl;
2527 let options = this.createRequestOptions('application/json', verData.apiVersion);
2528 let res;
2529 res = yield this.rest.get(url, options);
2530 let ret = this.formatResponse(res.result, null, true);
2531 resolve(ret);
2532 }
2533 catch (err) {
2534 reject(err);
2535 }
2536 }));
2537 });
2538 }
2539 /**
2540 * Get all work item type categories.
2541 *
2542 * @param {string} project - Project ID or project name
2543 */
2544 getWorkItemTypeCategories(project) {
2545 return __awaiter(this, void 0, void 0, function* () {
2546 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2547 let routeValues = {
2548 project: project
2549 };
2550 try {
2551 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "9b9f5734-36c8-415e-ba67-f83b45c31408", routeValues);
2552 let url = verData.requestUrl;
2553 let options = this.createRequestOptions('application/json', verData.apiVersion);
2554 let res;
2555 res = yield this.rest.get(url, options);
2556 let ret = this.formatResponse(res.result, null, true);
2557 resolve(ret);
2558 }
2559 catch (err) {
2560 reject(err);
2561 }
2562 }));
2563 });
2564 }
2565 /**
2566 * Get specific work item type category by name.
2567 *
2568 * @param {string} project - Project ID or project name
2569 * @param {string} category - The category name
2570 */
2571 getWorkItemTypeCategory(project, category) {
2572 return __awaiter(this, void 0, void 0, function* () {
2573 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2574 let routeValues = {
2575 project: project,
2576 category: category
2577 };
2578 try {
2579 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "9b9f5734-36c8-415e-ba67-f83b45c31408", routeValues);
2580 let url = verData.requestUrl;
2581 let options = this.createRequestOptions('application/json', verData.apiVersion);
2582 let res;
2583 res = yield this.rest.get(url, options);
2584 let ret = this.formatResponse(res.result, null, false);
2585 resolve(ret);
2586 }
2587 catch (err) {
2588 reject(err);
2589 }
2590 }));
2591 });
2592 }
2593 /**
2594 * INTERNAL ONLY: It will be used for My account work experience. Get the wit type color for multiple projects
2595 *
2596 * @param {string[]} projectNames
2597 */
2598 getWorkItemTypeColors(projectNames) {
2599 return __awaiter(this, void 0, void 0, function* () {
2600 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2601 let routeValues = {};
2602 try {
2603 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "958fde80-115e-43fb-bd65-749c48057faf", routeValues);
2604 let url = verData.requestUrl;
2605 let options = this.createRequestOptions('application/json', verData.apiVersion);
2606 let res;
2607 res = yield this.rest.create(url, projectNames, options);
2608 let ret = this.formatResponse(res.result, null, true);
2609 resolve(ret);
2610 }
2611 catch (err) {
2612 reject(err);
2613 }
2614 }));
2615 });
2616 }
2617 /**
2618 * INTERNAL ONLY: It is used for color and icon providers. Get the wit type color for multiple projects
2619 *
2620 * @param {string[]} projectNames
2621 */
2622 getWorkItemTypeColorAndIcons(projectNames) {
2623 return __awaiter(this, void 0, void 0, function* () {
2624 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2625 let routeValues = {};
2626 try {
2627 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "f0f8dc62-3975-48ce-8051-f636b68b52e3", routeValues);
2628 let url = verData.requestUrl;
2629 let options = this.createRequestOptions('application/json', verData.apiVersion);
2630 let res;
2631 res = yield this.rest.create(url, projectNames, options);
2632 let ret = this.formatResponse(res.result, null, true);
2633 resolve(ret);
2634 }
2635 catch (err) {
2636 reject(err);
2637 }
2638 }));
2639 });
2640 }
2641 /**
2642 * Returns a work item type definition.
2643 *
2644 * @param {string} project - Project ID or project name
2645 * @param {string} type - Work item type name
2646 */
2647 getWorkItemType(project, type) {
2648 return __awaiter(this, void 0, void 0, function* () {
2649 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2650 let routeValues = {
2651 project: project,
2652 type: type
2653 };
2654 try {
2655 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "7c8d7a76-4a09-43e8-b5df-bd792f4ac6aa", routeValues);
2656 let url = verData.requestUrl;
2657 let options = this.createRequestOptions('application/json', verData.apiVersion);
2658 let res;
2659 res = yield this.rest.get(url, options);
2660 let ret = this.formatResponse(res.result, null, false);
2661 resolve(ret);
2662 }
2663 catch (err) {
2664 reject(err);
2665 }
2666 }));
2667 });
2668 }
2669 /**
2670 * Returns the list of work item types
2671 *
2672 * @param {string} project - Project ID or project name
2673 */
2674 getWorkItemTypes(project) {
2675 return __awaiter(this, void 0, void 0, function* () {
2676 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2677 let routeValues = {
2678 project: project
2679 };
2680 try {
2681 let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "7c8d7a76-4a09-43e8-b5df-bd792f4ac6aa", routeValues);
2682 let url = verData.requestUrl;
2683 let options = this.createRequestOptions('application/json', verData.apiVersion);
2684 let res;
2685 res = yield this.rest.get(url, options);
2686 let ret = this.formatResponse(res.result, null, true);
2687 resolve(ret);
2688 }
2689 catch (err) {
2690 reject(err);
2691 }
2692 }));
2693 });
2694 }
2695 /**
2696 * Get a list of fields for a work item type with detailed references.
2697 *
2698 * @param {string} project - Project ID or project name
2699 * @param {string} type - Work item type.
2700 * @param {WorkItemTrackingInterfaces.WorkItemTypeFieldsExpandLevel} expand - Expand level for the API response. Properties: to include allowedvalues, default value, isRequired etc. as a part of response; None: to skip these properties.
2701 */
2702 getWorkItemTypeFieldsWithReferences(project, type, expand) {
2703 return __awaiter(this, void 0, void 0, function* () {
2704 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2705 let routeValues = {
2706 project: project,
2707 type: type
2708 };
2709 let queryValues = {
2710 '$expand': expand,
2711 };
2712 try {
2713 let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "bd293ce5-3d25-4192-8e67-e8092e879efb", routeValues, queryValues);
2714 let url = verData.requestUrl;
2715 let options = this.createRequestOptions('application/json', verData.apiVersion);
2716 let res;
2717 res = yield this.rest.get(url, options);
2718 let ret = this.formatResponse(res.result, null, true);
2719 resolve(ret);
2720 }
2721 catch (err) {
2722 reject(err);
2723 }
2724 }));
2725 });
2726 }
2727 /**
2728 * Get a field for a work item type with detailed references.
2729 *
2730 * @param {string} project - Project ID or project name
2731 * @param {string} type - Work item type.
2732 * @param {string} field
2733 * @param {WorkItemTrackingInterfaces.WorkItemTypeFieldsExpandLevel} expand - Expand level for the API response. Properties: to include allowedvalues, default value, isRequired etc. as a part of response; None: to skip these properties.
2734 */
2735 getWorkItemTypeFieldWithReferences(project, type, field, expand) {
2736 return __awaiter(this, void 0, void 0, function* () {
2737 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2738 let routeValues = {
2739 project: project,
2740 type: type,
2741 field: field
2742 };
2743 let queryValues = {
2744 '$expand': expand,
2745 };
2746 try {
2747 let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "bd293ce5-3d25-4192-8e67-e8092e879efb", routeValues, queryValues);
2748 let url = verData.requestUrl;
2749 let options = this.createRequestOptions('application/json', verData.apiVersion);
2750 let res;
2751 res = yield this.rest.get(url, options);
2752 let ret = this.formatResponse(res.result, null, false);
2753 resolve(ret);
2754 }
2755 catch (err) {
2756 reject(err);
2757 }
2758 }));
2759 });
2760 }
2761 /**
2762 * Returns the state names and colors for a work item type.
2763 *
2764 * @param {string} project - Project ID or project name
2765 * @param {string} type - The state name
2766 */
2767 getWorkItemTypeStates(project, type) {
2768 return __awaiter(this, void 0, void 0, function* () {
2769 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2770 let routeValues = {
2771 project: project,
2772 type: type
2773 };
2774 try {
2775 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "7c9d7a76-4a09-43e8-b5df-bd792f4ac6aa", routeValues);
2776 let url = verData.requestUrl;
2777 let options = this.createRequestOptions('application/json', verData.apiVersion);
2778 let res;
2779 res = yield this.rest.get(url, options);
2780 let ret = this.formatResponse(res.result, null, true);
2781 resolve(ret);
2782 }
2783 catch (err) {
2784 reject(err);
2785 }
2786 }));
2787 });
2788 }
2789 /**
2790 * Export work item type
2791 *
2792 * @param {string} project - Project ID or project name
2793 * @param {string} type
2794 * @param {boolean} exportGlobalLists
2795 */
2796 exportWorkItemTypeDefinition(project, type, exportGlobalLists) {
2797 return __awaiter(this, void 0, void 0, function* () {
2798 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2799 let routeValues = {
2800 project: project,
2801 type: type
2802 };
2803 let queryValues = {
2804 exportGlobalLists: exportGlobalLists,
2805 };
2806 try {
2807 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "8637ac8b-5eb6-4f90-b3f7-4f2ff576a459", routeValues, queryValues);
2808 let url = verData.requestUrl;
2809 let options = this.createRequestOptions('application/json', verData.apiVersion);
2810 let res;
2811 res = yield this.rest.get(url, options);
2812 let ret = this.formatResponse(res.result, null, false);
2813 resolve(ret);
2814 }
2815 catch (err) {
2816 reject(err);
2817 }
2818 }));
2819 });
2820 }
2821 /**
2822 * Add/updates a work item type
2823 *
2824 * @param {WorkItemTrackingInterfaces.WorkItemTypeTemplateUpdateModel} updateModel
2825 * @param {string} project - Project ID or project name
2826 */
2827 updateWorkItemTypeDefinition(updateModel, project) {
2828 return __awaiter(this, void 0, void 0, function* () {
2829 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2830 let routeValues = {
2831 project: project
2832 };
2833 try {
2834 let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "8637ac8b-5eb6-4f90-b3f7-4f2ff576a459", routeValues);
2835 let url = verData.requestUrl;
2836 let options = this.createRequestOptions('application/json', verData.apiVersion);
2837 let res;
2838 res = yield this.rest.create(url, updateModel, options);
2839 let ret = this.formatResponse(res.result, null, false);
2840 resolve(ret);
2841 }
2842 catch (err) {
2843 reject(err);
2844 }
2845 }));
2846 });
2847 }
2848}
2849exports.WorkItemTrackingApi = WorkItemTrackingApi;
2850WorkItemTrackingApi.RESOURCE_AREA_ID = "5264459e-e5e0-4bd8-b118-0985e68a4ec5";