UNPKG

88 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.WorkApi = void 0;
22const basem = require("./ClientApiBases");
23const WorkInterfaces = require("./interfaces/WorkInterfaces");
24class WorkApi extends basem.ClientApiBase {
25 constructor(baseUrl, handlers, options) {
26 super(baseUrl, handlers, 'node-Work-api', options);
27 }
28 /**
29 * Creates/updates an automation rules settings
30 *
31 * @param {WorkInterfaces.TeamAutomationRulesSettingsRequestModel} ruleRequestModel - Required parameters to create/update an automation rules settings
32 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
33 */
34 updateAutomationRule(ruleRequestModel, teamContext) {
35 return __awaiter(this, void 0, void 0, function* () {
36 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
37 let project = null;
38 let team = null;
39 if (teamContext) {
40 project = teamContext.projectId || teamContext.project;
41 team = teamContext.teamId || teamContext.team;
42 }
43 let routeValues = {
44 project: project,
45 team: team
46 };
47 try {
48 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "work", "2882c15d-0cb3-43b5-8fb7-db62e09a79db", routeValues);
49 let url = verData.requestUrl;
50 let options = this.createRequestOptions('application/json', verData.apiVersion);
51 let res;
52 res = yield this.rest.update(url, ruleRequestModel, options);
53 let ret = this.formatResponse(res.result, null, false);
54 resolve(ret);
55 }
56 catch (err) {
57 reject(err);
58 }
59 }));
60 });
61 }
62 /**
63 * Gets backlog configuration for a team
64 *
65 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
66 */
67 getBacklogConfigurations(teamContext) {
68 return __awaiter(this, void 0, void 0, function* () {
69 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
70 let project = null;
71 let team = null;
72 if (teamContext) {
73 project = teamContext.projectId || teamContext.project;
74 team = teamContext.teamId || teamContext.team;
75 }
76 let routeValues = {
77 project: project,
78 team: team
79 };
80 try {
81 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "7799f497-3cb5-4f16-ad4f-5cd06012db64", routeValues);
82 let url = verData.requestUrl;
83 let options = this.createRequestOptions('application/json', verData.apiVersion);
84 let res;
85 res = yield this.rest.get(url, options);
86 let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.BacklogConfiguration, false);
87 resolve(ret);
88 }
89 catch (err) {
90 reject(err);
91 }
92 }));
93 });
94 }
95 /**
96 * Get a list of work items within a backlog level
97 *
98 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
99 * @param {string} backlogId
100 */
101 getBacklogLevelWorkItems(teamContext, backlogId) {
102 return __awaiter(this, void 0, void 0, function* () {
103 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
104 let project = null;
105 let team = null;
106 if (teamContext) {
107 project = teamContext.projectId || teamContext.project;
108 team = teamContext.teamId || teamContext.team;
109 }
110 let routeValues = {
111 project: project,
112 team: team,
113 backlogId: backlogId
114 };
115 try {
116 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "7c468d96-ab1d-4294-a360-92f07e9ccd98", routeValues);
117 let url = verData.requestUrl;
118 let options = this.createRequestOptions('application/json', verData.apiVersion);
119 let res;
120 res = yield this.rest.get(url, options);
121 let ret = this.formatResponse(res.result, null, false);
122 resolve(ret);
123 }
124 catch (err) {
125 reject(err);
126 }
127 }));
128 });
129 }
130 /**
131 * Get a backlog level
132 *
133 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
134 * @param {string} id - The id of the backlog level
135 */
136 getBacklog(teamContext, id) {
137 return __awaiter(this, void 0, void 0, function* () {
138 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
139 let project = null;
140 let team = null;
141 if (teamContext) {
142 project = teamContext.projectId || teamContext.project;
143 team = teamContext.teamId || teamContext.team;
144 }
145 let routeValues = {
146 project: project,
147 team: team,
148 id: id
149 };
150 try {
151 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "a93726f9-7867-4e38-b4f2-0bfafc2f6a94", routeValues);
152 let url = verData.requestUrl;
153 let options = this.createRequestOptions('application/json', verData.apiVersion);
154 let res;
155 res = yield this.rest.get(url, options);
156 let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.BacklogLevelConfiguration, false);
157 resolve(ret);
158 }
159 catch (err) {
160 reject(err);
161 }
162 }));
163 });
164 }
165 /**
166 * List all backlog levels
167 *
168 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
169 */
170 getBacklogs(teamContext) {
171 return __awaiter(this, void 0, void 0, function* () {
172 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
173 let project = null;
174 let team = null;
175 if (teamContext) {
176 project = teamContext.projectId || teamContext.project;
177 team = teamContext.teamId || teamContext.team;
178 }
179 let routeValues = {
180 project: project,
181 team: team
182 };
183 try {
184 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "a93726f9-7867-4e38-b4f2-0bfafc2f6a94", routeValues);
185 let url = verData.requestUrl;
186 let options = this.createRequestOptions('application/json', verData.apiVersion);
187 let res;
188 res = yield this.rest.get(url, options);
189 let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.BacklogLevelConfiguration, true);
190 resolve(ret);
191 }
192 catch (err) {
193 reject(err);
194 }
195 }));
196 });
197 }
198 /**
199 * Gets a badge that displays the status of columns on the board.
200 *
201 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
202 * @param {string} id - The id of the board.
203 * @param {WorkInterfaces.BoardBadgeColumnOptions} columnOptions - Determines what columns to show.
204 * @param {string[]} columns - If columnOptions is set to custom, specify the list of column names.
205 */
206 getBoardBadge(teamContext, id, columnOptions, columns) {
207 return __awaiter(this, void 0, void 0, function* () {
208 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
209 let project = null;
210 let team = null;
211 if (teamContext) {
212 project = teamContext.projectId || teamContext.project;
213 team = teamContext.teamId || teamContext.team;
214 }
215 let routeValues = {
216 project: project,
217 team: team,
218 id: id
219 };
220 let queryValues = {
221 columnOptions: columnOptions,
222 columns: columns && columns.join(","),
223 };
224 try {
225 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "0120b002-ab6c-4ca0-98cf-a8d7492f865c", routeValues, queryValues);
226 let url = verData.requestUrl;
227 let options = this.createRequestOptions('application/json', verData.apiVersion);
228 let res;
229 res = yield this.rest.get(url, options);
230 let ret = this.formatResponse(res.result, null, false);
231 resolve(ret);
232 }
233 catch (err) {
234 reject(err);
235 }
236 }));
237 });
238 }
239 /**
240 * Gets a badge that displays the status of columns on the board.
241 *
242 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
243 * @param {string} id - The id of the board.
244 * @param {WorkInterfaces.BoardBadgeColumnOptions} columnOptions - Determines what columns to show.
245 * @param {string[]} columns - If columnOptions is set to custom, specify the list of column names.
246 */
247 getBoardBadgeData(teamContext, id, columnOptions, columns) {
248 return __awaiter(this, void 0, void 0, function* () {
249 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
250 let project = null;
251 let team = null;
252 if (teamContext) {
253 project = teamContext.projectId || teamContext.project;
254 team = teamContext.teamId || teamContext.team;
255 }
256 let routeValues = {
257 project: project,
258 team: team,
259 id: id
260 };
261 let queryValues = {
262 columnOptions: columnOptions,
263 columns: columns && columns.join(","),
264 };
265 try {
266 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "0120b002-ab6c-4ca0-98cf-a8d7492f865c", routeValues, queryValues);
267 let url = verData.requestUrl;
268 let options = this.createRequestOptions('application/json', verData.apiVersion);
269 let res;
270 res = yield this.rest.get(url, options);
271 let ret = this.formatResponse(res.result, null, false);
272 resolve(ret);
273 }
274 catch (err) {
275 reject(err);
276 }
277 }));
278 });
279 }
280 /**
281 * Get available board columns in a project
282 *
283 * @param {string} project - Project ID or project name
284 */
285 getColumnSuggestedValues(project) {
286 return __awaiter(this, void 0, void 0, function* () {
287 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
288 let routeValues = {
289 project: project
290 };
291 try {
292 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "eb7ec5a3-1ba3-4fd1-b834-49a5a387e57d", routeValues);
293 let url = verData.requestUrl;
294 let options = this.createRequestOptions('application/json', verData.apiVersion);
295 let res;
296 res = yield this.rest.get(url, options);
297 let ret = this.formatResponse(res.result, null, true);
298 resolve(ret);
299 }
300 catch (err) {
301 reject(err);
302 }
303 }));
304 });
305 }
306 /**
307 * Returns the list of parent field filter model for the given list of workitem ids
308 *
309 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
310 * @param {string} childBacklogContextCategoryRefName
311 * @param {number[]} workitemIds
312 */
313 getBoardMappingParentItems(teamContext, childBacklogContextCategoryRefName, workitemIds) {
314 return __awaiter(this, void 0, void 0, function* () {
315 if (childBacklogContextCategoryRefName == null) {
316 throw new TypeError('childBacklogContextCategoryRefName can not be null or undefined');
317 }
318 if (workitemIds == null) {
319 throw new TypeError('workitemIds can not be null or undefined');
320 }
321 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
322 let project = null;
323 let team = null;
324 if (teamContext) {
325 project = teamContext.projectId || teamContext.project;
326 team = teamContext.teamId || teamContext.team;
327 }
328 let routeValues = {
329 project: project,
330 team: team
331 };
332 let queryValues = {
333 childBacklogContextCategoryRefName: childBacklogContextCategoryRefName,
334 workitemIds: workitemIds && workitemIds.join(","),
335 };
336 try {
337 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "186abea3-5c35-432f-9e28-7a15b4312a0e", routeValues, queryValues);
338 let url = verData.requestUrl;
339 let options = this.createRequestOptions('application/json', verData.apiVersion);
340 let res;
341 res = yield this.rest.get(url, options);
342 let ret = this.formatResponse(res.result, null, true);
343 resolve(ret);
344 }
345 catch (err) {
346 reject(err);
347 }
348 }));
349 });
350 }
351 /**
352 * Get available board rows in a project
353 *
354 * @param {string} project - Project ID or project name
355 */
356 getRowSuggestedValues(project) {
357 return __awaiter(this, void 0, void 0, function* () {
358 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
359 let routeValues = {
360 project: project
361 };
362 try {
363 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "bb494cc6-a0f5-4c6c-8dca-ea6912e79eb9", routeValues);
364 let url = verData.requestUrl;
365 let options = this.createRequestOptions('application/json', verData.apiVersion);
366 let res;
367 res = yield this.rest.get(url, options);
368 let ret = this.formatResponse(res.result, null, true);
369 resolve(ret);
370 }
371 catch (err) {
372 reject(err);
373 }
374 }));
375 });
376 }
377 /**
378 * Get board
379 *
380 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
381 * @param {string} id - identifier for board, either board's backlog level name (Eg:"Stories") or Id
382 */
383 getBoard(teamContext, id) {
384 return __awaiter(this, void 0, void 0, function* () {
385 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
386 let project = null;
387 let team = null;
388 if (teamContext) {
389 project = teamContext.projectId || teamContext.project;
390 team = teamContext.teamId || teamContext.team;
391 }
392 let routeValues = {
393 project: project,
394 team: team,
395 id: id
396 };
397 try {
398 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "23ad19fc-3b8e-4877-8462-b3f92bc06b40", routeValues);
399 let url = verData.requestUrl;
400 let options = this.createRequestOptions('application/json', verData.apiVersion);
401 let res;
402 res = yield this.rest.get(url, options);
403 let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.Board, false);
404 resolve(ret);
405 }
406 catch (err) {
407 reject(err);
408 }
409 }));
410 });
411 }
412 /**
413 * Get boards
414 *
415 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
416 */
417 getBoards(teamContext) {
418 return __awaiter(this, void 0, void 0, function* () {
419 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
420 let project = null;
421 let team = null;
422 if (teamContext) {
423 project = teamContext.projectId || teamContext.project;
424 team = teamContext.teamId || teamContext.team;
425 }
426 let routeValues = {
427 project: project,
428 team: team
429 };
430 try {
431 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "23ad19fc-3b8e-4877-8462-b3f92bc06b40", routeValues);
432 let url = verData.requestUrl;
433 let options = this.createRequestOptions('application/json', verData.apiVersion);
434 let res;
435 res = yield this.rest.get(url, options);
436 let ret = this.formatResponse(res.result, null, true);
437 resolve(ret);
438 }
439 catch (err) {
440 reject(err);
441 }
442 }));
443 });
444 }
445 /**
446 * Update board options
447 *
448 * @param {{ [key: string] : string; }} options - options to updated
449 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
450 * @param {string} id - identifier for board, either category plural name (Eg:"Stories") or guid
451 */
452 setBoardOptions(options, teamContext, id) {
453 return __awaiter(this, void 0, void 0, function* () {
454 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
455 let project = null;
456 let team = null;
457 if (teamContext) {
458 project = teamContext.projectId || teamContext.project;
459 team = teamContext.teamId || teamContext.team;
460 }
461 let routeValues = {
462 project: project,
463 team: team,
464 id: id
465 };
466 try {
467 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "23ad19fc-3b8e-4877-8462-b3f92bc06b40", routeValues);
468 let url = verData.requestUrl;
469 let options = this.createRequestOptions('application/json', verData.apiVersion);
470 let res;
471 res = yield this.rest.replace(url, options, options);
472 let ret = this.formatResponse(res.result, null, true);
473 resolve(ret);
474 }
475 catch (err) {
476 reject(err);
477 }
478 }));
479 });
480 }
481 /**
482 * Get board user settings for a board id
483 *
484 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
485 * @param {string} board - Board ID or Name
486 */
487 getBoardUserSettings(teamContext, board) {
488 return __awaiter(this, void 0, void 0, function* () {
489 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
490 let project = null;
491 let team = null;
492 if (teamContext) {
493 project = teamContext.projectId || teamContext.project;
494 team = teamContext.teamId || teamContext.team;
495 }
496 let routeValues = {
497 project: project,
498 team: team,
499 board: board
500 };
501 try {
502 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "b30d9f58-1891-4b0a-b168-c46408f919b0", routeValues);
503 let url = verData.requestUrl;
504 let options = this.createRequestOptions('application/json', verData.apiVersion);
505 let res;
506 res = yield this.rest.get(url, options);
507 let ret = this.formatResponse(res.result, null, false);
508 resolve(ret);
509 }
510 catch (err) {
511 reject(err);
512 }
513 }));
514 });
515 }
516 /**
517 * Update board user settings for the board id
518 *
519 * @param {{ [key: string] : string; }} boardUserSettings
520 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
521 * @param {string} board
522 */
523 updateBoardUserSettings(boardUserSettings, teamContext, board) {
524 return __awaiter(this, void 0, void 0, function* () {
525 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
526 let project = null;
527 let team = null;
528 if (teamContext) {
529 project = teamContext.projectId || teamContext.project;
530 team = teamContext.teamId || teamContext.team;
531 }
532 let routeValues = {
533 project: project,
534 team: team,
535 board: board
536 };
537 try {
538 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "b30d9f58-1891-4b0a-b168-c46408f919b0", routeValues);
539 let url = verData.requestUrl;
540 let options = this.createRequestOptions('application/json', verData.apiVersion);
541 let res;
542 res = yield this.rest.update(url, boardUserSettings, options);
543 let ret = this.formatResponse(res.result, null, false);
544 resolve(ret);
545 }
546 catch (err) {
547 reject(err);
548 }
549 }));
550 });
551 }
552 /**
553 * Get a team's capacity including total capacity and days off
554 *
555 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
556 * @param {string} iterationId - ID of the iteration
557 */
558 getCapacitiesWithIdentityRefAndTotals(teamContext, iterationId) {
559 return __awaiter(this, void 0, void 0, function* () {
560 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
561 let project = null;
562 let team = null;
563 if (teamContext) {
564 project = teamContext.projectId || teamContext.project;
565 team = teamContext.teamId || teamContext.team;
566 }
567 let routeValues = {
568 project: project,
569 team: team,
570 iterationId: iterationId
571 };
572 try {
573 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "work", "74412d15-8c1a-4352-a48d-ef1ed5587d57", routeValues);
574 let url = verData.requestUrl;
575 let options = this.createRequestOptions('application/json', verData.apiVersion);
576 let res;
577 res = yield this.rest.get(url, options);
578 let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.TeamCapacity, false);
579 resolve(ret);
580 }
581 catch (err) {
582 reject(err);
583 }
584 }));
585 });
586 }
587 /**
588 * Get a team member's capacity
589 *
590 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
591 * @param {string} iterationId - ID of the iteration
592 * @param {string} teamMemberId - ID of the team member
593 */
594 getCapacityWithIdentityRef(teamContext, iterationId, teamMemberId) {
595 return __awaiter(this, void 0, void 0, function* () {
596 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
597 let project = null;
598 let team = null;
599 if (teamContext) {
600 project = teamContext.projectId || teamContext.project;
601 team = teamContext.teamId || teamContext.team;
602 }
603 let routeValues = {
604 project: project,
605 team: team,
606 iterationId: iterationId,
607 teamMemberId: teamMemberId
608 };
609 try {
610 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "work", "74412d15-8c1a-4352-a48d-ef1ed5587d57", routeValues);
611 let url = verData.requestUrl;
612 let options = this.createRequestOptions('application/json', verData.apiVersion);
613 let res;
614 res = yield this.rest.get(url, options);
615 let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.TeamMemberCapacityIdentityRef, false);
616 resolve(ret);
617 }
618 catch (err) {
619 reject(err);
620 }
621 }));
622 });
623 }
624 /**
625 * Replace a team's capacity
626 *
627 * @param {WorkInterfaces.TeamMemberCapacityIdentityRef[]} capacities - Team capacity to replace
628 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
629 * @param {string} iterationId - ID of the iteration
630 */
631 replaceCapacitiesWithIdentityRef(capacities, teamContext, iterationId) {
632 return __awaiter(this, void 0, void 0, function* () {
633 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
634 let project = null;
635 let team = null;
636 if (teamContext) {
637 project = teamContext.projectId || teamContext.project;
638 team = teamContext.teamId || teamContext.team;
639 }
640 let routeValues = {
641 project: project,
642 team: team,
643 iterationId: iterationId
644 };
645 try {
646 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "work", "74412d15-8c1a-4352-a48d-ef1ed5587d57", routeValues);
647 let url = verData.requestUrl;
648 let options = this.createRequestOptions('application/json', verData.apiVersion);
649 let res;
650 res = yield this.rest.replace(url, capacities, options);
651 let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.TeamMemberCapacityIdentityRef, true);
652 resolve(ret);
653 }
654 catch (err) {
655 reject(err);
656 }
657 }));
658 });
659 }
660 /**
661 * Update a team member's capacity
662 *
663 * @param {WorkInterfaces.CapacityPatch} patch - Updated capacity
664 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
665 * @param {string} iterationId - ID of the iteration
666 * @param {string} teamMemberId - ID of the team member
667 */
668 updateCapacityWithIdentityRef(patch, teamContext, iterationId, teamMemberId) {
669 return __awaiter(this, void 0, void 0, function* () {
670 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
671 let project = null;
672 let team = null;
673 if (teamContext) {
674 project = teamContext.projectId || teamContext.project;
675 team = teamContext.teamId || teamContext.team;
676 }
677 let routeValues = {
678 project: project,
679 team: team,
680 iterationId: iterationId,
681 teamMemberId: teamMemberId
682 };
683 try {
684 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "work", "74412d15-8c1a-4352-a48d-ef1ed5587d57", routeValues);
685 let url = verData.requestUrl;
686 let options = this.createRequestOptions('application/json', verData.apiVersion);
687 let res;
688 res = yield this.rest.update(url, patch, options);
689 let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.TeamMemberCapacityIdentityRef, false);
690 resolve(ret);
691 }
692 catch (err) {
693 reject(err);
694 }
695 }));
696 });
697 }
698 /**
699 * Get board card Rule settings for the board id or board by name
700 *
701 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
702 * @param {string} board
703 */
704 getBoardCardRuleSettings(teamContext, board) {
705 return __awaiter(this, void 0, void 0, function* () {
706 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
707 let project = null;
708 let team = null;
709 if (teamContext) {
710 project = teamContext.projectId || teamContext.project;
711 team = teamContext.teamId || teamContext.team;
712 }
713 let routeValues = {
714 project: project,
715 team: team,
716 board: board
717 };
718 try {
719 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "work", "b044a3d9-02ea-49c7-91a1-b730949cc896", routeValues);
720 let url = verData.requestUrl;
721 let options = this.createRequestOptions('application/json', verData.apiVersion);
722 let res;
723 res = yield this.rest.get(url, options);
724 let ret = this.formatResponse(res.result, null, false);
725 resolve(ret);
726 }
727 catch (err) {
728 reject(err);
729 }
730 }));
731 });
732 }
733 /**
734 * Update board card Rule settings for the board id or board by name
735 *
736 * @param {WorkInterfaces.BoardCardRuleSettings} boardCardRuleSettings
737 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
738 * @param {string} board
739 */
740 updateBoardCardRuleSettings(boardCardRuleSettings, teamContext, board) {
741 return __awaiter(this, void 0, void 0, function* () {
742 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
743 let project = null;
744 let team = null;
745 if (teamContext) {
746 project = teamContext.projectId || teamContext.project;
747 team = teamContext.teamId || teamContext.team;
748 }
749 let routeValues = {
750 project: project,
751 team: team,
752 board: board
753 };
754 try {
755 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "work", "b044a3d9-02ea-49c7-91a1-b730949cc896", routeValues);
756 let url = verData.requestUrl;
757 let options = this.createRequestOptions('application/json', verData.apiVersion);
758 let res;
759 res = yield this.rest.update(url, boardCardRuleSettings, options);
760 let ret = this.formatResponse(res.result, null, false);
761 resolve(ret);
762 }
763 catch (err) {
764 reject(err);
765 }
766 }));
767 });
768 }
769 /**
770 * Update taskboard card Rule settings
771 *
772 * @param {WorkInterfaces.BoardCardRuleSettings} boardCardRuleSettings
773 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
774 */
775 updateTaskboardCardRuleSettings(boardCardRuleSettings, teamContext) {
776 return __awaiter(this, void 0, void 0, function* () {
777 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
778 let project = null;
779 let team = null;
780 if (teamContext) {
781 project = teamContext.projectId || teamContext.project;
782 team = teamContext.teamId || teamContext.team;
783 }
784 let routeValues = {
785 project: project,
786 team: team
787 };
788 try {
789 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "work", "3f84a8d1-1aab-423e-a94b-6dcbdcca511f", routeValues);
790 let url = verData.requestUrl;
791 let options = this.createRequestOptions('application/json', verData.apiVersion);
792 let res;
793 res = yield this.rest.update(url, boardCardRuleSettings, options);
794 let ret = this.formatResponse(res.result, null, false);
795 resolve(ret);
796 }
797 catch (err) {
798 reject(err);
799 }
800 }));
801 });
802 }
803 /**
804 * Get board card settings for the board id or board by name
805 *
806 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
807 * @param {string} board
808 */
809 getBoardCardSettings(teamContext, board) {
810 return __awaiter(this, void 0, void 0, function* () {
811 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
812 let project = null;
813 let team = null;
814 if (teamContext) {
815 project = teamContext.projectId || teamContext.project;
816 team = teamContext.teamId || teamContext.team;
817 }
818 let routeValues = {
819 project: project,
820 team: team,
821 board: board
822 };
823 try {
824 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "work", "07c3b467-bc60-4f05-8e34-599ce288fafc", routeValues);
825 let url = verData.requestUrl;
826 let options = this.createRequestOptions('application/json', verData.apiVersion);
827 let res;
828 res = yield this.rest.get(url, options);
829 let ret = this.formatResponse(res.result, null, false);
830 resolve(ret);
831 }
832 catch (err) {
833 reject(err);
834 }
835 }));
836 });
837 }
838 /**
839 * Update board card settings for the board id or board by name
840 *
841 * @param {WorkInterfaces.BoardCardSettings} boardCardSettingsToSave
842 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
843 * @param {string} board
844 */
845 updateBoardCardSettings(boardCardSettingsToSave, teamContext, board) {
846 return __awaiter(this, void 0, void 0, function* () {
847 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
848 let project = null;
849 let team = null;
850 if (teamContext) {
851 project = teamContext.projectId || teamContext.project;
852 team = teamContext.teamId || teamContext.team;
853 }
854 let routeValues = {
855 project: project,
856 team: team,
857 board: board
858 };
859 try {
860 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "work", "07c3b467-bc60-4f05-8e34-599ce288fafc", routeValues);
861 let url = verData.requestUrl;
862 let options = this.createRequestOptions('application/json', verData.apiVersion);
863 let res;
864 res = yield this.rest.replace(url, boardCardSettingsToSave, options);
865 let ret = this.formatResponse(res.result, null, false);
866 resolve(ret);
867 }
868 catch (err) {
869 reject(err);
870 }
871 }));
872 });
873 }
874 /**
875 * Update taskboard card settings
876 *
877 * @param {WorkInterfaces.BoardCardSettings} boardCardSettingsToSave
878 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
879 */
880 updateTaskboardCardSettings(boardCardSettingsToSave, teamContext) {
881 return __awaiter(this, void 0, void 0, function* () {
882 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
883 let project = null;
884 let team = null;
885 if (teamContext) {
886 project = teamContext.projectId || teamContext.project;
887 team = teamContext.teamId || teamContext.team;
888 }
889 let routeValues = {
890 project: project,
891 team: team
892 };
893 try {
894 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "work", "0d63745f-31f3-4cf3-9056-2a064e567637", routeValues);
895 let url = verData.requestUrl;
896 let options = this.createRequestOptions('application/json', verData.apiVersion);
897 let res;
898 res = yield this.rest.replace(url, boardCardSettingsToSave, options);
899 let ret = this.formatResponse(res.result, null, false);
900 resolve(ret);
901 }
902 catch (err) {
903 reject(err);
904 }
905 }));
906 });
907 }
908 /**
909 * Get a board chart
910 *
911 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
912 * @param {string} board - Identifier for board, either board's backlog level name (Eg:"Stories") or Id
913 * @param {string} name - The chart name
914 */
915 getBoardChart(teamContext, board, name) {
916 return __awaiter(this, void 0, void 0, function* () {
917 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
918 let project = null;
919 let team = null;
920 if (teamContext) {
921 project = teamContext.projectId || teamContext.project;
922 team = teamContext.teamId || teamContext.team;
923 }
924 let routeValues = {
925 project: project,
926 team: team,
927 board: board,
928 name: name
929 };
930 try {
931 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "45fe888c-239e-49fd-958c-df1a1ab21d97", routeValues);
932 let url = verData.requestUrl;
933 let options = this.createRequestOptions('application/json', verData.apiVersion);
934 let res;
935 res = yield this.rest.get(url, options);
936 let ret = this.formatResponse(res.result, null, false);
937 resolve(ret);
938 }
939 catch (err) {
940 reject(err);
941 }
942 }));
943 });
944 }
945 /**
946 * Get board charts
947 *
948 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
949 * @param {string} board - Identifier for board, either board's backlog level name (Eg:"Stories") or Id
950 */
951 getBoardCharts(teamContext, board) {
952 return __awaiter(this, void 0, void 0, function* () {
953 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
954 let project = null;
955 let team = null;
956 if (teamContext) {
957 project = teamContext.projectId || teamContext.project;
958 team = teamContext.teamId || teamContext.team;
959 }
960 let routeValues = {
961 project: project,
962 team: team,
963 board: board
964 };
965 try {
966 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "45fe888c-239e-49fd-958c-df1a1ab21d97", routeValues);
967 let url = verData.requestUrl;
968 let options = this.createRequestOptions('application/json', verData.apiVersion);
969 let res;
970 res = yield this.rest.get(url, options);
971 let ret = this.formatResponse(res.result, null, true);
972 resolve(ret);
973 }
974 catch (err) {
975 reject(err);
976 }
977 }));
978 });
979 }
980 /**
981 * Update a board chart
982 *
983 * @param {WorkInterfaces.BoardChart} chart
984 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
985 * @param {string} board - Identifier for board, either board's backlog level name (Eg:"Stories") or Id
986 * @param {string} name - The chart name
987 */
988 updateBoardChart(chart, teamContext, board, name) {
989 return __awaiter(this, void 0, void 0, function* () {
990 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
991 let project = null;
992 let team = null;
993 if (teamContext) {
994 project = teamContext.projectId || teamContext.project;
995 team = teamContext.teamId || teamContext.team;
996 }
997 let routeValues = {
998 project: project,
999 team: team,
1000 board: board,
1001 name: name
1002 };
1003 try {
1004 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "45fe888c-239e-49fd-958c-df1a1ab21d97", routeValues);
1005 let url = verData.requestUrl;
1006 let options = this.createRequestOptions('application/json', verData.apiVersion);
1007 let res;
1008 res = yield this.rest.update(url, chart, options);
1009 let ret = this.formatResponse(res.result, null, false);
1010 resolve(ret);
1011 }
1012 catch (err) {
1013 reject(err);
1014 }
1015 }));
1016 });
1017 }
1018 /**
1019 * Get columns on a board
1020 *
1021 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
1022 * @param {string} board - Name or ID of the specific board
1023 */
1024 getBoardColumns(teamContext, board) {
1025 return __awaiter(this, void 0, void 0, function* () {
1026 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1027 let project = null;
1028 let team = null;
1029 if (teamContext) {
1030 project = teamContext.projectId || teamContext.project;
1031 team = teamContext.teamId || teamContext.team;
1032 }
1033 let routeValues = {
1034 project: project,
1035 team: team,
1036 board: board
1037 };
1038 try {
1039 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "c555d7ff-84e1-47df-9923-a3fe0cd8751b", routeValues);
1040 let url = verData.requestUrl;
1041 let options = this.createRequestOptions('application/json', verData.apiVersion);
1042 let res;
1043 res = yield this.rest.get(url, options);
1044 let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.BoardColumn, true);
1045 resolve(ret);
1046 }
1047 catch (err) {
1048 reject(err);
1049 }
1050 }));
1051 });
1052 }
1053 /**
1054 * Update columns on a board
1055 *
1056 * @param {WorkInterfaces.BoardColumn[]} boardColumns - List of board columns to update
1057 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
1058 * @param {string} board - Name or ID of the specific board
1059 */
1060 updateBoardColumns(boardColumns, teamContext, board) {
1061 return __awaiter(this, void 0, void 0, function* () {
1062 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1063 let project = null;
1064 let team = null;
1065 if (teamContext) {
1066 project = teamContext.projectId || teamContext.project;
1067 team = teamContext.teamId || teamContext.team;
1068 }
1069 let routeValues = {
1070 project: project,
1071 team: team,
1072 board: board
1073 };
1074 try {
1075 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "c555d7ff-84e1-47df-9923-a3fe0cd8751b", routeValues);
1076 let url = verData.requestUrl;
1077 let options = this.createRequestOptions('application/json', verData.apiVersion);
1078 let res;
1079 res = yield this.rest.replace(url, boardColumns, options);
1080 let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.BoardColumn, true);
1081 resolve(ret);
1082 }
1083 catch (err) {
1084 reject(err);
1085 }
1086 }));
1087 });
1088 }
1089 /**
1090 * Get Delivery View Data
1091 *
1092 * @param {string} project - Project ID or project name
1093 * @param {string} id - Identifier for delivery view
1094 * @param {number} revision - Revision of the plan for which you want data. If the current plan is a different revision you will get an ViewRevisionMismatchException exception. If you do not supply a revision you will get data for the latest revision.
1095 * @param {Date} startDate - The start date of timeline
1096 * @param {Date} endDate - The end date of timeline
1097 */
1098 getDeliveryTimelineData(project, id, revision, startDate, endDate) {
1099 return __awaiter(this, void 0, void 0, function* () {
1100 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1101 let routeValues = {
1102 project: project,
1103 id: id
1104 };
1105 let queryValues = {
1106 revision: revision,
1107 startDate: startDate,
1108 endDate: endDate,
1109 };
1110 try {
1111 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "bdd0834e-101f-49f0-a6ae-509f384a12b4", routeValues, queryValues);
1112 let url = verData.requestUrl;
1113 let options = this.createRequestOptions('application/json', verData.apiVersion);
1114 let res;
1115 res = yield this.rest.get(url, options);
1116 let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.DeliveryViewData, false);
1117 resolve(ret);
1118 }
1119 catch (err) {
1120 reject(err);
1121 }
1122 }));
1123 });
1124 }
1125 /**
1126 * Get an iteration's capacity for all teams in iteration
1127 *
1128 * @param {string} project - Project ID or project name
1129 * @param {string} iterationId - ID of the iteration
1130 */
1131 getTotalIterationCapacities(project, iterationId) {
1132 return __awaiter(this, void 0, void 0, function* () {
1133 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1134 let routeValues = {
1135 project: project,
1136 iterationId: iterationId
1137 };
1138 try {
1139 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "1e385ce0-396b-4273-8171-d64562c18d37", routeValues);
1140 let url = verData.requestUrl;
1141 let options = this.createRequestOptions('application/json', verData.apiVersion);
1142 let res;
1143 res = yield this.rest.get(url, options);
1144 let ret = this.formatResponse(res.result, null, false);
1145 resolve(ret);
1146 }
1147 catch (err) {
1148 reject(err);
1149 }
1150 }));
1151 });
1152 }
1153 /**
1154 * Delete a team's iteration by iterationId
1155 *
1156 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
1157 * @param {string} id - ID of the iteration
1158 */
1159 deleteTeamIteration(teamContext, id) {
1160 return __awaiter(this, void 0, void 0, function* () {
1161 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1162 let project = null;
1163 let team = null;
1164 if (teamContext) {
1165 project = teamContext.projectId || teamContext.project;
1166 team = teamContext.teamId || teamContext.team;
1167 }
1168 let routeValues = {
1169 project: project,
1170 team: team,
1171 id: id
1172 };
1173 try {
1174 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "c9175577-28a1-4b06-9197-8636af9f64ad", routeValues);
1175 let url = verData.requestUrl;
1176 let options = this.createRequestOptions('application/json', verData.apiVersion);
1177 let res;
1178 res = yield this.rest.del(url, options);
1179 let ret = this.formatResponse(res.result, null, false);
1180 resolve(ret);
1181 }
1182 catch (err) {
1183 reject(err);
1184 }
1185 }));
1186 });
1187 }
1188 /**
1189 * Get team's iteration by iterationId
1190 *
1191 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
1192 * @param {string} id - ID of the iteration
1193 */
1194 getTeamIteration(teamContext, id) {
1195 return __awaiter(this, void 0, void 0, function* () {
1196 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1197 let project = null;
1198 let team = null;
1199 if (teamContext) {
1200 project = teamContext.projectId || teamContext.project;
1201 team = teamContext.teamId || teamContext.team;
1202 }
1203 let routeValues = {
1204 project: project,
1205 team: team,
1206 id: id
1207 };
1208 try {
1209 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "c9175577-28a1-4b06-9197-8636af9f64ad", routeValues);
1210 let url = verData.requestUrl;
1211 let options = this.createRequestOptions('application/json', verData.apiVersion);
1212 let res;
1213 res = yield this.rest.get(url, options);
1214 let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.TeamSettingsIteration, false);
1215 resolve(ret);
1216 }
1217 catch (err) {
1218 reject(err);
1219 }
1220 }));
1221 });
1222 }
1223 /**
1224 * Get a team's iterations using timeframe filter
1225 *
1226 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
1227 * @param {string} timeframe - A filter for which iterations are returned based on relative time. Only Current is supported currently.
1228 */
1229 getTeamIterations(teamContext, timeframe) {
1230 return __awaiter(this, void 0, void 0, function* () {
1231 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1232 let project = null;
1233 let team = null;
1234 if (teamContext) {
1235 project = teamContext.projectId || teamContext.project;
1236 team = teamContext.teamId || teamContext.team;
1237 }
1238 let routeValues = {
1239 project: project,
1240 team: team
1241 };
1242 let queryValues = {
1243 '$timeframe': timeframe,
1244 };
1245 try {
1246 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "c9175577-28a1-4b06-9197-8636af9f64ad", routeValues, queryValues);
1247 let url = verData.requestUrl;
1248 let options = this.createRequestOptions('application/json', verData.apiVersion);
1249 let res;
1250 res = yield this.rest.get(url, options);
1251 let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.TeamSettingsIteration, true);
1252 resolve(ret);
1253 }
1254 catch (err) {
1255 reject(err);
1256 }
1257 }));
1258 });
1259 }
1260 /**
1261 * Add an iteration to the team
1262 *
1263 * @param {WorkInterfaces.TeamSettingsIteration} iteration - Iteration to add
1264 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
1265 */
1266 postTeamIteration(iteration, teamContext) {
1267 return __awaiter(this, void 0, void 0, function* () {
1268 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1269 let project = null;
1270 let team = null;
1271 if (teamContext) {
1272 project = teamContext.projectId || teamContext.project;
1273 team = teamContext.teamId || teamContext.team;
1274 }
1275 let routeValues = {
1276 project: project,
1277 team: team
1278 };
1279 try {
1280 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "c9175577-28a1-4b06-9197-8636af9f64ad", routeValues);
1281 let url = verData.requestUrl;
1282 let options = this.createRequestOptions('application/json', verData.apiVersion);
1283 let res;
1284 res = yield this.rest.create(url, iteration, options);
1285 let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.TeamSettingsIteration, false);
1286 resolve(ret);
1287 }
1288 catch (err) {
1289 reject(err);
1290 }
1291 }));
1292 });
1293 }
1294 /**
1295 * Add a new plan for the team
1296 *
1297 * @param {WorkInterfaces.CreatePlan} postedPlan - Plan definition
1298 * @param {string} project - Project ID or project name
1299 */
1300 createPlan(postedPlan, project) {
1301 return __awaiter(this, void 0, void 0, function* () {
1302 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1303 let routeValues = {
1304 project: project
1305 };
1306 try {
1307 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "0b42cb47-cd73-4810-ac90-19c9ba147453", routeValues);
1308 let url = verData.requestUrl;
1309 let options = this.createRequestOptions('application/json', verData.apiVersion);
1310 let res;
1311 res = yield this.rest.create(url, postedPlan, options);
1312 let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.Plan, false);
1313 resolve(ret);
1314 }
1315 catch (err) {
1316 reject(err);
1317 }
1318 }));
1319 });
1320 }
1321 /**
1322 * Delete the specified plan
1323 *
1324 * @param {string} project - Project ID or project name
1325 * @param {string} id - Identifier of the plan
1326 */
1327 deletePlan(project, id) {
1328 return __awaiter(this, void 0, void 0, function* () {
1329 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1330 let routeValues = {
1331 project: project,
1332 id: id
1333 };
1334 try {
1335 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "0b42cb47-cd73-4810-ac90-19c9ba147453", routeValues);
1336 let url = verData.requestUrl;
1337 let options = this.createRequestOptions('application/json', verData.apiVersion);
1338 let res;
1339 res = yield this.rest.del(url, options);
1340 let ret = this.formatResponse(res.result, null, false);
1341 resolve(ret);
1342 }
1343 catch (err) {
1344 reject(err);
1345 }
1346 }));
1347 });
1348 }
1349 /**
1350 * Get the information for the specified plan
1351 *
1352 * @param {string} project - Project ID or project name
1353 * @param {string} id - Identifier of the plan
1354 */
1355 getPlan(project, id) {
1356 return __awaiter(this, void 0, void 0, function* () {
1357 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1358 let routeValues = {
1359 project: project,
1360 id: id
1361 };
1362 try {
1363 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "0b42cb47-cd73-4810-ac90-19c9ba147453", routeValues);
1364 let url = verData.requestUrl;
1365 let options = this.createRequestOptions('application/json', verData.apiVersion);
1366 let res;
1367 res = yield this.rest.get(url, options);
1368 let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.Plan, false);
1369 resolve(ret);
1370 }
1371 catch (err) {
1372 reject(err);
1373 }
1374 }));
1375 });
1376 }
1377 /**
1378 * Get the information for all the plans configured for the given team
1379 *
1380 * @param {string} project - Project ID or project name
1381 */
1382 getPlans(project) {
1383 return __awaiter(this, void 0, void 0, function* () {
1384 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1385 let routeValues = {
1386 project: project
1387 };
1388 try {
1389 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "0b42cb47-cd73-4810-ac90-19c9ba147453", routeValues);
1390 let url = verData.requestUrl;
1391 let options = this.createRequestOptions('application/json', verData.apiVersion);
1392 let res;
1393 res = yield this.rest.get(url, options);
1394 let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.Plan, true);
1395 resolve(ret);
1396 }
1397 catch (err) {
1398 reject(err);
1399 }
1400 }));
1401 });
1402 }
1403 /**
1404 * Update the information for the specified plan
1405 *
1406 * @param {WorkInterfaces.UpdatePlan} updatedPlan - Plan definition to be updated
1407 * @param {string} project - Project ID or project name
1408 * @param {string} id - Identifier of the plan
1409 */
1410 updatePlan(updatedPlan, project, id) {
1411 return __awaiter(this, void 0, void 0, function* () {
1412 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1413 let routeValues = {
1414 project: project,
1415 id: id
1416 };
1417 try {
1418 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "0b42cb47-cd73-4810-ac90-19c9ba147453", routeValues);
1419 let url = verData.requestUrl;
1420 let options = this.createRequestOptions('application/json', verData.apiVersion);
1421 let res;
1422 res = yield this.rest.replace(url, updatedPlan, options);
1423 let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.Plan, false);
1424 resolve(ret);
1425 }
1426 catch (err) {
1427 reject(err);
1428 }
1429 }));
1430 });
1431 }
1432 /**
1433 * Get process configuration
1434 *
1435 * @param {string} project - Project ID or project name
1436 */
1437 getProcessConfiguration(project) {
1438 return __awaiter(this, void 0, void 0, function* () {
1439 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1440 let routeValues = {
1441 project: project
1442 };
1443 try {
1444 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "f901ba42-86d2-4b0c-89c1-3f86d06daa84", routeValues);
1445 let url = verData.requestUrl;
1446 let options = this.createRequestOptions('application/json', verData.apiVersion);
1447 let res;
1448 res = yield this.rest.get(url, options);
1449 let ret = this.formatResponse(res.result, null, false);
1450 resolve(ret);
1451 }
1452 catch (err) {
1453 reject(err);
1454 }
1455 }));
1456 });
1457 }
1458 /**
1459 * Get rows on a board
1460 *
1461 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
1462 * @param {string} board - Name or ID of the specific board
1463 */
1464 getBoardRows(teamContext, board) {
1465 return __awaiter(this, void 0, void 0, function* () {
1466 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1467 let project = null;
1468 let team = null;
1469 if (teamContext) {
1470 project = teamContext.projectId || teamContext.project;
1471 team = teamContext.teamId || teamContext.team;
1472 }
1473 let routeValues = {
1474 project: project,
1475 team: team,
1476 board: board
1477 };
1478 try {
1479 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "0863355d-aefd-4d63-8669-984c9b7b0e78", routeValues);
1480 let url = verData.requestUrl;
1481 let options = this.createRequestOptions('application/json', verData.apiVersion);
1482 let res;
1483 res = yield this.rest.get(url, options);
1484 let ret = this.formatResponse(res.result, null, true);
1485 resolve(ret);
1486 }
1487 catch (err) {
1488 reject(err);
1489 }
1490 }));
1491 });
1492 }
1493 /**
1494 * Update rows on a board
1495 *
1496 * @param {WorkInterfaces.BoardRow[]} boardRows - List of board rows to update
1497 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
1498 * @param {string} board - Name or ID of the specific board
1499 */
1500 updateBoardRows(boardRows, teamContext, board) {
1501 return __awaiter(this, void 0, void 0, function* () {
1502 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1503 let project = null;
1504 let team = null;
1505 if (teamContext) {
1506 project = teamContext.projectId || teamContext.project;
1507 team = teamContext.teamId || teamContext.team;
1508 }
1509 let routeValues = {
1510 project: project,
1511 team: team,
1512 board: board
1513 };
1514 try {
1515 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "0863355d-aefd-4d63-8669-984c9b7b0e78", routeValues);
1516 let url = verData.requestUrl;
1517 let options = this.createRequestOptions('application/json', verData.apiVersion);
1518 let res;
1519 res = yield this.rest.replace(url, boardRows, options);
1520 let ret = this.formatResponse(res.result, null, true);
1521 resolve(ret);
1522 }
1523 catch (err) {
1524 reject(err);
1525 }
1526 }));
1527 });
1528 }
1529 /**
1530 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
1531 */
1532 getColumns(teamContext) {
1533 return __awaiter(this, void 0, void 0, function* () {
1534 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1535 let project = null;
1536 let team = null;
1537 if (teamContext) {
1538 project = teamContext.projectId || teamContext.project;
1539 team = teamContext.teamId || teamContext.team;
1540 }
1541 let routeValues = {
1542 project: project,
1543 team: team
1544 };
1545 try {
1546 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "c6815dbe-8e7e-4ffe-9a79-e83ee712aa92", routeValues);
1547 let url = verData.requestUrl;
1548 let options = this.createRequestOptions('application/json', verData.apiVersion);
1549 let res;
1550 res = yield this.rest.get(url, options);
1551 let ret = this.formatResponse(res.result, null, false);
1552 resolve(ret);
1553 }
1554 catch (err) {
1555 reject(err);
1556 }
1557 }));
1558 });
1559 }
1560 /**
1561 * @param {WorkInterfaces.UpdateTaskboardColumn[]} updateColumns
1562 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
1563 */
1564 updateColumns(updateColumns, teamContext) {
1565 return __awaiter(this, void 0, void 0, function* () {
1566 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1567 let project = null;
1568 let team = null;
1569 if (teamContext) {
1570 project = teamContext.projectId || teamContext.project;
1571 team = teamContext.teamId || teamContext.team;
1572 }
1573 let routeValues = {
1574 project: project,
1575 team: team
1576 };
1577 try {
1578 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "c6815dbe-8e7e-4ffe-9a79-e83ee712aa92", routeValues);
1579 let url = verData.requestUrl;
1580 let options = this.createRequestOptions('application/json', verData.apiVersion);
1581 let res;
1582 res = yield this.rest.replace(url, updateColumns, options);
1583 let ret = this.formatResponse(res.result, null, false);
1584 resolve(ret);
1585 }
1586 catch (err) {
1587 reject(err);
1588 }
1589 }));
1590 });
1591 }
1592 /**
1593 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
1594 * @param {string} iterationId
1595 */
1596 getWorkItemColumns(teamContext, iterationId) {
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 iterationId: iterationId
1609 };
1610 try {
1611 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "1be23c36-8872-4abc-b57d-402cd6c669d9", routeValues);
1612 let url = verData.requestUrl;
1613 let options = this.createRequestOptions('application/json', verData.apiVersion);
1614 let res;
1615 res = yield this.rest.get(url, options);
1616 let ret = this.formatResponse(res.result, null, true);
1617 resolve(ret);
1618 }
1619 catch (err) {
1620 reject(err);
1621 }
1622 }));
1623 });
1624 }
1625 /**
1626 * @param {WorkInterfaces.UpdateTaskboardWorkItemColumn} updateColumn
1627 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
1628 * @param {string} iterationId
1629 * @param {number} workItemId
1630 */
1631 updateWorkItemColumn(updateColumn, teamContext, iterationId, workItemId) {
1632 return __awaiter(this, void 0, void 0, function* () {
1633 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1634 let project = null;
1635 let team = null;
1636 if (teamContext) {
1637 project = teamContext.projectId || teamContext.project;
1638 team = teamContext.teamId || teamContext.team;
1639 }
1640 let routeValues = {
1641 project: project,
1642 team: team,
1643 iterationId: iterationId,
1644 workItemId: workItemId
1645 };
1646 try {
1647 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "1be23c36-8872-4abc-b57d-402cd6c669d9", routeValues);
1648 let url = verData.requestUrl;
1649 let options = this.createRequestOptions('application/json', verData.apiVersion);
1650 let res;
1651 res = yield this.rest.update(url, updateColumn, options);
1652 let ret = this.formatResponse(res.result, null, false);
1653 resolve(ret);
1654 }
1655 catch (err) {
1656 reject(err);
1657 }
1658 }));
1659 });
1660 }
1661 /**
1662 * Get team's days off for an iteration
1663 *
1664 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
1665 * @param {string} iterationId - ID of the iteration
1666 */
1667 getTeamDaysOff(teamContext, iterationId) {
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 iterationId: iterationId
1680 };
1681 try {
1682 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "2d4faa2e-9150-4cbf-a47a-932b1b4a0773", routeValues);
1683 let url = verData.requestUrl;
1684 let options = this.createRequestOptions('application/json', verData.apiVersion);
1685 let res;
1686 res = yield this.rest.get(url, options);
1687 let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.TeamSettingsDaysOff, false);
1688 resolve(ret);
1689 }
1690 catch (err) {
1691 reject(err);
1692 }
1693 }));
1694 });
1695 }
1696 /**
1697 * Set a team's days off for an iteration
1698 *
1699 * @param {WorkInterfaces.TeamSettingsDaysOffPatch} daysOffPatch - Team's days off patch containing a list of start and end dates
1700 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
1701 * @param {string} iterationId - ID of the iteration
1702 */
1703 updateTeamDaysOff(daysOffPatch, teamContext, iterationId) {
1704 return __awaiter(this, void 0, void 0, function* () {
1705 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1706 let project = null;
1707 let team = null;
1708 if (teamContext) {
1709 project = teamContext.projectId || teamContext.project;
1710 team = teamContext.teamId || teamContext.team;
1711 }
1712 let routeValues = {
1713 project: project,
1714 team: team,
1715 iterationId: iterationId
1716 };
1717 try {
1718 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "2d4faa2e-9150-4cbf-a47a-932b1b4a0773", routeValues);
1719 let url = verData.requestUrl;
1720 let options = this.createRequestOptions('application/json', verData.apiVersion);
1721 let res;
1722 res = yield this.rest.update(url, daysOffPatch, options);
1723 let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.TeamSettingsDaysOff, false);
1724 resolve(ret);
1725 }
1726 catch (err) {
1727 reject(err);
1728 }
1729 }));
1730 });
1731 }
1732 /**
1733 * Get a collection of team field values
1734 *
1735 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
1736 */
1737 getTeamFieldValues(teamContext) {
1738 return __awaiter(this, void 0, void 0, function* () {
1739 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1740 let project = null;
1741 let team = null;
1742 if (teamContext) {
1743 project = teamContext.projectId || teamContext.project;
1744 team = teamContext.teamId || teamContext.team;
1745 }
1746 let routeValues = {
1747 project: project,
1748 team: team
1749 };
1750 try {
1751 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "07ced576-58ed-49e6-9c1e-5cb53ab8bf2a", routeValues);
1752 let url = verData.requestUrl;
1753 let options = this.createRequestOptions('application/json', verData.apiVersion);
1754 let res;
1755 res = yield this.rest.get(url, options);
1756 let ret = this.formatResponse(res.result, null, false);
1757 resolve(ret);
1758 }
1759 catch (err) {
1760 reject(err);
1761 }
1762 }));
1763 });
1764 }
1765 /**
1766 * Update team field values
1767 *
1768 * @param {WorkInterfaces.TeamFieldValuesPatch} patch
1769 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
1770 */
1771 updateTeamFieldValues(patch, teamContext) {
1772 return __awaiter(this, void 0, void 0, function* () {
1773 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1774 let project = null;
1775 let team = null;
1776 if (teamContext) {
1777 project = teamContext.projectId || teamContext.project;
1778 team = teamContext.teamId || teamContext.team;
1779 }
1780 let routeValues = {
1781 project: project,
1782 team: team
1783 };
1784 try {
1785 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "07ced576-58ed-49e6-9c1e-5cb53ab8bf2a", routeValues);
1786 let url = verData.requestUrl;
1787 let options = this.createRequestOptions('application/json', verData.apiVersion);
1788 let res;
1789 res = yield this.rest.update(url, patch, options);
1790 let ret = this.formatResponse(res.result, null, false);
1791 resolve(ret);
1792 }
1793 catch (err) {
1794 reject(err);
1795 }
1796 }));
1797 });
1798 }
1799 /**
1800 * Get a team's settings
1801 *
1802 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
1803 */
1804 getTeamSettings(teamContext) {
1805 return __awaiter(this, void 0, void 0, function* () {
1806 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1807 let project = null;
1808 let team = null;
1809 if (teamContext) {
1810 project = teamContext.projectId || teamContext.project;
1811 team = teamContext.teamId || teamContext.team;
1812 }
1813 let routeValues = {
1814 project: project,
1815 team: team
1816 };
1817 try {
1818 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "c3c1012b-bea7-49d7-b45e-1664e566f84c", routeValues);
1819 let url = verData.requestUrl;
1820 let options = this.createRequestOptions('application/json', verData.apiVersion);
1821 let res;
1822 res = yield this.rest.get(url, options);
1823 let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.TeamSetting, false);
1824 resolve(ret);
1825 }
1826 catch (err) {
1827 reject(err);
1828 }
1829 }));
1830 });
1831 }
1832 /**
1833 * Update a team's settings
1834 *
1835 * @param {WorkInterfaces.TeamSettingsPatch} teamSettingsPatch - TeamSettings changes
1836 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
1837 */
1838 updateTeamSettings(teamSettingsPatch, teamContext) {
1839 return __awaiter(this, void 0, void 0, function* () {
1840 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1841 let project = null;
1842 let team = null;
1843 if (teamContext) {
1844 project = teamContext.projectId || teamContext.project;
1845 team = teamContext.teamId || teamContext.team;
1846 }
1847 let routeValues = {
1848 project: project,
1849 team: team
1850 };
1851 try {
1852 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "c3c1012b-bea7-49d7-b45e-1664e566f84c", routeValues);
1853 let url = verData.requestUrl;
1854 let options = this.createRequestOptions('application/json', verData.apiVersion);
1855 let res;
1856 res = yield this.rest.update(url, teamSettingsPatch, options);
1857 let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.TeamSetting, false);
1858 resolve(ret);
1859 }
1860 catch (err) {
1861 reject(err);
1862 }
1863 }));
1864 });
1865 }
1866 /**
1867 * Get work items for iteration
1868 *
1869 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
1870 * @param {string} iterationId - ID of the iteration
1871 */
1872 getIterationWorkItems(teamContext, iterationId) {
1873 return __awaiter(this, void 0, void 0, function* () {
1874 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1875 let project = null;
1876 let team = null;
1877 if (teamContext) {
1878 project = teamContext.projectId || teamContext.project;
1879 team = teamContext.teamId || teamContext.team;
1880 }
1881 let routeValues = {
1882 project: project,
1883 team: team,
1884 iterationId: iterationId
1885 };
1886 try {
1887 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "5b3ef1a6-d3ab-44cd-bafd-c7f45db850fa", routeValues);
1888 let url = verData.requestUrl;
1889 let options = this.createRequestOptions('application/json', verData.apiVersion);
1890 let res;
1891 res = yield this.rest.get(url, options);
1892 let ret = this.formatResponse(res.result, null, false);
1893 resolve(ret);
1894 }
1895 catch (err) {
1896 reject(err);
1897 }
1898 }));
1899 });
1900 }
1901 /**
1902 * Reorder Product Backlog/Boards Work Items
1903 *
1904 * @param {WorkInterfaces.ReorderOperation} operation
1905 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
1906 */
1907 reorderBacklogWorkItems(operation, teamContext) {
1908 return __awaiter(this, void 0, void 0, function* () {
1909 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1910 let project = null;
1911 let team = null;
1912 if (teamContext) {
1913 project = teamContext.projectId || teamContext.project;
1914 team = teamContext.teamId || teamContext.team;
1915 }
1916 let routeValues = {
1917 project: project,
1918 team: team
1919 };
1920 try {
1921 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "1c22b714-e7e4-41b9-85e0-56ee13ef55ed", routeValues);
1922 let url = verData.requestUrl;
1923 let options = this.createRequestOptions('application/json', verData.apiVersion);
1924 let res;
1925 res = yield this.rest.update(url, operation, options);
1926 let ret = this.formatResponse(res.result, null, true);
1927 resolve(ret);
1928 }
1929 catch (err) {
1930 reject(err);
1931 }
1932 }));
1933 });
1934 }
1935 /**
1936 * Reorder Sprint Backlog/Taskboard Work Items
1937 *
1938 * @param {WorkInterfaces.ReorderOperation} operation
1939 * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation
1940 * @param {string} iterationId - The id of the iteration
1941 */
1942 reorderIterationWorkItems(operation, teamContext, iterationId) {
1943 return __awaiter(this, void 0, void 0, function* () {
1944 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1945 let project = null;
1946 let team = null;
1947 if (teamContext) {
1948 project = teamContext.projectId || teamContext.project;
1949 team = teamContext.teamId || teamContext.team;
1950 }
1951 let routeValues = {
1952 project: project,
1953 team: team,
1954 iterationId: iterationId
1955 };
1956 try {
1957 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "47755db2-d7eb-405a-8c25-675401525fc9", routeValues);
1958 let url = verData.requestUrl;
1959 let options = this.createRequestOptions('application/json', verData.apiVersion);
1960 let res;
1961 res = yield this.rest.update(url, operation, options);
1962 let ret = this.formatResponse(res.result, null, true);
1963 resolve(ret);
1964 }
1965 catch (err) {
1966 reject(err);
1967 }
1968 }));
1969 });
1970 }
1971}
1972exports.WorkApi = WorkApi;
1973WorkApi.RESOURCE_AREA_ID = "1d4f49f9-02b9-4e26-b826-2cdb6195f2a9";