UNPKG

65.7 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.WorkItemTrackingProcessDefinitionsApi = void 0;
22const basem = require("./ClientApiBases");
23const WorkItemTrackingProcessDefinitionsInterfaces = require("./interfaces/WorkItemTrackingProcessDefinitionsInterfaces");
24class WorkItemTrackingProcessDefinitionsApi 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 {WorkItemTrackingProcessDefinitionsInterfaces.BehaviorCreateModel} behavior
32 * @param {string} processId - The ID of the process
33 */
34 createBehavior(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.1", "processDefinitions", "47a651f4-fb70-43bf-b96b-7c0ba947142b", 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, null, 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} behaviorId - The ID of the behavior
60 */
61 deleteBehavior(processId, behaviorId) {
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 behaviorId: behaviorId
67 };
68 try {
69 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "47a651f4-fb70-43bf-b96b-7c0ba947142b", 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 single behavior in the process.
85 *
86 * @param {string} processId - The ID of the process
87 * @param {string} behaviorId - The ID of the behavior
88 */
89 getBehavior(processId, behaviorId) {
90 return __awaiter(this, void 0, void 0, function* () {
91 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
92 let routeValues = {
93 processId: processId,
94 behaviorId: behaviorId
95 };
96 try {
97 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "47a651f4-fb70-43bf-b96b-7c0ba947142b", routeValues);
98 let url = verData.requestUrl;
99 let options = this.createRequestOptions('application/json', verData.apiVersion);
100 let res;
101 res = yield this.rest.get(url, options);
102 let ret = this.formatResponse(res.result, null, false);
103 resolve(ret);
104 }
105 catch (err) {
106 reject(err);
107 }
108 }));
109 });
110 }
111 /**
112 * Returns a list of all behaviors in the process.
113 *
114 * @param {string} processId - The ID of the process
115 */
116 getBehaviors(processId) {
117 return __awaiter(this, void 0, void 0, function* () {
118 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
119 let routeValues = {
120 processId: processId
121 };
122 try {
123 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "47a651f4-fb70-43bf-b96b-7c0ba947142b", routeValues);
124 let url = verData.requestUrl;
125 let options = this.createRequestOptions('application/json', verData.apiVersion);
126 let res;
127 res = yield this.rest.get(url, options);
128 let ret = this.formatResponse(res.result, null, true);
129 resolve(ret);
130 }
131 catch (err) {
132 reject(err);
133 }
134 }));
135 });
136 }
137 /**
138 * Replaces a behavior in the process.
139 *
140 * @param {WorkItemTrackingProcessDefinitionsInterfaces.BehaviorReplaceModel} behaviorData
141 * @param {string} processId - The ID of the process
142 * @param {string} behaviorId - The ID of the behavior
143 */
144 replaceBehavior(behaviorData, processId, behaviorId) {
145 return __awaiter(this, void 0, void 0, function* () {
146 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
147 let routeValues = {
148 processId: processId,
149 behaviorId: behaviorId
150 };
151 try {
152 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "47a651f4-fb70-43bf-b96b-7c0ba947142b", routeValues);
153 let url = verData.requestUrl;
154 let options = this.createRequestOptions('application/json', verData.apiVersion);
155 let res;
156 res = yield this.rest.replace(url, behaviorData, options);
157 let ret = this.formatResponse(res.result, null, false);
158 resolve(ret);
159 }
160 catch (err) {
161 reject(err);
162 }
163 }));
164 });
165 }
166 /**
167 * Creates a control in a group
168 *
169 * @param {WorkItemTrackingProcessDefinitionsInterfaces.Control} control - The control
170 * @param {string} processId - The ID of the process
171 * @param {string} witRefName - The reference name of the work item type
172 * @param {string} groupId - The ID of the group to add the control to
173 */
174 addControlToGroup(control, processId, witRefName, groupId) {
175 return __awaiter(this, void 0, void 0, function* () {
176 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
177 let routeValues = {
178 processId: processId,
179 witRefName: witRefName,
180 groupId: groupId
181 };
182 try {
183 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "e2e3166a-627a-4e9b-85b2-d6a097bbd731", routeValues);
184 let url = verData.requestUrl;
185 let options = this.createRequestOptions('application/json', verData.apiVersion);
186 let res;
187 res = yield this.rest.create(url, control, options);
188 let ret = this.formatResponse(res.result, null, false);
189 resolve(ret);
190 }
191 catch (err) {
192 reject(err);
193 }
194 }));
195 });
196 }
197 /**
198 * Updates a control on the work item form
199 *
200 * @param {WorkItemTrackingProcessDefinitionsInterfaces.Control} control - The updated control
201 * @param {string} processId - The ID of the process
202 * @param {string} witRefName - The reference name of the work item type
203 * @param {string} groupId - The ID of the group
204 * @param {string} controlId - The ID of the control
205 */
206 editControl(control, processId, witRefName, groupId, controlId) {
207 return __awaiter(this, void 0, void 0, function* () {
208 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
209 let routeValues = {
210 processId: processId,
211 witRefName: witRefName,
212 groupId: groupId,
213 controlId: controlId
214 };
215 try {
216 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "e2e3166a-627a-4e9b-85b2-d6a097bbd731", routeValues);
217 let url = verData.requestUrl;
218 let options = this.createRequestOptions('application/json', verData.apiVersion);
219 let res;
220 res = yield this.rest.update(url, control, options);
221 let ret = this.formatResponse(res.result, null, false);
222 resolve(ret);
223 }
224 catch (err) {
225 reject(err);
226 }
227 }));
228 });
229 }
230 /**
231 * Removes a control from the work item form
232 *
233 * @param {string} processId - The ID of the process
234 * @param {string} witRefName - The reference name of the work item type
235 * @param {string} groupId - The ID of the group
236 * @param {string} controlId - The ID of the control to remove
237 */
238 removeControlFromGroup(processId, witRefName, groupId, controlId) {
239 return __awaiter(this, void 0, void 0, function* () {
240 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
241 let routeValues = {
242 processId: processId,
243 witRefName: witRefName,
244 groupId: groupId,
245 controlId: controlId
246 };
247 try {
248 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "e2e3166a-627a-4e9b-85b2-d6a097bbd731", routeValues);
249 let url = verData.requestUrl;
250 let options = this.createRequestOptions('application/json', verData.apiVersion);
251 let res;
252 res = yield this.rest.del(url, options);
253 let ret = this.formatResponse(res.result, null, false);
254 resolve(ret);
255 }
256 catch (err) {
257 reject(err);
258 }
259 }));
260 });
261 }
262 /**
263 * Moves a control to a new group
264 *
265 * @param {WorkItemTrackingProcessDefinitionsInterfaces.Control} control - The control
266 * @param {string} processId - The ID of the process
267 * @param {string} witRefName - The reference name of the work item type
268 * @param {string} groupId - The ID of the group to move the control to
269 * @param {string} controlId - The id of the control
270 * @param {string} removeFromGroupId - The group to remove the control from
271 */
272 setControlInGroup(control, processId, witRefName, groupId, controlId, removeFromGroupId) {
273 return __awaiter(this, void 0, void 0, function* () {
274 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
275 let routeValues = {
276 processId: processId,
277 witRefName: witRefName,
278 groupId: groupId,
279 controlId: controlId
280 };
281 let queryValues = {
282 removeFromGroupId: removeFromGroupId,
283 };
284 try {
285 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "e2e3166a-627a-4e9b-85b2-d6a097bbd731", routeValues, queryValues);
286 let url = verData.requestUrl;
287 let options = this.createRequestOptions('application/json', verData.apiVersion);
288 let res;
289 res = yield this.rest.replace(url, control, options);
290 let ret = this.formatResponse(res.result, null, false);
291 resolve(ret);
292 }
293 catch (err) {
294 reject(err);
295 }
296 }));
297 });
298 }
299 /**
300 * Creates a single field in the process.
301 *
302 * @param {WorkItemTrackingProcessDefinitionsInterfaces.FieldModel} field
303 * @param {string} processId - The ID of the process
304 */
305 createField(field, processId) {
306 return __awaiter(this, void 0, void 0, function* () {
307 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
308 let routeValues = {
309 processId: processId
310 };
311 try {
312 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "f36c66c7-911d-4163-8938-d3c5d0d7f5aa", routeValues);
313 let url = verData.requestUrl;
314 let options = this.createRequestOptions('application/json', verData.apiVersion);
315 let res;
316 res = yield this.rest.create(url, field, options);
317 let ret = this.formatResponse(res.result, WorkItemTrackingProcessDefinitionsInterfaces.TypeInfo.FieldModel, false);
318 resolve(ret);
319 }
320 catch (err) {
321 reject(err);
322 }
323 }));
324 });
325 }
326 /**
327 * Updates a given field in the process.
328 *
329 * @param {WorkItemTrackingProcessDefinitionsInterfaces.FieldUpdate} field
330 * @param {string} processId - The ID of the process
331 */
332 updateField(field, processId) {
333 return __awaiter(this, void 0, void 0, function* () {
334 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
335 let routeValues = {
336 processId: processId
337 };
338 try {
339 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "f36c66c7-911d-4163-8938-d3c5d0d7f5aa", routeValues);
340 let url = verData.requestUrl;
341 let options = this.createRequestOptions('application/json', verData.apiVersion);
342 let res;
343 res = yield this.rest.update(url, field, options);
344 let ret = this.formatResponse(res.result, WorkItemTrackingProcessDefinitionsInterfaces.TypeInfo.FieldModel, false);
345 resolve(ret);
346 }
347 catch (err) {
348 reject(err);
349 }
350 }));
351 });
352 }
353 /**
354 * Adds a group to the work item form
355 *
356 * @param {WorkItemTrackingProcessDefinitionsInterfaces.Group} group - The group
357 * @param {string} processId - The ID of the process
358 * @param {string} witRefName - The reference name of the work item type
359 * @param {string} pageId - The ID of the page to add the group to
360 * @param {string} sectionId - The ID of the section to add the group to
361 */
362 addGroup(group, processId, witRefName, pageId, sectionId) {
363 return __awaiter(this, void 0, void 0, function* () {
364 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
365 let routeValues = {
366 processId: processId,
367 witRefName: witRefName,
368 pageId: pageId,
369 sectionId: sectionId
370 };
371 try {
372 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "2617828b-e850-4375-a92a-04855704d4c3", routeValues);
373 let url = verData.requestUrl;
374 let options = this.createRequestOptions('application/json', verData.apiVersion);
375 let res;
376 res = yield this.rest.create(url, group, options);
377 let ret = this.formatResponse(res.result, null, false);
378 resolve(ret);
379 }
380 catch (err) {
381 reject(err);
382 }
383 }));
384 });
385 }
386 /**
387 * Updates a group in the work item form
388 *
389 * @param {WorkItemTrackingProcessDefinitionsInterfaces.Group} group - The updated group
390 * @param {string} processId - The ID of the process
391 * @param {string} witRefName - The reference name of the work item type
392 * @param {string} pageId - The ID of the page the group is in
393 * @param {string} sectionId - The ID of the section the group is in
394 * @param {string} groupId - The ID of the group
395 */
396 editGroup(group, processId, witRefName, pageId, sectionId, groupId) {
397 return __awaiter(this, void 0, void 0, function* () {
398 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
399 let routeValues = {
400 processId: processId,
401 witRefName: witRefName,
402 pageId: pageId,
403 sectionId: sectionId,
404 groupId: groupId
405 };
406 try {
407 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "2617828b-e850-4375-a92a-04855704d4c3", routeValues);
408 let url = verData.requestUrl;
409 let options = this.createRequestOptions('application/json', verData.apiVersion);
410 let res;
411 res = yield this.rest.update(url, group, options);
412 let ret = this.formatResponse(res.result, null, false);
413 resolve(ret);
414 }
415 catch (err) {
416 reject(err);
417 }
418 }));
419 });
420 }
421 /**
422 * Removes a group from the work item form
423 *
424 * @param {string} processId - The ID of the process
425 * @param {string} witRefName - The reference name of the work item type
426 * @param {string} pageId - The ID of the page the group is in
427 * @param {string} sectionId - The ID of the section to the group is in
428 * @param {string} groupId - The ID of the group
429 */
430 removeGroup(processId, witRefName, pageId, sectionId, groupId) {
431 return __awaiter(this, void 0, void 0, function* () {
432 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
433 let routeValues = {
434 processId: processId,
435 witRefName: witRefName,
436 pageId: pageId,
437 sectionId: sectionId,
438 groupId: groupId
439 };
440 try {
441 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "2617828b-e850-4375-a92a-04855704d4c3", routeValues);
442 let url = verData.requestUrl;
443 let options = this.createRequestOptions('application/json', verData.apiVersion);
444 let res;
445 res = yield this.rest.del(url, options);
446 let ret = this.formatResponse(res.result, null, false);
447 resolve(ret);
448 }
449 catch (err) {
450 reject(err);
451 }
452 }));
453 });
454 }
455 /**
456 * Moves a group to a different page and section
457 *
458 * @param {WorkItemTrackingProcessDefinitionsInterfaces.Group} group - The updated group
459 * @param {string} processId - The ID of the process
460 * @param {string} witRefName - The reference name of the work item type
461 * @param {string} pageId - The ID of the page the group is in
462 * @param {string} sectionId - The ID of the section the group is in
463 * @param {string} groupId - The ID of the group
464 * @param {string} removeFromPageId - ID of the page to remove the group from
465 * @param {string} removeFromSectionId - ID of the section to remove the group from
466 */
467 setGroupInPage(group, processId, witRefName, pageId, sectionId, groupId, removeFromPageId, removeFromSectionId) {
468 return __awaiter(this, void 0, void 0, function* () {
469 if (removeFromPageId == null) {
470 throw new TypeError('removeFromPageId can not be null or undefined');
471 }
472 if (removeFromSectionId == null) {
473 throw new TypeError('removeFromSectionId can not be null or undefined');
474 }
475 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
476 let routeValues = {
477 processId: processId,
478 witRefName: witRefName,
479 pageId: pageId,
480 sectionId: sectionId,
481 groupId: groupId
482 };
483 let queryValues = {
484 removeFromPageId: removeFromPageId,
485 removeFromSectionId: removeFromSectionId,
486 };
487 try {
488 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "2617828b-e850-4375-a92a-04855704d4c3", routeValues, queryValues);
489 let url = verData.requestUrl;
490 let options = this.createRequestOptions('application/json', verData.apiVersion);
491 let res;
492 res = yield this.rest.replace(url, group, options);
493 let ret = this.formatResponse(res.result, null, false);
494 resolve(ret);
495 }
496 catch (err) {
497 reject(err);
498 }
499 }));
500 });
501 }
502 /**
503 * Moves a group to a different section
504 *
505 * @param {WorkItemTrackingProcessDefinitionsInterfaces.Group} group - The updated group
506 * @param {string} processId - The ID of the process
507 * @param {string} witRefName - The reference name of the work item type
508 * @param {string} pageId - The ID of the page the group is in
509 * @param {string} sectionId - The ID of the section the group is in
510 * @param {string} groupId - The ID of the group
511 * @param {string} removeFromSectionId - ID of the section to remove the group from
512 */
513 setGroupInSection(group, processId, witRefName, pageId, sectionId, groupId, removeFromSectionId) {
514 return __awaiter(this, void 0, void 0, function* () {
515 if (removeFromSectionId == null) {
516 throw new TypeError('removeFromSectionId can not be null or undefined');
517 }
518 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
519 let routeValues = {
520 processId: processId,
521 witRefName: witRefName,
522 pageId: pageId,
523 sectionId: sectionId,
524 groupId: groupId
525 };
526 let queryValues = {
527 removeFromSectionId: removeFromSectionId,
528 };
529 try {
530 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "2617828b-e850-4375-a92a-04855704d4c3", routeValues, queryValues);
531 let url = verData.requestUrl;
532 let options = this.createRequestOptions('application/json', verData.apiVersion);
533 let res;
534 res = yield this.rest.replace(url, group, options);
535 let ret = this.formatResponse(res.result, null, false);
536 resolve(ret);
537 }
538 catch (err) {
539 reject(err);
540 }
541 }));
542 });
543 }
544 /**
545 * Gets the form layout
546 *
547 * @param {string} processId - The ID of the process
548 * @param {string} witRefName - The reference name of the work item type
549 */
550 getFormLayout(processId, witRefName) {
551 return __awaiter(this, void 0, void 0, function* () {
552 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
553 let routeValues = {
554 processId: processId,
555 witRefName: witRefName
556 };
557 try {
558 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "3eacc80a-ddca-4404-857a-6331aac99063", routeValues);
559 let url = verData.requestUrl;
560 let options = this.createRequestOptions('application/json', verData.apiVersion);
561 let res;
562 res = yield this.rest.get(url, options);
563 let ret = this.formatResponse(res.result, WorkItemTrackingProcessDefinitionsInterfaces.TypeInfo.FormLayout, false);
564 resolve(ret);
565 }
566 catch (err) {
567 reject(err);
568 }
569 }));
570 });
571 }
572 /**
573 * Returns meta data of the picklist.
574 *
575 */
576 getListsMetadata() {
577 return __awaiter(this, void 0, void 0, function* () {
578 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
579 let routeValues = {};
580 try {
581 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "b45cc931-98e3-44a1-b1cd-2e8e9c6dc1c6", routeValues);
582 let url = verData.requestUrl;
583 let options = this.createRequestOptions('application/json', verData.apiVersion);
584 let res;
585 res = yield this.rest.get(url, options);
586 let ret = this.formatResponse(res.result, null, true);
587 resolve(ret);
588 }
589 catch (err) {
590 reject(err);
591 }
592 }));
593 });
594 }
595 /**
596 * Creates a picklist.
597 *
598 * @param {WorkItemTrackingProcessDefinitionsInterfaces.PickListModel} picklist
599 */
600 createList(picklist) {
601 return __awaiter(this, void 0, void 0, function* () {
602 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
603 let routeValues = {};
604 try {
605 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "0b6179e2-23ce-46b2-b094-2ffa5ee70286", routeValues);
606 let url = verData.requestUrl;
607 let options = this.createRequestOptions('application/json', verData.apiVersion);
608 let res;
609 res = yield this.rest.create(url, picklist, options);
610 let ret = this.formatResponse(res.result, null, false);
611 resolve(ret);
612 }
613 catch (err) {
614 reject(err);
615 }
616 }));
617 });
618 }
619 /**
620 * Removes a picklist.
621 *
622 * @param {string} listId - The ID of the list
623 */
624 deleteList(listId) {
625 return __awaiter(this, void 0, void 0, function* () {
626 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
627 let routeValues = {
628 listId: listId
629 };
630 try {
631 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "0b6179e2-23ce-46b2-b094-2ffa5ee70286", routeValues);
632 let url = verData.requestUrl;
633 let options = this.createRequestOptions('application/json', verData.apiVersion);
634 let res;
635 res = yield this.rest.del(url, options);
636 let ret = this.formatResponse(res.result, null, false);
637 resolve(ret);
638 }
639 catch (err) {
640 reject(err);
641 }
642 }));
643 });
644 }
645 /**
646 * Returns a picklist.
647 *
648 * @param {string} listId - The ID of the list
649 */
650 getList(listId) {
651 return __awaiter(this, void 0, void 0, function* () {
652 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
653 let routeValues = {
654 listId: listId
655 };
656 try {
657 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "0b6179e2-23ce-46b2-b094-2ffa5ee70286", routeValues);
658 let url = verData.requestUrl;
659 let options = this.createRequestOptions('application/json', verData.apiVersion);
660 let res;
661 res = yield this.rest.get(url, options);
662 let ret = this.formatResponse(res.result, null, false);
663 resolve(ret);
664 }
665 catch (err) {
666 reject(err);
667 }
668 }));
669 });
670 }
671 /**
672 * Updates a list.
673 *
674 * @param {WorkItemTrackingProcessDefinitionsInterfaces.PickListModel} picklist
675 * @param {string} listId - The ID of the list
676 */
677 updateList(picklist, listId) {
678 return __awaiter(this, void 0, void 0, function* () {
679 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
680 let routeValues = {
681 listId: listId
682 };
683 try {
684 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "0b6179e2-23ce-46b2-b094-2ffa5ee70286", routeValues);
685 let url = verData.requestUrl;
686 let options = this.createRequestOptions('application/json', verData.apiVersion);
687 let res;
688 res = yield this.rest.replace(url, picklist, options);
689 let ret = this.formatResponse(res.result, null, false);
690 resolve(ret);
691 }
692 catch (err) {
693 reject(err);
694 }
695 }));
696 });
697 }
698 /**
699 * Adds a page to the work item form
700 *
701 * @param {WorkItemTrackingProcessDefinitionsInterfaces.Page} page - The page
702 * @param {string} processId - The ID of the process
703 * @param {string} witRefName - The reference name of the work item type
704 */
705 addPage(page, processId, witRefName) {
706 return __awaiter(this, void 0, void 0, function* () {
707 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
708 let routeValues = {
709 processId: processId,
710 witRefName: witRefName
711 };
712 try {
713 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "1b4ac126-59b2-4f37-b4df-0a48ba807edb", routeValues);
714 let url = verData.requestUrl;
715 let options = this.createRequestOptions('application/json', verData.apiVersion);
716 let res;
717 res = yield this.rest.create(url, page, options);
718 let ret = this.formatResponse(res.result, WorkItemTrackingProcessDefinitionsInterfaces.TypeInfo.Page, false);
719 resolve(ret);
720 }
721 catch (err) {
722 reject(err);
723 }
724 }));
725 });
726 }
727 /**
728 * Updates a page on the work item form
729 *
730 * @param {WorkItemTrackingProcessDefinitionsInterfaces.Page} page - The page
731 * @param {string} processId - The ID of the process
732 * @param {string} witRefName - The reference name of the work item type
733 */
734 editPage(page, processId, witRefName) {
735 return __awaiter(this, void 0, void 0, function* () {
736 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
737 let routeValues = {
738 processId: processId,
739 witRefName: witRefName
740 };
741 try {
742 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "1b4ac126-59b2-4f37-b4df-0a48ba807edb", routeValues);
743 let url = verData.requestUrl;
744 let options = this.createRequestOptions('application/json', verData.apiVersion);
745 let res;
746 res = yield this.rest.update(url, page, options);
747 let ret = this.formatResponse(res.result, WorkItemTrackingProcessDefinitionsInterfaces.TypeInfo.Page, false);
748 resolve(ret);
749 }
750 catch (err) {
751 reject(err);
752 }
753 }));
754 });
755 }
756 /**
757 * Removes a page from the work item form
758 *
759 * @param {string} processId - The ID of the process
760 * @param {string} witRefName - The reference name of the work item type
761 * @param {string} pageId - The ID of the page
762 */
763 removePage(processId, witRefName, pageId) {
764 return __awaiter(this, void 0, void 0, function* () {
765 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
766 let routeValues = {
767 processId: processId,
768 witRefName: witRefName,
769 pageId: pageId
770 };
771 try {
772 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "1b4ac126-59b2-4f37-b4df-0a48ba807edb", routeValues);
773 let url = verData.requestUrl;
774 let options = this.createRequestOptions('application/json', verData.apiVersion);
775 let res;
776 res = yield this.rest.del(url, options);
777 let ret = this.formatResponse(res.result, null, false);
778 resolve(ret);
779 }
780 catch (err) {
781 reject(err);
782 }
783 }));
784 });
785 }
786 /**
787 * Creates a state definition in the work item type of the process.
788 *
789 * @param {WorkItemTrackingProcessDefinitionsInterfaces.WorkItemStateInputModel} stateModel
790 * @param {string} processId - The ID of the process
791 * @param {string} witRefName - The reference name of the work item type
792 */
793 createStateDefinition(stateModel, processId, witRefName) {
794 return __awaiter(this, void 0, void 0, function* () {
795 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
796 let routeValues = {
797 processId: processId,
798 witRefName: witRefName
799 };
800 try {
801 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "4303625d-08f4-4461-b14b-32c65bba5599", routeValues);
802 let url = verData.requestUrl;
803 let options = this.createRequestOptions('application/json', verData.apiVersion);
804 let res;
805 res = yield this.rest.create(url, stateModel, options);
806 let ret = this.formatResponse(res.result, null, false);
807 resolve(ret);
808 }
809 catch (err) {
810 reject(err);
811 }
812 }));
813 });
814 }
815 /**
816 * Removes a state definition in the work item type of the process.
817 *
818 * @param {string} processId - ID of the process
819 * @param {string} witRefName - The reference name of the work item type
820 * @param {string} stateId - ID of the state
821 */
822 deleteStateDefinition(processId, witRefName, stateId) {
823 return __awaiter(this, void 0, void 0, function* () {
824 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
825 let routeValues = {
826 processId: processId,
827 witRefName: witRefName,
828 stateId: stateId
829 };
830 try {
831 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "4303625d-08f4-4461-b14b-32c65bba5599", routeValues);
832 let url = verData.requestUrl;
833 let options = this.createRequestOptions('application/json', verData.apiVersion);
834 let res;
835 res = yield this.rest.del(url, options);
836 let ret = this.formatResponse(res.result, null, false);
837 resolve(ret);
838 }
839 catch (err) {
840 reject(err);
841 }
842 }));
843 });
844 }
845 /**
846 * Returns a state definition in the work item type of the process.
847 *
848 * @param {string} processId - The ID of the process
849 * @param {string} witRefName - The reference name of the work item type
850 * @param {string} stateId - The ID of the state
851 */
852 getStateDefinition(processId, witRefName, stateId) {
853 return __awaiter(this, void 0, void 0, function* () {
854 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
855 let routeValues = {
856 processId: processId,
857 witRefName: witRefName,
858 stateId: stateId
859 };
860 try {
861 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "4303625d-08f4-4461-b14b-32c65bba5599", routeValues);
862 let url = verData.requestUrl;
863 let options = this.createRequestOptions('application/json', verData.apiVersion);
864 let res;
865 res = yield this.rest.get(url, options);
866 let ret = this.formatResponse(res.result, null, false);
867 resolve(ret);
868 }
869 catch (err) {
870 reject(err);
871 }
872 }));
873 });
874 }
875 /**
876 * Returns a list of all state definitions in the work item type of the process.
877 *
878 * @param {string} processId - The ID of the process
879 * @param {string} witRefName - The reference name of the work item type
880 */
881 getStateDefinitions(processId, witRefName) {
882 return __awaiter(this, void 0, void 0, function* () {
883 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
884 let routeValues = {
885 processId: processId,
886 witRefName: witRefName
887 };
888 try {
889 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "4303625d-08f4-4461-b14b-32c65bba5599", routeValues);
890 let url = verData.requestUrl;
891 let options = this.createRequestOptions('application/json', verData.apiVersion);
892 let res;
893 res = yield this.rest.get(url, options);
894 let ret = this.formatResponse(res.result, null, true);
895 resolve(ret);
896 }
897 catch (err) {
898 reject(err);
899 }
900 }));
901 });
902 }
903 /**
904 * Hides a state definition in the work item type of the process.
905 *
906 * @param {WorkItemTrackingProcessDefinitionsInterfaces.HideStateModel} hideStateModel
907 * @param {string} processId - The ID of the process
908 * @param {string} witRefName - The reference name of the work item type
909 * @param {string} stateId - The ID of the state
910 */
911 hideStateDefinition(hideStateModel, processId, witRefName, stateId) {
912 return __awaiter(this, void 0, void 0, function* () {
913 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
914 let routeValues = {
915 processId: processId,
916 witRefName: witRefName,
917 stateId: stateId
918 };
919 try {
920 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "4303625d-08f4-4461-b14b-32c65bba5599", routeValues);
921 let url = verData.requestUrl;
922 let options = this.createRequestOptions('application/json', verData.apiVersion);
923 let res;
924 res = yield this.rest.replace(url, hideStateModel, options);
925 let ret = this.formatResponse(res.result, null, false);
926 resolve(ret);
927 }
928 catch (err) {
929 reject(err);
930 }
931 }));
932 });
933 }
934 /**
935 * Updates a given state definition in the work item type of the process.
936 *
937 * @param {WorkItemTrackingProcessDefinitionsInterfaces.WorkItemStateInputModel} stateModel
938 * @param {string} processId - ID of the process
939 * @param {string} witRefName - The reference name of the work item type
940 * @param {string} stateId - ID of the state
941 */
942 updateStateDefinition(stateModel, processId, witRefName, stateId) {
943 return __awaiter(this, void 0, void 0, function* () {
944 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
945 let routeValues = {
946 processId: processId,
947 witRefName: witRefName,
948 stateId: stateId
949 };
950 try {
951 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "4303625d-08f4-4461-b14b-32c65bba5599", routeValues);
952 let url = verData.requestUrl;
953 let options = this.createRequestOptions('application/json', verData.apiVersion);
954 let res;
955 res = yield this.rest.update(url, stateModel, options);
956 let ret = this.formatResponse(res.result, null, false);
957 resolve(ret);
958 }
959 catch (err) {
960 reject(err);
961 }
962 }));
963 });
964 }
965 /**
966 * Adds a behavior to the work item type of the process.
967 *
968 * @param {WorkItemTrackingProcessDefinitionsInterfaces.WorkItemTypeBehavior} behavior
969 * @param {string} processId - The ID of the process
970 * @param {string} witRefNameForBehaviors - Work item type reference name for the behavior
971 */
972 addBehaviorToWorkItemType(behavior, processId, witRefNameForBehaviors) {
973 return __awaiter(this, void 0, void 0, function* () {
974 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
975 let routeValues = {
976 processId: processId,
977 witRefNameForBehaviors: witRefNameForBehaviors
978 };
979 try {
980 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "921dfb88-ef57-4c69-94e5-dd7da2d7031d", routeValues);
981 let url = verData.requestUrl;
982 let options = this.createRequestOptions('application/json', verData.apiVersion);
983 let res;
984 res = yield this.rest.create(url, behavior, options);
985 let ret = this.formatResponse(res.result, null, false);
986 resolve(ret);
987 }
988 catch (err) {
989 reject(err);
990 }
991 }));
992 });
993 }
994 /**
995 * Returns a behavior for the work item type of the process.
996 *
997 * @param {string} processId - The ID of the process
998 * @param {string} witRefNameForBehaviors - Work item type reference name for the behavior
999 * @param {string} behaviorRefName - The reference name of the behavior
1000 */
1001 getBehaviorForWorkItemType(processId, witRefNameForBehaviors, behaviorRefName) {
1002 return __awaiter(this, void 0, void 0, function* () {
1003 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1004 let routeValues = {
1005 processId: processId,
1006 witRefNameForBehaviors: witRefNameForBehaviors,
1007 behaviorRefName: behaviorRefName
1008 };
1009 try {
1010 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "921dfb88-ef57-4c69-94e5-dd7da2d7031d", routeValues);
1011 let url = verData.requestUrl;
1012 let options = this.createRequestOptions('application/json', verData.apiVersion);
1013 let res;
1014 res = yield this.rest.get(url, options);
1015 let ret = this.formatResponse(res.result, null, false);
1016 resolve(ret);
1017 }
1018 catch (err) {
1019 reject(err);
1020 }
1021 }));
1022 });
1023 }
1024 /**
1025 * Returns a list of all behaviors for the work item type of the process.
1026 *
1027 * @param {string} processId - The ID of the process
1028 * @param {string} witRefNameForBehaviors - Work item type reference name for the behavior
1029 */
1030 getBehaviorsForWorkItemType(processId, witRefNameForBehaviors) {
1031 return __awaiter(this, void 0, void 0, function* () {
1032 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1033 let routeValues = {
1034 processId: processId,
1035 witRefNameForBehaviors: witRefNameForBehaviors
1036 };
1037 try {
1038 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "921dfb88-ef57-4c69-94e5-dd7da2d7031d", routeValues);
1039 let url = verData.requestUrl;
1040 let options = this.createRequestOptions('application/json', verData.apiVersion);
1041 let res;
1042 res = yield this.rest.get(url, options);
1043 let ret = this.formatResponse(res.result, null, true);
1044 resolve(ret);
1045 }
1046 catch (err) {
1047 reject(err);
1048 }
1049 }));
1050 });
1051 }
1052 /**
1053 * Removes a behavior for the work item type of the process.
1054 *
1055 * @param {string} processId - The ID of the process
1056 * @param {string} witRefNameForBehaviors - Work item type reference name for the behavior
1057 * @param {string} behaviorRefName - The reference name of the behavior
1058 */
1059 removeBehaviorFromWorkItemType(processId, witRefNameForBehaviors, behaviorRefName) {
1060 return __awaiter(this, void 0, void 0, function* () {
1061 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1062 let routeValues = {
1063 processId: processId,
1064 witRefNameForBehaviors: witRefNameForBehaviors,
1065 behaviorRefName: behaviorRefName
1066 };
1067 try {
1068 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "921dfb88-ef57-4c69-94e5-dd7da2d7031d", routeValues);
1069 let url = verData.requestUrl;
1070 let options = this.createRequestOptions('application/json', verData.apiVersion);
1071 let res;
1072 res = yield this.rest.del(url, options);
1073 let ret = this.formatResponse(res.result, null, false);
1074 resolve(ret);
1075 }
1076 catch (err) {
1077 reject(err);
1078 }
1079 }));
1080 });
1081 }
1082 /**
1083 * Updates default work item type for the behavior of the process.
1084 *
1085 * @param {WorkItemTrackingProcessDefinitionsInterfaces.WorkItemTypeBehavior} behavior
1086 * @param {string} processId - The ID of the process
1087 * @param {string} witRefNameForBehaviors - Work item type reference name for the behavior
1088 */
1089 updateBehaviorToWorkItemType(behavior, processId, witRefNameForBehaviors) {
1090 return __awaiter(this, void 0, void 0, function* () {
1091 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1092 let routeValues = {
1093 processId: processId,
1094 witRefNameForBehaviors: witRefNameForBehaviors
1095 };
1096 try {
1097 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "921dfb88-ef57-4c69-94e5-dd7da2d7031d", routeValues);
1098 let url = verData.requestUrl;
1099 let options = this.createRequestOptions('application/json', verData.apiVersion);
1100 let res;
1101 res = yield this.rest.update(url, behavior, options);
1102 let ret = this.formatResponse(res.result, null, false);
1103 resolve(ret);
1104 }
1105 catch (err) {
1106 reject(err);
1107 }
1108 }));
1109 });
1110 }
1111 /**
1112 * Creates a work item type in the process.
1113 *
1114 * @param {WorkItemTrackingProcessDefinitionsInterfaces.WorkItemTypeModel} workItemType
1115 * @param {string} processId - The ID of the process
1116 */
1117 createWorkItemType(workItemType, processId) {
1118 return __awaiter(this, void 0, void 0, function* () {
1119 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1120 let routeValues = {
1121 processId: processId
1122 };
1123 try {
1124 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "1ce0acad-4638-49c3-969c-04aa65ba6bea", routeValues);
1125 let url = verData.requestUrl;
1126 let options = this.createRequestOptions('application/json', verData.apiVersion);
1127 let res;
1128 res = yield this.rest.create(url, workItemType, options);
1129 let ret = this.formatResponse(res.result, WorkItemTrackingProcessDefinitionsInterfaces.TypeInfo.WorkItemTypeModel, false);
1130 resolve(ret);
1131 }
1132 catch (err) {
1133 reject(err);
1134 }
1135 }));
1136 });
1137 }
1138 /**
1139 * Removes a work item type in the process.
1140 *
1141 * @param {string} processId - The ID of the process
1142 * @param {string} witRefName - The reference name of the work item type
1143 */
1144 deleteWorkItemType(processId, witRefName) {
1145 return __awaiter(this, void 0, void 0, function* () {
1146 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1147 let routeValues = {
1148 processId: processId,
1149 witRefName: witRefName
1150 };
1151 try {
1152 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "1ce0acad-4638-49c3-969c-04aa65ba6bea", routeValues);
1153 let url = verData.requestUrl;
1154 let options = this.createRequestOptions('application/json', verData.apiVersion);
1155 let res;
1156 res = yield this.rest.del(url, options);
1157 let ret = this.formatResponse(res.result, null, false);
1158 resolve(ret);
1159 }
1160 catch (err) {
1161 reject(err);
1162 }
1163 }));
1164 });
1165 }
1166 /**
1167 * Returns a work item type of the process.
1168 *
1169 * @param {string} processId - The ID of the process
1170 * @param {string} witRefName - The reference name of the work item type
1171 * @param {WorkItemTrackingProcessDefinitionsInterfaces.GetWorkItemTypeExpand} expand
1172 */
1173 getWorkItemType(processId, witRefName, expand) {
1174 return __awaiter(this, void 0, void 0, function* () {
1175 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1176 let routeValues = {
1177 processId: processId,
1178 witRefName: witRefName
1179 };
1180 let queryValues = {
1181 '$expand': expand,
1182 };
1183 try {
1184 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "1ce0acad-4638-49c3-969c-04aa65ba6bea", routeValues, queryValues);
1185 let url = verData.requestUrl;
1186 let options = this.createRequestOptions('application/json', verData.apiVersion);
1187 let res;
1188 res = yield this.rest.get(url, options);
1189 let ret = this.formatResponse(res.result, WorkItemTrackingProcessDefinitionsInterfaces.TypeInfo.WorkItemTypeModel, false);
1190 resolve(ret);
1191 }
1192 catch (err) {
1193 reject(err);
1194 }
1195 }));
1196 });
1197 }
1198 /**
1199 * Returns a list of all work item types in the process.
1200 *
1201 * @param {string} processId - The ID of the process
1202 * @param {WorkItemTrackingProcessDefinitionsInterfaces.GetWorkItemTypeExpand} expand
1203 */
1204 getWorkItemTypes(processId, expand) {
1205 return __awaiter(this, void 0, void 0, function* () {
1206 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1207 let routeValues = {
1208 processId: processId
1209 };
1210 let queryValues = {
1211 '$expand': expand,
1212 };
1213 try {
1214 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "1ce0acad-4638-49c3-969c-04aa65ba6bea", routeValues, queryValues);
1215 let url = verData.requestUrl;
1216 let options = this.createRequestOptions('application/json', verData.apiVersion);
1217 let res;
1218 res = yield this.rest.get(url, options);
1219 let ret = this.formatResponse(res.result, WorkItemTrackingProcessDefinitionsInterfaces.TypeInfo.WorkItemTypeModel, true);
1220 resolve(ret);
1221 }
1222 catch (err) {
1223 reject(err);
1224 }
1225 }));
1226 });
1227 }
1228 /**
1229 * Updates a work item type of the process.
1230 *
1231 * @param {WorkItemTrackingProcessDefinitionsInterfaces.WorkItemTypeUpdateModel} workItemTypeUpdate
1232 * @param {string} processId - The ID of the process
1233 * @param {string} witRefName - The reference name of the work item type
1234 */
1235 updateWorkItemType(workItemTypeUpdate, processId, witRefName) {
1236 return __awaiter(this, void 0, void 0, function* () {
1237 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1238 let routeValues = {
1239 processId: processId,
1240 witRefName: witRefName
1241 };
1242 try {
1243 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "1ce0acad-4638-49c3-969c-04aa65ba6bea", routeValues);
1244 let url = verData.requestUrl;
1245 let options = this.createRequestOptions('application/json', verData.apiVersion);
1246 let res;
1247 res = yield this.rest.update(url, workItemTypeUpdate, options);
1248 let ret = this.formatResponse(res.result, WorkItemTrackingProcessDefinitionsInterfaces.TypeInfo.WorkItemTypeModel, false);
1249 resolve(ret);
1250 }
1251 catch (err) {
1252 reject(err);
1253 }
1254 }));
1255 });
1256 }
1257 /**
1258 * Adds a field to the work item type in the process.
1259 *
1260 * @param {WorkItemTrackingProcessDefinitionsInterfaces.WorkItemTypeFieldModel2} field
1261 * @param {string} processId - The ID of the process
1262 * @param {string} witRefNameForFields - Work item type reference name for the field
1263 */
1264 addFieldToWorkItemType(field, processId, witRefNameForFields) {
1265 return __awaiter(this, void 0, void 0, function* () {
1266 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1267 let routeValues = {
1268 processId: processId,
1269 witRefNameForFields: witRefNameForFields
1270 };
1271 try {
1272 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "976713b4-a62e-499e-94dc-eeb869ea9126", routeValues);
1273 let url = verData.requestUrl;
1274 let options = this.createRequestOptions('application/json', verData.apiVersion);
1275 let res;
1276 res = yield this.rest.create(url, field, options);
1277 let ret = this.formatResponse(res.result, WorkItemTrackingProcessDefinitionsInterfaces.TypeInfo.WorkItemTypeFieldModel2, false);
1278 resolve(ret);
1279 }
1280 catch (err) {
1281 reject(err);
1282 }
1283 }));
1284 });
1285 }
1286 /**
1287 * Returns a single field in the work item type of the process.
1288 *
1289 * @param {string} processId - The ID of the process
1290 * @param {string} witRefNameForFields - Work item type reference name for fields
1291 * @param {string} fieldRefName - The reference name of the field
1292 */
1293 getWorkItemTypeField(processId, witRefNameForFields, fieldRefName) {
1294 return __awaiter(this, void 0, void 0, function* () {
1295 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1296 let routeValues = {
1297 processId: processId,
1298 witRefNameForFields: witRefNameForFields,
1299 fieldRefName: fieldRefName
1300 };
1301 try {
1302 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "976713b4-a62e-499e-94dc-eeb869ea9126", routeValues);
1303 let url = verData.requestUrl;
1304 let options = this.createRequestOptions('application/json', verData.apiVersion);
1305 let res;
1306 res = yield this.rest.get(url, options);
1307 let ret = this.formatResponse(res.result, WorkItemTrackingProcessDefinitionsInterfaces.TypeInfo.WorkItemTypeFieldModel2, false);
1308 resolve(ret);
1309 }
1310 catch (err) {
1311 reject(err);
1312 }
1313 }));
1314 });
1315 }
1316 /**
1317 * Returns a list of all fields in the work item type of the process.
1318 *
1319 * @param {string} processId - The ID of the process
1320 * @param {string} witRefNameForFields - Work item type reference name for fields
1321 */
1322 getWorkItemTypeFields(processId, witRefNameForFields) {
1323 return __awaiter(this, void 0, void 0, function* () {
1324 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1325 let routeValues = {
1326 processId: processId,
1327 witRefNameForFields: witRefNameForFields
1328 };
1329 try {
1330 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "976713b4-a62e-499e-94dc-eeb869ea9126", routeValues);
1331 let url = verData.requestUrl;
1332 let options = this.createRequestOptions('application/json', verData.apiVersion);
1333 let res;
1334 res = yield this.rest.get(url, options);
1335 let ret = this.formatResponse(res.result, WorkItemTrackingProcessDefinitionsInterfaces.TypeInfo.WorkItemTypeFieldModel2, true);
1336 resolve(ret);
1337 }
1338 catch (err) {
1339 reject(err);
1340 }
1341 }));
1342 });
1343 }
1344 /**
1345 * Removes a field in the work item type of the process.
1346 *
1347 * @param {string} processId - The ID of the process
1348 * @param {string} witRefNameForFields - Work item type reference name for fields
1349 * @param {string} fieldRefName - The reference name of the field
1350 */
1351 removeFieldFromWorkItemType(processId, witRefNameForFields, fieldRefName) {
1352 return __awaiter(this, void 0, void 0, function* () {
1353 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1354 let routeValues = {
1355 processId: processId,
1356 witRefNameForFields: witRefNameForFields,
1357 fieldRefName: fieldRefName
1358 };
1359 try {
1360 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "976713b4-a62e-499e-94dc-eeb869ea9126", routeValues);
1361 let url = verData.requestUrl;
1362 let options = this.createRequestOptions('application/json', verData.apiVersion);
1363 let res;
1364 res = yield this.rest.del(url, options);
1365 let ret = this.formatResponse(res.result, null, false);
1366 resolve(ret);
1367 }
1368 catch (err) {
1369 reject(err);
1370 }
1371 }));
1372 });
1373 }
1374 /**
1375 * Updates a single field in the scope of the given process and work item type.
1376 *
1377 * @param {WorkItemTrackingProcessDefinitionsInterfaces.WorkItemTypeFieldModel2} field - The model with which to update the field
1378 * @param {string} processId - The ID of the process
1379 * @param {string} witRefNameForFields - Work item type reference name for fields
1380 */
1381 updateWorkItemTypeField(field, processId, witRefNameForFields) {
1382 return __awaiter(this, void 0, void 0, function* () {
1383 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1384 let routeValues = {
1385 processId: processId,
1386 witRefNameForFields: witRefNameForFields
1387 };
1388 try {
1389 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "976713b4-a62e-499e-94dc-eeb869ea9126", routeValues);
1390 let url = verData.requestUrl;
1391 let options = this.createRequestOptions('application/json', verData.apiVersion);
1392 let res;
1393 res = yield this.rest.update(url, field, options);
1394 let ret = this.formatResponse(res.result, WorkItemTrackingProcessDefinitionsInterfaces.TypeInfo.WorkItemTypeFieldModel2, false);
1395 resolve(ret);
1396 }
1397 catch (err) {
1398 reject(err);
1399 }
1400 }));
1401 });
1402 }
1403}
1404exports.WorkItemTrackingProcessDefinitionsApi = WorkItemTrackingProcessDefinitionsApi;
1405WorkItemTrackingProcessDefinitionsApi.RESOURCE_AREA_ID = "5264459e-e5e0-4bd8-b118-0985e68a4ec5";