UNPKG

80.8 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.WorkItemTrackingProcessApi = void 0;
22const basem = require("./ClientApiBases");
23const WorkItemTrackingProcessInterfaces = require("./interfaces/WorkItemTrackingProcessInterfaces");
24class WorkItemTrackingProcessApi extends basem.ClientApiBase {
25 constructor(baseUrl, handlers, options) {
26 super(baseUrl, handlers, 'node-WorkItemTracking-api', options);
27 }
28 /**
29 * Creates a single behavior in the given process.
30 *
31 * @param {WorkItemTrackingProcessInterfaces.ProcessBehaviorCreateRequest} behavior
32 * @param {string} processId - The ID of the process
33 */
34 createProcessBehavior(behavior, processId) {
35 return __awaiter(this, void 0, void 0, function* () {
36 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
37 let routeValues = {
38 processId: processId
39 };
40 try {
41 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "d1800200-f184-4e75-a5f2-ad0b04b4373e", routeValues);
42 let url = verData.requestUrl;
43 let options = this.createRequestOptions('application/json', verData.apiVersion);
44 let res;
45 res = yield this.rest.create(url, behavior, options);
46 let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessBehavior, false);
47 resolve(ret);
48 }
49 catch (err) {
50 reject(err);
51 }
52 }));
53 });
54 }
55 /**
56 * Removes a behavior in the process.
57 *
58 * @param {string} processId - The ID of the process
59 * @param {string} behaviorRefName - The reference name of the behavior
60 */
61 deleteProcessBehavior(processId, behaviorRefName) {
62 return __awaiter(this, void 0, void 0, function* () {
63 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
64 let routeValues = {
65 processId: processId,
66 behaviorRefName: behaviorRefName
67 };
68 try {
69 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "d1800200-f184-4e75-a5f2-ad0b04b4373e", routeValues);
70 let url = verData.requestUrl;
71 let options = this.createRequestOptions('application/json', verData.apiVersion);
72 let res;
73 res = yield this.rest.del(url, options);
74 let ret = this.formatResponse(res.result, null, false);
75 resolve(ret);
76 }
77 catch (err) {
78 reject(err);
79 }
80 }));
81 });
82 }
83 /**
84 * Returns a behavior of the process.
85 *
86 * @param {string} processId - The ID of the process
87 * @param {string} behaviorRefName - The reference name of the behavior
88 * @param {WorkItemTrackingProcessInterfaces.GetBehaviorsExpand} expand
89 */
90 getProcessBehavior(processId, behaviorRefName, expand) {
91 return __awaiter(this, void 0, void 0, function* () {
92 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
93 let routeValues = {
94 processId: processId,
95 behaviorRefName: behaviorRefName
96 };
97 let queryValues = {
98 '$expand': expand,
99 };
100 try {
101 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "d1800200-f184-4e75-a5f2-ad0b04b4373e", routeValues, queryValues);
102 let url = verData.requestUrl;
103 let options = this.createRequestOptions('application/json', verData.apiVersion);
104 let res;
105 res = yield this.rest.get(url, options);
106 let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessBehavior, false);
107 resolve(ret);
108 }
109 catch (err) {
110 reject(err);
111 }
112 }));
113 });
114 }
115 /**
116 * Returns a list of all behaviors in the process.
117 *
118 * @param {string} processId - The ID of the process
119 * @param {WorkItemTrackingProcessInterfaces.GetBehaviorsExpand} expand
120 */
121 getProcessBehaviors(processId, expand) {
122 return __awaiter(this, void 0, void 0, function* () {
123 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
124 let routeValues = {
125 processId: processId
126 };
127 let queryValues = {
128 '$expand': expand,
129 };
130 try {
131 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "d1800200-f184-4e75-a5f2-ad0b04b4373e", routeValues, queryValues);
132 let url = verData.requestUrl;
133 let options = this.createRequestOptions('application/json', verData.apiVersion);
134 let res;
135 res = yield this.rest.get(url, options);
136 let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessBehavior, true);
137 resolve(ret);
138 }
139 catch (err) {
140 reject(err);
141 }
142 }));
143 });
144 }
145 /**
146 * Replaces a behavior in the process.
147 *
148 * @param {WorkItemTrackingProcessInterfaces.ProcessBehaviorUpdateRequest} behaviorData
149 * @param {string} processId - The ID of the process
150 * @param {string} behaviorRefName - The reference name of the behavior
151 */
152 updateProcessBehavior(behaviorData, processId, behaviorRefName) {
153 return __awaiter(this, void 0, void 0, function* () {
154 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
155 let routeValues = {
156 processId: processId,
157 behaviorRefName: behaviorRefName
158 };
159 try {
160 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "d1800200-f184-4e75-a5f2-ad0b04b4373e", routeValues);
161 let url = verData.requestUrl;
162 let options = this.createRequestOptions('application/json', verData.apiVersion);
163 let res;
164 res = yield this.rest.replace(url, behaviorData, options);
165 let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessBehavior, false);
166 resolve(ret);
167 }
168 catch (err) {
169 reject(err);
170 }
171 }));
172 });
173 }
174 /**
175 * Creates a control in a group.
176 *
177 * @param {WorkItemTrackingProcessInterfaces.Control} control - The control.
178 * @param {string} processId - The ID of the process.
179 * @param {string} witRefName - The reference name of the work item type.
180 * @param {string} groupId - The ID of the group to add the control to.
181 */
182 createControlInGroup(control, processId, witRefName, groupId) {
183 return __awaiter(this, void 0, void 0, function* () {
184 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
185 let routeValues = {
186 processId: processId,
187 witRefName: witRefName,
188 groupId: groupId
189 };
190 try {
191 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "1f59b363-a2d0-4b7e-9bc6-eb9f5f3f0e58", routeValues);
192 let url = verData.requestUrl;
193 let options = this.createRequestOptions('application/json', verData.apiVersion);
194 let res;
195 res = yield this.rest.create(url, control, options);
196 let ret = this.formatResponse(res.result, null, false);
197 resolve(ret);
198 }
199 catch (err) {
200 reject(err);
201 }
202 }));
203 });
204 }
205 /**
206 * Moves a control to a specified group.
207 *
208 * @param {WorkItemTrackingProcessInterfaces.Control} control - The control.
209 * @param {string} processId - The ID of the process.
210 * @param {string} witRefName - The reference name of the work item type.
211 * @param {string} groupId - The ID of the group to move the control to.
212 * @param {string} controlId - The ID of the control.
213 * @param {string} removeFromGroupId - The group ID to remove the control from.
214 */
215 moveControlToGroup(control, processId, witRefName, groupId, controlId, removeFromGroupId) {
216 return __awaiter(this, void 0, void 0, function* () {
217 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
218 let routeValues = {
219 processId: processId,
220 witRefName: witRefName,
221 groupId: groupId,
222 controlId: controlId
223 };
224 let queryValues = {
225 removeFromGroupId: removeFromGroupId,
226 };
227 try {
228 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "1f59b363-a2d0-4b7e-9bc6-eb9f5f3f0e58", routeValues, queryValues);
229 let url = verData.requestUrl;
230 let options = this.createRequestOptions('application/json', verData.apiVersion);
231 let res;
232 res = yield this.rest.replace(url, control, options);
233 let ret = this.formatResponse(res.result, null, false);
234 resolve(ret);
235 }
236 catch (err) {
237 reject(err);
238 }
239 }));
240 });
241 }
242 /**
243 * Removes a control from the work item form.
244 *
245 * @param {string} processId - The ID of the process.
246 * @param {string} witRefName - The reference name of the work item type.
247 * @param {string} groupId - The ID of the group.
248 * @param {string} controlId - The ID of the control to remove.
249 */
250 removeControlFromGroup(processId, witRefName, groupId, controlId) {
251 return __awaiter(this, void 0, void 0, function* () {
252 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
253 let routeValues = {
254 processId: processId,
255 witRefName: witRefName,
256 groupId: groupId,
257 controlId: controlId
258 };
259 try {
260 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "1f59b363-a2d0-4b7e-9bc6-eb9f5f3f0e58", routeValues);
261 let url = verData.requestUrl;
262 let options = this.createRequestOptions('application/json', verData.apiVersion);
263 let res;
264 res = yield this.rest.del(url, options);
265 let ret = this.formatResponse(res.result, null, false);
266 resolve(ret);
267 }
268 catch (err) {
269 reject(err);
270 }
271 }));
272 });
273 }
274 /**
275 * Updates a control on the work item form.
276 *
277 * @param {WorkItemTrackingProcessInterfaces.Control} control - The updated control.
278 * @param {string} processId - The ID of the process.
279 * @param {string} witRefName - The reference name of the work item type.
280 * @param {string} groupId - The ID of the group.
281 * @param {string} controlId - The ID of the control.
282 */
283 updateControl(control, processId, witRefName, groupId, controlId) {
284 return __awaiter(this, void 0, void 0, function* () {
285 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
286 let routeValues = {
287 processId: processId,
288 witRefName: witRefName,
289 groupId: groupId,
290 controlId: controlId
291 };
292 try {
293 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "1f59b363-a2d0-4b7e-9bc6-eb9f5f3f0e58", routeValues);
294 let url = verData.requestUrl;
295 let options = this.createRequestOptions('application/json', verData.apiVersion);
296 let res;
297 res = yield this.rest.update(url, control, options);
298 let ret = this.formatResponse(res.result, null, false);
299 resolve(ret);
300 }
301 catch (err) {
302 reject(err);
303 }
304 }));
305 });
306 }
307 /**
308 * Adds a field to a work item type.
309 *
310 * @param {WorkItemTrackingProcessInterfaces.AddProcessWorkItemTypeFieldRequest} field
311 * @param {string} processId - The ID of the process.
312 * @param {string} witRefName - The reference name of the work item type.
313 */
314 addFieldToWorkItemType(field, processId, witRefName) {
315 return __awaiter(this, void 0, void 0, function* () {
316 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
317 let routeValues = {
318 processId: processId,
319 witRefName: witRefName
320 };
321 try {
322 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "bc0ad8dc-e3f3-46b0-b06c-5bf861793196", routeValues);
323 let url = verData.requestUrl;
324 let options = this.createRequestOptions('application/json', verData.apiVersion);
325 let res;
326 res = yield this.rest.create(url, field, options);
327 let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessWorkItemTypeField, false);
328 resolve(ret);
329 }
330 catch (err) {
331 reject(err);
332 }
333 }));
334 });
335 }
336 /**
337 * Returns a list of all fields in a work item type.
338 *
339 * @param {string} processId - The ID of the process.
340 * @param {string} witRefName - The reference name of the work item type.
341 */
342 getAllWorkItemTypeFields(processId, witRefName) {
343 return __awaiter(this, void 0, void 0, function* () {
344 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
345 let routeValues = {
346 processId: processId,
347 witRefName: witRefName
348 };
349 try {
350 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "bc0ad8dc-e3f3-46b0-b06c-5bf861793196", routeValues);
351 let url = verData.requestUrl;
352 let options = this.createRequestOptions('application/json', verData.apiVersion);
353 let res;
354 res = yield this.rest.get(url, options);
355 let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessWorkItemTypeField, true);
356 resolve(ret);
357 }
358 catch (err) {
359 reject(err);
360 }
361 }));
362 });
363 }
364 /**
365 * Returns a field in a work item type.
366 *
367 * @param {string} processId - The ID of the process.
368 * @param {string} witRefName - The reference name of the work item type.
369 * @param {string} fieldRefName - The reference name of the field.
370 * @param {WorkItemTrackingProcessInterfaces.ProcessWorkItemTypeFieldsExpandLevel} expand
371 */
372 getWorkItemTypeField(processId, witRefName, fieldRefName, expand) {
373 return __awaiter(this, void 0, void 0, function* () {
374 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
375 let routeValues = {
376 processId: processId,
377 witRefName: witRefName,
378 fieldRefName: fieldRefName
379 };
380 let queryValues = {
381 '$expand': expand,
382 };
383 try {
384 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "bc0ad8dc-e3f3-46b0-b06c-5bf861793196", routeValues, queryValues);
385 let url = verData.requestUrl;
386 let options = this.createRequestOptions('application/json', verData.apiVersion);
387 let res;
388 res = yield this.rest.get(url, options);
389 let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessWorkItemTypeField, false);
390 resolve(ret);
391 }
392 catch (err) {
393 reject(err);
394 }
395 }));
396 });
397 }
398 /**
399 * Removes a field from a work item type. Does not permanently delete the field.
400 *
401 * @param {string} processId - The ID of the process.
402 * @param {string} witRefName - The reference name of the work item type.
403 * @param {string} fieldRefName - The reference name of the field.
404 */
405 removeWorkItemTypeField(processId, witRefName, fieldRefName) {
406 return __awaiter(this, void 0, void 0, function* () {
407 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
408 let routeValues = {
409 processId: processId,
410 witRefName: witRefName,
411 fieldRefName: fieldRefName
412 };
413 try {
414 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "bc0ad8dc-e3f3-46b0-b06c-5bf861793196", routeValues);
415 let url = verData.requestUrl;
416 let options = this.createRequestOptions('application/json', verData.apiVersion);
417 let res;
418 res = yield this.rest.del(url, options);
419 let ret = this.formatResponse(res.result, null, false);
420 resolve(ret);
421 }
422 catch (err) {
423 reject(err);
424 }
425 }));
426 });
427 }
428 /**
429 * Updates a field in a work item type.
430 *
431 * @param {WorkItemTrackingProcessInterfaces.UpdateProcessWorkItemTypeFieldRequest} field
432 * @param {string} processId - The ID of the process.
433 * @param {string} witRefName - The reference name of the work item type.
434 * @param {string} fieldRefName - The reference name of the field.
435 */
436 updateWorkItemTypeField(field, processId, witRefName, fieldRefName) {
437 return __awaiter(this, void 0, void 0, function* () {
438 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
439 let routeValues = {
440 processId: processId,
441 witRefName: witRefName,
442 fieldRefName: fieldRefName
443 };
444 try {
445 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "bc0ad8dc-e3f3-46b0-b06c-5bf861793196", routeValues);
446 let url = verData.requestUrl;
447 let options = this.createRequestOptions('application/json', verData.apiVersion);
448 let res;
449 res = yield this.rest.update(url, field, options);
450 let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessWorkItemTypeField, false);
451 resolve(ret);
452 }
453 catch (err) {
454 reject(err);
455 }
456 }));
457 });
458 }
459 /**
460 * Adds a group to the work item form.
461 *
462 * @param {WorkItemTrackingProcessInterfaces.Group} group - The group.
463 * @param {string} processId - The ID of the process.
464 * @param {string} witRefName - The reference name of the work item type.
465 * @param {string} pageId - The ID of the page to add the group to.
466 * @param {string} sectionId - The ID of the section to add the group to.
467 */
468 addGroup(group, processId, witRefName, pageId, sectionId) {
469 return __awaiter(this, void 0, void 0, function* () {
470 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
471 let routeValues = {
472 processId: processId,
473 witRefName: witRefName,
474 pageId: pageId,
475 sectionId: sectionId
476 };
477 try {
478 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "766e44e1-36a8-41d7-9050-c343ff02f7a5", routeValues);
479 let url = verData.requestUrl;
480 let options = this.createRequestOptions('application/json', verData.apiVersion);
481 let res;
482 res = yield this.rest.create(url, group, options);
483 let ret = this.formatResponse(res.result, null, false);
484 resolve(ret);
485 }
486 catch (err) {
487 reject(err);
488 }
489 }));
490 });
491 }
492 /**
493 * Moves a group to a different page and section.
494 *
495 * @param {WorkItemTrackingProcessInterfaces.Group} group - The updated group.
496 * @param {string} processId - The ID of the process.
497 * @param {string} witRefName - The reference name of the work item type.
498 * @param {string} pageId - The ID of the page the group is in.
499 * @param {string} sectionId - The ID of the section the group is i.n
500 * @param {string} groupId - The ID of the group.
501 * @param {string} removeFromPageId - ID of the page to remove the group from.
502 * @param {string} removeFromSectionId - ID of the section to remove the group from.
503 */
504 moveGroupToPage(group, processId, witRefName, pageId, sectionId, groupId, removeFromPageId, removeFromSectionId) {
505 return __awaiter(this, void 0, void 0, function* () {
506 if (removeFromPageId == null) {
507 throw new TypeError('removeFromPageId can not be null or undefined');
508 }
509 if (removeFromSectionId == null) {
510 throw new TypeError('removeFromSectionId can not be null or undefined');
511 }
512 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
513 let routeValues = {
514 processId: processId,
515 witRefName: witRefName,
516 pageId: pageId,
517 sectionId: sectionId,
518 groupId: groupId
519 };
520 let queryValues = {
521 removeFromPageId: removeFromPageId,
522 removeFromSectionId: removeFromSectionId,
523 };
524 try {
525 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "766e44e1-36a8-41d7-9050-c343ff02f7a5", routeValues, queryValues);
526 let url = verData.requestUrl;
527 let options = this.createRequestOptions('application/json', verData.apiVersion);
528 let res;
529 res = yield this.rest.replace(url, group, options);
530 let ret = this.formatResponse(res.result, null, false);
531 resolve(ret);
532 }
533 catch (err) {
534 reject(err);
535 }
536 }));
537 });
538 }
539 /**
540 * Moves a group to a different section.
541 *
542 * @param {WorkItemTrackingProcessInterfaces.Group} group - The updated group.
543 * @param {string} processId - The ID of the process.
544 * @param {string} witRefName - The reference name of the work item type.
545 * @param {string} pageId - The ID of the page the group is in.
546 * @param {string} sectionId - The ID of the section the group is in.
547 * @param {string} groupId - The ID of the group.
548 * @param {string} removeFromSectionId - ID of the section to remove the group from.
549 */
550 moveGroupToSection(group, processId, witRefName, pageId, sectionId, groupId, removeFromSectionId) {
551 return __awaiter(this, void 0, void 0, function* () {
552 if (removeFromSectionId == null) {
553 throw new TypeError('removeFromSectionId can not be null or undefined');
554 }
555 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
556 let routeValues = {
557 processId: processId,
558 witRefName: witRefName,
559 pageId: pageId,
560 sectionId: sectionId,
561 groupId: groupId
562 };
563 let queryValues = {
564 removeFromSectionId: removeFromSectionId,
565 };
566 try {
567 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "766e44e1-36a8-41d7-9050-c343ff02f7a5", routeValues, queryValues);
568 let url = verData.requestUrl;
569 let options = this.createRequestOptions('application/json', verData.apiVersion);
570 let res;
571 res = yield this.rest.replace(url, group, options);
572 let ret = this.formatResponse(res.result, null, false);
573 resolve(ret);
574 }
575 catch (err) {
576 reject(err);
577 }
578 }));
579 });
580 }
581 /**
582 * Removes a group from the work item form.
583 *
584 * @param {string} processId - The ID of the process
585 * @param {string} witRefName - The reference name of the work item type
586 * @param {string} pageId - The ID of the page the group is in
587 * @param {string} sectionId - The ID of the section to the group is in
588 * @param {string} groupId - The ID of the group
589 */
590 removeGroup(processId, witRefName, pageId, sectionId, groupId) {
591 return __awaiter(this, void 0, void 0, function* () {
592 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
593 let routeValues = {
594 processId: processId,
595 witRefName: witRefName,
596 pageId: pageId,
597 sectionId: sectionId,
598 groupId: groupId
599 };
600 try {
601 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "766e44e1-36a8-41d7-9050-c343ff02f7a5", routeValues);
602 let url = verData.requestUrl;
603 let options = this.createRequestOptions('application/json', verData.apiVersion);
604 let res;
605 res = yield this.rest.del(url, options);
606 let ret = this.formatResponse(res.result, null, false);
607 resolve(ret);
608 }
609 catch (err) {
610 reject(err);
611 }
612 }));
613 });
614 }
615 /**
616 * Updates a group in the work item form.
617 *
618 * @param {WorkItemTrackingProcessInterfaces.Group} group - The updated group.
619 * @param {string} processId - The ID of the process.
620 * @param {string} witRefName - The reference name of the work item type.
621 * @param {string} pageId - The ID of the page the group is in.
622 * @param {string} sectionId - The ID of the section the group is in.
623 * @param {string} groupId - The ID of the group.
624 */
625 updateGroup(group, processId, witRefName, pageId, sectionId, groupId) {
626 return __awaiter(this, void 0, void 0, function* () {
627 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
628 let routeValues = {
629 processId: processId,
630 witRefName: witRefName,
631 pageId: pageId,
632 sectionId: sectionId,
633 groupId: groupId
634 };
635 try {
636 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "766e44e1-36a8-41d7-9050-c343ff02f7a5", routeValues);
637 let url = verData.requestUrl;
638 let options = this.createRequestOptions('application/json', verData.apiVersion);
639 let res;
640 res = yield this.rest.update(url, group, options);
641 let ret = this.formatResponse(res.result, null, false);
642 resolve(ret);
643 }
644 catch (err) {
645 reject(err);
646 }
647 }));
648 });
649 }
650 /**
651 * Gets the form layout.
652 *
653 * @param {string} processId - The ID of the process.
654 * @param {string} witRefName - The reference name of the work item type.
655 */
656 getFormLayout(processId, witRefName) {
657 return __awaiter(this, void 0, void 0, function* () {
658 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
659 let routeValues = {
660 processId: processId,
661 witRefName: witRefName
662 };
663 try {
664 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "fa8646eb-43cd-4b71-9564-40106fd63e40", routeValues);
665 let url = verData.requestUrl;
666 let options = this.createRequestOptions('application/json', verData.apiVersion);
667 let res;
668 res = yield this.rest.get(url, options);
669 let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.FormLayout, false);
670 resolve(ret);
671 }
672 catch (err) {
673 reject(err);
674 }
675 }));
676 });
677 }
678 /**
679 * Creates a picklist.
680 *
681 * @param {WorkItemTrackingProcessInterfaces.PickList} picklist - Picklist
682 */
683 createList(picklist) {
684 return __awaiter(this, void 0, void 0, function* () {
685 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
686 let routeValues = {};
687 try {
688 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "01e15468-e27c-4e20-a974-bd957dcccebc", routeValues);
689 let url = verData.requestUrl;
690 let options = this.createRequestOptions('application/json', verData.apiVersion);
691 let res;
692 res = yield this.rest.create(url, picklist, options);
693 let ret = this.formatResponse(res.result, null, false);
694 resolve(ret);
695 }
696 catch (err) {
697 reject(err);
698 }
699 }));
700 });
701 }
702 /**
703 * Removes a picklist.
704 *
705 * @param {string} listId - The ID of the list
706 */
707 deleteList(listId) {
708 return __awaiter(this, void 0, void 0, function* () {
709 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
710 let routeValues = {
711 listId: listId
712 };
713 try {
714 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "01e15468-e27c-4e20-a974-bd957dcccebc", routeValues);
715 let url = verData.requestUrl;
716 let options = this.createRequestOptions('application/json', verData.apiVersion);
717 let res;
718 res = yield this.rest.del(url, options);
719 let ret = this.formatResponse(res.result, null, false);
720 resolve(ret);
721 }
722 catch (err) {
723 reject(err);
724 }
725 }));
726 });
727 }
728 /**
729 * Returns a picklist.
730 *
731 * @param {string} listId - The ID of the list
732 */
733 getList(listId) {
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 listId: listId
738 };
739 try {
740 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "01e15468-e27c-4e20-a974-bd957dcccebc", routeValues);
741 let url = verData.requestUrl;
742 let options = this.createRequestOptions('application/json', verData.apiVersion);
743 let res;
744 res = yield this.rest.get(url, options);
745 let ret = this.formatResponse(res.result, null, false);
746 resolve(ret);
747 }
748 catch (err) {
749 reject(err);
750 }
751 }));
752 });
753 }
754 /**
755 * Returns meta data of the picklist.
756 *
757 */
758 getListsMetadata() {
759 return __awaiter(this, void 0, void 0, function* () {
760 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
761 let routeValues = {};
762 try {
763 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "01e15468-e27c-4e20-a974-bd957dcccebc", routeValues);
764 let url = verData.requestUrl;
765 let options = this.createRequestOptions('application/json', verData.apiVersion);
766 let res;
767 res = yield this.rest.get(url, options);
768 let ret = this.formatResponse(res.result, null, true);
769 resolve(ret);
770 }
771 catch (err) {
772 reject(err);
773 }
774 }));
775 });
776 }
777 /**
778 * Updates a list.
779 *
780 * @param {WorkItemTrackingProcessInterfaces.PickList} picklist
781 * @param {string} listId - The ID of the list
782 */
783 updateList(picklist, listId) {
784 return __awaiter(this, void 0, void 0, function* () {
785 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
786 let routeValues = {
787 listId: listId
788 };
789 try {
790 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "01e15468-e27c-4e20-a974-bd957dcccebc", routeValues);
791 let url = verData.requestUrl;
792 let options = this.createRequestOptions('application/json', verData.apiVersion);
793 let res;
794 res = yield this.rest.replace(url, picklist, options);
795 let ret = this.formatResponse(res.result, null, false);
796 resolve(ret);
797 }
798 catch (err) {
799 reject(err);
800 }
801 }));
802 });
803 }
804 /**
805 * Adds a page to the work item form.
806 *
807 * @param {WorkItemTrackingProcessInterfaces.Page} page - The page.
808 * @param {string} processId - The ID of the process.
809 * @param {string} witRefName - The reference name of the work item type.
810 */
811 addPage(page, processId, witRefName) {
812 return __awaiter(this, void 0, void 0, function* () {
813 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
814 let routeValues = {
815 processId: processId,
816 witRefName: witRefName
817 };
818 try {
819 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "1cc7b29f-6697-4d9d-b0a1-2650d3e1d584", routeValues);
820 let url = verData.requestUrl;
821 let options = this.createRequestOptions('application/json', verData.apiVersion);
822 let res;
823 res = yield this.rest.create(url, page, options);
824 let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.Page, false);
825 resolve(ret);
826 }
827 catch (err) {
828 reject(err);
829 }
830 }));
831 });
832 }
833 /**
834 * Removes a page from the work item form
835 *
836 * @param {string} processId - The ID of the process
837 * @param {string} witRefName - The reference name of the work item type
838 * @param {string} pageId - The ID of the page
839 */
840 removePage(processId, witRefName, pageId) {
841 return __awaiter(this, void 0, void 0, function* () {
842 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
843 let routeValues = {
844 processId: processId,
845 witRefName: witRefName,
846 pageId: pageId
847 };
848 try {
849 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "1cc7b29f-6697-4d9d-b0a1-2650d3e1d584", routeValues);
850 let url = verData.requestUrl;
851 let options = this.createRequestOptions('application/json', verData.apiVersion);
852 let res;
853 res = yield this.rest.del(url, options);
854 let ret = this.formatResponse(res.result, null, false);
855 resolve(ret);
856 }
857 catch (err) {
858 reject(err);
859 }
860 }));
861 });
862 }
863 /**
864 * Updates a page on the work item form
865 *
866 * @param {WorkItemTrackingProcessInterfaces.Page} page - The page
867 * @param {string} processId - The ID of the process
868 * @param {string} witRefName - The reference name of the work item type
869 */
870 updatePage(page, processId, witRefName) {
871 return __awaiter(this, void 0, void 0, function* () {
872 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
873 let routeValues = {
874 processId: processId,
875 witRefName: witRefName
876 };
877 try {
878 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "1cc7b29f-6697-4d9d-b0a1-2650d3e1d584", routeValues);
879 let url = verData.requestUrl;
880 let options = this.createRequestOptions('application/json', verData.apiVersion);
881 let res;
882 res = yield this.rest.update(url, page, options);
883 let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.Page, false);
884 resolve(ret);
885 }
886 catch (err) {
887 reject(err);
888 }
889 }));
890 });
891 }
892 /**
893 * Creates a process.
894 *
895 * @param {WorkItemTrackingProcessInterfaces.CreateProcessModel} createRequest - CreateProcessModel.
896 */
897 createNewProcess(createRequest) {
898 return __awaiter(this, void 0, void 0, function* () {
899 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
900 let routeValues = {};
901 try {
902 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "02cc6a73-5cfb-427d-8c8e-b49fb086e8af", routeValues);
903 let url = verData.requestUrl;
904 let options = this.createRequestOptions('application/json', verData.apiVersion);
905 let res;
906 res = yield this.rest.create(url, createRequest, options);
907 let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessInfo, false);
908 resolve(ret);
909 }
910 catch (err) {
911 reject(err);
912 }
913 }));
914 });
915 }
916 /**
917 * Removes a process of a specific ID.
918 *
919 * @param {string} processTypeId
920 */
921 deleteProcessById(processTypeId) {
922 return __awaiter(this, void 0, void 0, function* () {
923 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
924 let routeValues = {
925 processTypeId: processTypeId
926 };
927 try {
928 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "02cc6a73-5cfb-427d-8c8e-b49fb086e8af", routeValues);
929 let url = verData.requestUrl;
930 let options = this.createRequestOptions('application/json', verData.apiVersion);
931 let res;
932 res = yield this.rest.del(url, options);
933 let ret = this.formatResponse(res.result, null, false);
934 resolve(ret);
935 }
936 catch (err) {
937 reject(err);
938 }
939 }));
940 });
941 }
942 /**
943 * Edit a process of a specific ID.
944 *
945 * @param {WorkItemTrackingProcessInterfaces.UpdateProcessModel} updateRequest
946 * @param {string} processTypeId
947 */
948 editProcess(updateRequest, processTypeId) {
949 return __awaiter(this, void 0, void 0, function* () {
950 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
951 let routeValues = {
952 processTypeId: processTypeId
953 };
954 try {
955 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "02cc6a73-5cfb-427d-8c8e-b49fb086e8af", routeValues);
956 let url = verData.requestUrl;
957 let options = this.createRequestOptions('application/json', verData.apiVersion);
958 let res;
959 res = yield this.rest.update(url, updateRequest, options);
960 let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessInfo, false);
961 resolve(ret);
962 }
963 catch (err) {
964 reject(err);
965 }
966 }));
967 });
968 }
969 /**
970 * Get list of all processes including system and inherited.
971 *
972 * @param {WorkItemTrackingProcessInterfaces.GetProcessExpandLevel} expand
973 */
974 getListOfProcesses(expand) {
975 return __awaiter(this, void 0, void 0, function* () {
976 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
977 let routeValues = {};
978 let queryValues = {
979 '$expand': expand,
980 };
981 try {
982 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "02cc6a73-5cfb-427d-8c8e-b49fb086e8af", routeValues, queryValues);
983 let url = verData.requestUrl;
984 let options = this.createRequestOptions('application/json', verData.apiVersion);
985 let res;
986 res = yield this.rest.get(url, options);
987 let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessInfo, true);
988 resolve(ret);
989 }
990 catch (err) {
991 reject(err);
992 }
993 }));
994 });
995 }
996 /**
997 * Get a single process of a specified ID.
998 *
999 * @param {string} processTypeId
1000 * @param {WorkItemTrackingProcessInterfaces.GetProcessExpandLevel} expand
1001 */
1002 getProcessByItsId(processTypeId, expand) {
1003 return __awaiter(this, void 0, void 0, function* () {
1004 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1005 let routeValues = {
1006 processTypeId: processTypeId
1007 };
1008 let queryValues = {
1009 '$expand': expand,
1010 };
1011 try {
1012 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "02cc6a73-5cfb-427d-8c8e-b49fb086e8af", routeValues, queryValues);
1013 let url = verData.requestUrl;
1014 let options = this.createRequestOptions('application/json', verData.apiVersion);
1015 let res;
1016 res = yield this.rest.get(url, options);
1017 let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessInfo, false);
1018 resolve(ret);
1019 }
1020 catch (err) {
1021 reject(err);
1022 }
1023 }));
1024 });
1025 }
1026 /**
1027 * Adds a rule to work item type in the process.
1028 *
1029 * @param {WorkItemTrackingProcessInterfaces.CreateProcessRuleRequest} processRuleCreate
1030 * @param {string} processId - The ID of the process
1031 * @param {string} witRefName - The reference name of the work item type
1032 */
1033 addProcessWorkItemTypeRule(processRuleCreate, processId, witRefName) {
1034 return __awaiter(this, void 0, void 0, function* () {
1035 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1036 let routeValues = {
1037 processId: processId,
1038 witRefName: witRefName
1039 };
1040 try {
1041 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "76fe3432-d825-479d-a5f6-983bbb78b4f3", routeValues);
1042 let url = verData.requestUrl;
1043 let options = this.createRequestOptions('application/json', verData.apiVersion);
1044 let res;
1045 res = yield this.rest.create(url, processRuleCreate, options);
1046 let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessRule, false);
1047 resolve(ret);
1048 }
1049 catch (err) {
1050 reject(err);
1051 }
1052 }));
1053 });
1054 }
1055 /**
1056 * Removes a rule from the work item type in the process.
1057 *
1058 * @param {string} processId - The ID of the process
1059 * @param {string} witRefName - The reference name of the work item type
1060 * @param {string} ruleId - The ID of the rule
1061 */
1062 deleteProcessWorkItemTypeRule(processId, witRefName, ruleId) {
1063 return __awaiter(this, void 0, void 0, function* () {
1064 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1065 let routeValues = {
1066 processId: processId,
1067 witRefName: witRefName,
1068 ruleId: ruleId
1069 };
1070 try {
1071 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "76fe3432-d825-479d-a5f6-983bbb78b4f3", routeValues);
1072 let url = verData.requestUrl;
1073 let options = this.createRequestOptions('application/json', verData.apiVersion);
1074 let res;
1075 res = yield this.rest.del(url, options);
1076 let ret = this.formatResponse(res.result, null, false);
1077 resolve(ret);
1078 }
1079 catch (err) {
1080 reject(err);
1081 }
1082 }));
1083 });
1084 }
1085 /**
1086 * Returns a single rule in the work item type of the process.
1087 *
1088 * @param {string} processId - The ID of the process
1089 * @param {string} witRefName - The reference name of the work item type
1090 * @param {string} ruleId - The ID of the rule
1091 */
1092 getProcessWorkItemTypeRule(processId, witRefName, ruleId) {
1093 return __awaiter(this, void 0, void 0, function* () {
1094 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1095 let routeValues = {
1096 processId: processId,
1097 witRefName: witRefName,
1098 ruleId: ruleId
1099 };
1100 try {
1101 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "76fe3432-d825-479d-a5f6-983bbb78b4f3", routeValues);
1102 let url = verData.requestUrl;
1103 let options = this.createRequestOptions('application/json', verData.apiVersion);
1104 let res;
1105 res = yield this.rest.get(url, options);
1106 let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessRule, false);
1107 resolve(ret);
1108 }
1109 catch (err) {
1110 reject(err);
1111 }
1112 }));
1113 });
1114 }
1115 /**
1116 * Returns a list of all rules in the work item type of the process.
1117 *
1118 * @param {string} processId - The ID of the process
1119 * @param {string} witRefName - The reference name of the work item type
1120 */
1121 getProcessWorkItemTypeRules(processId, witRefName) {
1122 return __awaiter(this, void 0, void 0, function* () {
1123 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1124 let routeValues = {
1125 processId: processId,
1126 witRefName: witRefName
1127 };
1128 try {
1129 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "76fe3432-d825-479d-a5f6-983bbb78b4f3", routeValues);
1130 let url = verData.requestUrl;
1131 let options = this.createRequestOptions('application/json', verData.apiVersion);
1132 let res;
1133 res = yield this.rest.get(url, options);
1134 let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessRule, true);
1135 resolve(ret);
1136 }
1137 catch (err) {
1138 reject(err);
1139 }
1140 }));
1141 });
1142 }
1143 /**
1144 * Updates a rule in the work item type of the process.
1145 *
1146 * @param {WorkItemTrackingProcessInterfaces.UpdateProcessRuleRequest} processRule
1147 * @param {string} processId - The ID of the process
1148 * @param {string} witRefName - The reference name of the work item type
1149 * @param {string} ruleId - The ID of the rule
1150 */
1151 updateProcessWorkItemTypeRule(processRule, processId, witRefName, ruleId) {
1152 return __awaiter(this, void 0, void 0, function* () {
1153 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1154 let routeValues = {
1155 processId: processId,
1156 witRefName: witRefName,
1157 ruleId: ruleId
1158 };
1159 try {
1160 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "76fe3432-d825-479d-a5f6-983bbb78b4f3", routeValues);
1161 let url = verData.requestUrl;
1162 let options = this.createRequestOptions('application/json', verData.apiVersion);
1163 let res;
1164 res = yield this.rest.replace(url, processRule, options);
1165 let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessRule, false);
1166 resolve(ret);
1167 }
1168 catch (err) {
1169 reject(err);
1170 }
1171 }));
1172 });
1173 }
1174 /**
1175 * Creates a state definition in the work item type of the process.
1176 *
1177 * @param {WorkItemTrackingProcessInterfaces.WorkItemStateInputModel} stateModel
1178 * @param {string} processId - The ID of the process
1179 * @param {string} witRefName - The reference name of the work item type
1180 */
1181 createStateDefinition(stateModel, processId, witRefName) {
1182 return __awaiter(this, void 0, void 0, function* () {
1183 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1184 let routeValues = {
1185 processId: processId,
1186 witRefName: witRefName
1187 };
1188 try {
1189 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "31015d57-2dff-4a46-adb3-2fb4ee3dcec9", routeValues);
1190 let url = verData.requestUrl;
1191 let options = this.createRequestOptions('application/json', verData.apiVersion);
1192 let res;
1193 res = yield this.rest.create(url, stateModel, options);
1194 let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.WorkItemStateResultModel, false);
1195 resolve(ret);
1196 }
1197 catch (err) {
1198 reject(err);
1199 }
1200 }));
1201 });
1202 }
1203 /**
1204 * Removes a state definition in the work item type of the process.
1205 *
1206 * @param {string} processId - ID of the process
1207 * @param {string} witRefName - The reference name of the work item type
1208 * @param {string} stateId - ID of the state
1209 */
1210 deleteStateDefinition(processId, witRefName, stateId) {
1211 return __awaiter(this, void 0, void 0, function* () {
1212 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1213 let routeValues = {
1214 processId: processId,
1215 witRefName: witRefName,
1216 stateId: stateId
1217 };
1218 try {
1219 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "31015d57-2dff-4a46-adb3-2fb4ee3dcec9", routeValues);
1220 let url = verData.requestUrl;
1221 let options = this.createRequestOptions('application/json', verData.apiVersion);
1222 let res;
1223 res = yield this.rest.del(url, options);
1224 let ret = this.formatResponse(res.result, null, false);
1225 resolve(ret);
1226 }
1227 catch (err) {
1228 reject(err);
1229 }
1230 }));
1231 });
1232 }
1233 /**
1234 * Returns a single state definition in a work item type of the process.
1235 *
1236 * @param {string} processId - The ID of the process
1237 * @param {string} witRefName - The reference name of the work item type
1238 * @param {string} stateId - The ID of the state
1239 */
1240 getStateDefinition(processId, witRefName, stateId) {
1241 return __awaiter(this, void 0, void 0, function* () {
1242 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1243 let routeValues = {
1244 processId: processId,
1245 witRefName: witRefName,
1246 stateId: stateId
1247 };
1248 try {
1249 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "31015d57-2dff-4a46-adb3-2fb4ee3dcec9", routeValues);
1250 let url = verData.requestUrl;
1251 let options = this.createRequestOptions('application/json', verData.apiVersion);
1252 let res;
1253 res = yield this.rest.get(url, options);
1254 let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.WorkItemStateResultModel, false);
1255 resolve(ret);
1256 }
1257 catch (err) {
1258 reject(err);
1259 }
1260 }));
1261 });
1262 }
1263 /**
1264 * Returns a list of all state definitions in a work item type of the process.
1265 *
1266 * @param {string} processId - The ID of the process
1267 * @param {string} witRefName - The reference name of the work item type
1268 */
1269 getStateDefinitions(processId, witRefName) {
1270 return __awaiter(this, void 0, void 0, function* () {
1271 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1272 let routeValues = {
1273 processId: processId,
1274 witRefName: witRefName
1275 };
1276 try {
1277 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "31015d57-2dff-4a46-adb3-2fb4ee3dcec9", routeValues);
1278 let url = verData.requestUrl;
1279 let options = this.createRequestOptions('application/json', verData.apiVersion);
1280 let res;
1281 res = yield this.rest.get(url, options);
1282 let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.WorkItemStateResultModel, true);
1283 resolve(ret);
1284 }
1285 catch (err) {
1286 reject(err);
1287 }
1288 }));
1289 });
1290 }
1291 /**
1292 * Hides a state definition in the work item type of the process.Only states with customizationType:System can be hidden.
1293 *
1294 * @param {WorkItemTrackingProcessInterfaces.HideStateModel} hideStateModel
1295 * @param {string} processId - The ID of the process
1296 * @param {string} witRefName - The reference name of the work item type
1297 * @param {string} stateId - The ID of the state
1298 */
1299 hideStateDefinition(hideStateModel, processId, witRefName, stateId) {
1300 return __awaiter(this, void 0, void 0, function* () {
1301 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1302 let routeValues = {
1303 processId: processId,
1304 witRefName: witRefName,
1305 stateId: stateId
1306 };
1307 try {
1308 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "31015d57-2dff-4a46-adb3-2fb4ee3dcec9", routeValues);
1309 let url = verData.requestUrl;
1310 let options = this.createRequestOptions('application/json', verData.apiVersion);
1311 let res;
1312 res = yield this.rest.replace(url, hideStateModel, options);
1313 let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.WorkItemStateResultModel, false);
1314 resolve(ret);
1315 }
1316 catch (err) {
1317 reject(err);
1318 }
1319 }));
1320 });
1321 }
1322 /**
1323 * Updates a given state definition in the work item type of the process.
1324 *
1325 * @param {WorkItemTrackingProcessInterfaces.WorkItemStateInputModel} stateModel
1326 * @param {string} processId - ID of the process
1327 * @param {string} witRefName - The reference name of the work item type
1328 * @param {string} stateId - ID of the state
1329 */
1330 updateStateDefinition(stateModel, processId, witRefName, stateId) {
1331 return __awaiter(this, void 0, void 0, function* () {
1332 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1333 let routeValues = {
1334 processId: processId,
1335 witRefName: witRefName,
1336 stateId: stateId
1337 };
1338 try {
1339 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "31015d57-2dff-4a46-adb3-2fb4ee3dcec9", routeValues);
1340 let url = verData.requestUrl;
1341 let options = this.createRequestOptions('application/json', verData.apiVersion);
1342 let res;
1343 res = yield this.rest.update(url, stateModel, options);
1344 let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.WorkItemStateResultModel, false);
1345 resolve(ret);
1346 }
1347 catch (err) {
1348 reject(err);
1349 }
1350 }));
1351 });
1352 }
1353 /**
1354 * Deletes a system control modification on the work item form.
1355 *
1356 * @param {string} processId - The ID of the process.
1357 * @param {string} witRefName - The reference name of the work item type.
1358 * @param {string} controlId - The ID of the control.
1359 */
1360 deleteSystemControl(processId, witRefName, controlId) {
1361 return __awaiter(this, void 0, void 0, function* () {
1362 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1363 let routeValues = {
1364 processId: processId,
1365 witRefName: witRefName,
1366 controlId: controlId
1367 };
1368 try {
1369 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "ff9a3d2c-32b7-4c6c-991c-d5a251fb9098", routeValues);
1370 let url = verData.requestUrl;
1371 let options = this.createRequestOptions('application/json', verData.apiVersion);
1372 let res;
1373 res = yield this.rest.del(url, options);
1374 let ret = this.formatResponse(res.result, null, true);
1375 resolve(ret);
1376 }
1377 catch (err) {
1378 reject(err);
1379 }
1380 }));
1381 });
1382 }
1383 /**
1384 * Gets edited system controls for a work item type in a process. To get all system controls (base + edited) use layout API(s)
1385 *
1386 * @param {string} processId - The ID of the process.
1387 * @param {string} witRefName - The reference name of the work item type.
1388 */
1389 getSystemControls(processId, witRefName) {
1390 return __awaiter(this, void 0, void 0, function* () {
1391 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1392 let routeValues = {
1393 processId: processId,
1394 witRefName: witRefName
1395 };
1396 try {
1397 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "ff9a3d2c-32b7-4c6c-991c-d5a251fb9098", routeValues);
1398 let url = verData.requestUrl;
1399 let options = this.createRequestOptions('application/json', verData.apiVersion);
1400 let res;
1401 res = yield this.rest.get(url, options);
1402 let ret = this.formatResponse(res.result, null, true);
1403 resolve(ret);
1404 }
1405 catch (err) {
1406 reject(err);
1407 }
1408 }));
1409 });
1410 }
1411 /**
1412 * Updates/adds a system control on the work item form.
1413 *
1414 * @param {WorkItemTrackingProcessInterfaces.Control} control
1415 * @param {string} processId - The ID of the process.
1416 * @param {string} witRefName - The reference name of the work item type.
1417 * @param {string} controlId - The ID of the control.
1418 */
1419 updateSystemControl(control, processId, witRefName, controlId) {
1420 return __awaiter(this, void 0, void 0, function* () {
1421 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1422 let routeValues = {
1423 processId: processId,
1424 witRefName: witRefName,
1425 controlId: controlId
1426 };
1427 try {
1428 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "ff9a3d2c-32b7-4c6c-991c-d5a251fb9098", routeValues);
1429 let url = verData.requestUrl;
1430 let options = this.createRequestOptions('application/json', verData.apiVersion);
1431 let res;
1432 res = yield this.rest.update(url, control, options);
1433 let ret = this.formatResponse(res.result, null, false);
1434 resolve(ret);
1435 }
1436 catch (err) {
1437 reject(err);
1438 }
1439 }));
1440 });
1441 }
1442 /**
1443 * Creates a work item type in the process.
1444 *
1445 * @param {WorkItemTrackingProcessInterfaces.CreateProcessWorkItemTypeRequest} workItemType
1446 * @param {string} processId - The ID of the process on which to create work item type.
1447 */
1448 createProcessWorkItemType(workItemType, processId) {
1449 return __awaiter(this, void 0, void 0, function* () {
1450 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1451 let routeValues = {
1452 processId: processId
1453 };
1454 try {
1455 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "e2e9d1a6-432d-4062-8870-bfcb8c324ad7", routeValues);
1456 let url = verData.requestUrl;
1457 let options = this.createRequestOptions('application/json', verData.apiVersion);
1458 let res;
1459 res = yield this.rest.create(url, workItemType, options);
1460 let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessWorkItemType, false);
1461 resolve(ret);
1462 }
1463 catch (err) {
1464 reject(err);
1465 }
1466 }));
1467 });
1468 }
1469 /**
1470 * Removes a work item type in the process.
1471 *
1472 * @param {string} processId - The ID of the process.
1473 * @param {string} witRefName - The reference name of the work item type.
1474 */
1475 deleteProcessWorkItemType(processId, witRefName) {
1476 return __awaiter(this, void 0, void 0, function* () {
1477 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1478 let routeValues = {
1479 processId: processId,
1480 witRefName: witRefName
1481 };
1482 try {
1483 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "e2e9d1a6-432d-4062-8870-bfcb8c324ad7", routeValues);
1484 let url = verData.requestUrl;
1485 let options = this.createRequestOptions('application/json', verData.apiVersion);
1486 let res;
1487 res = yield this.rest.del(url, options);
1488 let ret = this.formatResponse(res.result, null, false);
1489 resolve(ret);
1490 }
1491 catch (err) {
1492 reject(err);
1493 }
1494 }));
1495 });
1496 }
1497 /**
1498 * Returns a single work item type in a process.
1499 *
1500 * @param {string} processId - The ID of the process
1501 * @param {string} witRefName - The reference name of the work item type
1502 * @param {WorkItemTrackingProcessInterfaces.GetWorkItemTypeExpand} expand - Flag to determine what properties of work item type to return
1503 */
1504 getProcessWorkItemType(processId, witRefName, expand) {
1505 return __awaiter(this, void 0, void 0, function* () {
1506 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1507 let routeValues = {
1508 processId: processId,
1509 witRefName: witRefName
1510 };
1511 let queryValues = {
1512 '$expand': expand,
1513 };
1514 try {
1515 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "e2e9d1a6-432d-4062-8870-bfcb8c324ad7", routeValues, queryValues);
1516 let url = verData.requestUrl;
1517 let options = this.createRequestOptions('application/json', verData.apiVersion);
1518 let res;
1519 res = yield this.rest.get(url, options);
1520 let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessWorkItemType, false);
1521 resolve(ret);
1522 }
1523 catch (err) {
1524 reject(err);
1525 }
1526 }));
1527 });
1528 }
1529 /**
1530 * Returns a list of all work item types in a process.
1531 *
1532 * @param {string} processId - The ID of the process
1533 * @param {WorkItemTrackingProcessInterfaces.GetWorkItemTypeExpand} expand - Flag to determine what properties of work item type to return
1534 */
1535 getProcessWorkItemTypes(processId, expand) {
1536 return __awaiter(this, void 0, void 0, function* () {
1537 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1538 let routeValues = {
1539 processId: processId
1540 };
1541 let queryValues = {
1542 '$expand': expand,
1543 };
1544 try {
1545 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "e2e9d1a6-432d-4062-8870-bfcb8c324ad7", routeValues, queryValues);
1546 let url = verData.requestUrl;
1547 let options = this.createRequestOptions('application/json', verData.apiVersion);
1548 let res;
1549 res = yield this.rest.get(url, options);
1550 let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessWorkItemType, true);
1551 resolve(ret);
1552 }
1553 catch (err) {
1554 reject(err);
1555 }
1556 }));
1557 });
1558 }
1559 /**
1560 * Updates a work item type of the process.
1561 *
1562 * @param {WorkItemTrackingProcessInterfaces.UpdateProcessWorkItemTypeRequest} workItemTypeUpdate
1563 * @param {string} processId - The ID of the process
1564 * @param {string} witRefName - The reference name of the work item type
1565 */
1566 updateProcessWorkItemType(workItemTypeUpdate, processId, witRefName) {
1567 return __awaiter(this, void 0, void 0, function* () {
1568 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1569 let routeValues = {
1570 processId: processId,
1571 witRefName: witRefName
1572 };
1573 try {
1574 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "e2e9d1a6-432d-4062-8870-bfcb8c324ad7", routeValues);
1575 let url = verData.requestUrl;
1576 let options = this.createRequestOptions('application/json', verData.apiVersion);
1577 let res;
1578 res = yield this.rest.update(url, workItemTypeUpdate, options);
1579 let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessWorkItemType, false);
1580 resolve(ret);
1581 }
1582 catch (err) {
1583 reject(err);
1584 }
1585 }));
1586 });
1587 }
1588 /**
1589 * Adds a behavior to the work item type of the process.
1590 *
1591 * @param {WorkItemTrackingProcessInterfaces.WorkItemTypeBehavior} behavior
1592 * @param {string} processId - The ID of the process
1593 * @param {string} witRefNameForBehaviors - Work item type reference name for the behavior
1594 */
1595 addBehaviorToWorkItemType(behavior, processId, witRefNameForBehaviors) {
1596 return __awaiter(this, void 0, void 0, function* () {
1597 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1598 let routeValues = {
1599 processId: processId,
1600 witRefNameForBehaviors: witRefNameForBehaviors
1601 };
1602 try {
1603 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "6d765a2e-4e1b-4b11-be93-f953be676024", routeValues);
1604 let url = verData.requestUrl;
1605 let options = this.createRequestOptions('application/json', verData.apiVersion);
1606 let res;
1607 res = yield this.rest.create(url, behavior, options);
1608 let ret = this.formatResponse(res.result, null, false);
1609 resolve(ret);
1610 }
1611 catch (err) {
1612 reject(err);
1613 }
1614 }));
1615 });
1616 }
1617 /**
1618 * Returns a behavior for the work item type of the process.
1619 *
1620 * @param {string} processId - The ID of the process
1621 * @param {string} witRefNameForBehaviors - Work item type reference name for the behavior
1622 * @param {string} behaviorRefName - The reference name of the behavior
1623 */
1624 getBehaviorForWorkItemType(processId, witRefNameForBehaviors, behaviorRefName) {
1625 return __awaiter(this, void 0, void 0, function* () {
1626 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1627 let routeValues = {
1628 processId: processId,
1629 witRefNameForBehaviors: witRefNameForBehaviors,
1630 behaviorRefName: behaviorRefName
1631 };
1632 try {
1633 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "6d765a2e-4e1b-4b11-be93-f953be676024", routeValues);
1634 let url = verData.requestUrl;
1635 let options = this.createRequestOptions('application/json', verData.apiVersion);
1636 let res;
1637 res = yield this.rest.get(url, options);
1638 let ret = this.formatResponse(res.result, null, false);
1639 resolve(ret);
1640 }
1641 catch (err) {
1642 reject(err);
1643 }
1644 }));
1645 });
1646 }
1647 /**
1648 * Returns a list of all behaviors for the work item type of the process.
1649 *
1650 * @param {string} processId - The ID of the process
1651 * @param {string} witRefNameForBehaviors - Work item type reference name for the behavior
1652 */
1653 getBehaviorsForWorkItemType(processId, witRefNameForBehaviors) {
1654 return __awaiter(this, void 0, void 0, function* () {
1655 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1656 let routeValues = {
1657 processId: processId,
1658 witRefNameForBehaviors: witRefNameForBehaviors
1659 };
1660 try {
1661 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "6d765a2e-4e1b-4b11-be93-f953be676024", routeValues);
1662 let url = verData.requestUrl;
1663 let options = this.createRequestOptions('application/json', verData.apiVersion);
1664 let res;
1665 res = yield this.rest.get(url, options);
1666 let ret = this.formatResponse(res.result, null, true);
1667 resolve(ret);
1668 }
1669 catch (err) {
1670 reject(err);
1671 }
1672 }));
1673 });
1674 }
1675 /**
1676 * Removes a behavior for the work item type of the process.
1677 *
1678 * @param {string} processId - The ID of the process
1679 * @param {string} witRefNameForBehaviors - Work item type reference name for the behavior
1680 * @param {string} behaviorRefName - The reference name of the behavior
1681 */
1682 removeBehaviorFromWorkItemType(processId, witRefNameForBehaviors, behaviorRefName) {
1683 return __awaiter(this, void 0, void 0, function* () {
1684 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1685 let routeValues = {
1686 processId: processId,
1687 witRefNameForBehaviors: witRefNameForBehaviors,
1688 behaviorRefName: behaviorRefName
1689 };
1690 try {
1691 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "6d765a2e-4e1b-4b11-be93-f953be676024", routeValues);
1692 let url = verData.requestUrl;
1693 let options = this.createRequestOptions('application/json', verData.apiVersion);
1694 let res;
1695 res = yield this.rest.del(url, options);
1696 let ret = this.formatResponse(res.result, null, false);
1697 resolve(ret);
1698 }
1699 catch (err) {
1700 reject(err);
1701 }
1702 }));
1703 });
1704 }
1705 /**
1706 * Updates a behavior for the work item type of the process.
1707 *
1708 * @param {WorkItemTrackingProcessInterfaces.WorkItemTypeBehavior} behavior
1709 * @param {string} processId - The ID of the process
1710 * @param {string} witRefNameForBehaviors - Work item type reference name for the behavior
1711 */
1712 updateBehaviorToWorkItemType(behavior, processId, witRefNameForBehaviors) {
1713 return __awaiter(this, void 0, void 0, function* () {
1714 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1715 let routeValues = {
1716 processId: processId,
1717 witRefNameForBehaviors: witRefNameForBehaviors
1718 };
1719 try {
1720 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "6d765a2e-4e1b-4b11-be93-f953be676024", routeValues);
1721 let url = verData.requestUrl;
1722 let options = this.createRequestOptions('application/json', verData.apiVersion);
1723 let res;
1724 res = yield this.rest.update(url, behavior, options);
1725 let ret = this.formatResponse(res.result, null, false);
1726 resolve(ret);
1727 }
1728 catch (err) {
1729 reject(err);
1730 }
1731 }));
1732 });
1733 }
1734}
1735exports.WorkItemTrackingProcessApi = WorkItemTrackingProcessApi;
1736WorkItemTrackingProcessApi.RESOURCE_AREA_ID = "5264459e-e5e0-4bd8-b118-0985e68a4ec5";