UNPKG

67.3 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.TestPlanApi = void 0;
22const basem = require("./ClientApiBases");
23const TestPlanInterfaces = require("./interfaces/TestPlanInterfaces");
24class TestPlanApi extends basem.ClientApiBase {
25 constructor(baseUrl, handlers, options) {
26 super(baseUrl, handlers, 'node-TestPlan-api', options);
27 }
28 /**
29 * Create a test configuration.
30 *
31 * @param {TestPlanInterfaces.TestConfigurationCreateUpdateParameters} testConfigurationCreateUpdateParameters - TestConfigurationCreateUpdateParameters
32 * @param {string} project - Project ID or project name
33 */
34 createTestConfiguration(testConfigurationCreateUpdateParameters, project) {
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 project: project
39 };
40 try {
41 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "8369318e-38fa-4e84-9043-4b2a75d2c256", 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, testConfigurationCreateUpdateParameters, options);
46 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestConfiguration, false);
47 resolve(ret);
48 }
49 catch (err) {
50 reject(err);
51 }
52 }));
53 });
54 }
55 /**
56 * Delete a test configuration by its ID.
57 *
58 * @param {string} project - Project ID or project name
59 * @param {number} testConfiguartionId - ID of the test configuration to delete.
60 */
61 deleteTestConfguration(project, testConfiguartionId) {
62 return __awaiter(this, void 0, void 0, function* () {
63 if (testConfiguartionId == null) {
64 throw new TypeError('testConfiguartionId can not be null or undefined');
65 }
66 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
67 let routeValues = {
68 project: project
69 };
70 let queryValues = {
71 testConfiguartionId: testConfiguartionId,
72 };
73 try {
74 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "8369318e-38fa-4e84-9043-4b2a75d2c256", routeValues, queryValues);
75 let url = verData.requestUrl;
76 let options = this.createRequestOptions('application/json', verData.apiVersion);
77 let res;
78 res = yield this.rest.del(url, options);
79 let ret = this.formatResponse(res.result, null, false);
80 resolve(ret);
81 }
82 catch (err) {
83 reject(err);
84 }
85 }));
86 });
87 }
88 /**
89 * Get a test configuration
90 *
91 * @param {string} project - Project ID or project name
92 * @param {number} testConfigurationId - ID of the test configuration to get.
93 */
94 getTestConfigurationById(project, testConfigurationId) {
95 return __awaiter(this, void 0, void 0, function* () {
96 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
97 let routeValues = {
98 project: project,
99 testConfigurationId: testConfigurationId
100 };
101 try {
102 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "8369318e-38fa-4e84-9043-4b2a75d2c256", routeValues);
103 let url = verData.requestUrl;
104 let options = this.createRequestOptions('application/json', verData.apiVersion);
105 let res;
106 res = yield this.rest.get(url, options);
107 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestConfiguration, false);
108 resolve(ret);
109 }
110 catch (err) {
111 reject(err);
112 }
113 }));
114 });
115 }
116 /**
117 * Get a list of test configurations.
118 *
119 * @param {string} project - Project ID or project name
120 * @param {string} continuationToken - If the list of configurations returned is not complete, a continuation token to query next batch of configurations is included in the response header as "x-ms-continuationtoken". Omit this parameter to get the first batch of test configurations.
121 */
122 getTestConfigurations(project, continuationToken) {
123 return __awaiter(this, void 0, void 0, function* () {
124 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
125 let routeValues = {
126 project: project
127 };
128 let queryValues = {
129 continuationToken: continuationToken,
130 };
131 try {
132 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "8369318e-38fa-4e84-9043-4b2a75d2c256", routeValues, queryValues);
133 let url = verData.requestUrl;
134 let options = this.createRequestOptions('application/json', verData.apiVersion);
135 let res;
136 res = yield this.rest.get(url, options);
137 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestConfiguration, true);
138 resolve(ret);
139 }
140 catch (err) {
141 reject(err);
142 }
143 }));
144 });
145 }
146 /**
147 * Update a test configuration by its ID.
148 *
149 * @param {TestPlanInterfaces.TestConfigurationCreateUpdateParameters} testConfigurationCreateUpdateParameters - TestConfigurationCreateUpdateParameters
150 * @param {string} project - Project ID or project name
151 * @param {number} testConfiguartionId - ID of the test configuration to update.
152 */
153 updateTestConfiguration(testConfigurationCreateUpdateParameters, project, testConfiguartionId) {
154 return __awaiter(this, void 0, void 0, function* () {
155 if (testConfiguartionId == null) {
156 throw new TypeError('testConfiguartionId can not be null or undefined');
157 }
158 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
159 let routeValues = {
160 project: project
161 };
162 let queryValues = {
163 testConfiguartionId: testConfiguartionId,
164 };
165 try {
166 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "8369318e-38fa-4e84-9043-4b2a75d2c256", routeValues, queryValues);
167 let url = verData.requestUrl;
168 let options = this.createRequestOptions('application/json', verData.apiVersion);
169 let res;
170 res = yield this.rest.update(url, testConfigurationCreateUpdateParameters, options);
171 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestConfiguration, false);
172 resolve(ret);
173 }
174 catch (err) {
175 reject(err);
176 }
177 }));
178 });
179 }
180 /**
181 * @param {string} project - Project ID or project name
182 * @param {number} planId
183 * @param {string} states
184 * @param {TestPlanInterfaces.UserFriendlyTestOutcome} outcome
185 * @param {string} configurations
186 * @param {string} testers
187 * @param {string} assignedTo
188 * @param {TestPlanInterfaces.TestEntityTypes} entity
189 */
190 getTestEntityCountByPlanId(project, planId, states, outcome, configurations, testers, assignedTo, entity) {
191 return __awaiter(this, void 0, void 0, function* () {
192 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
193 let routeValues = {
194 project: project,
195 planId: planId
196 };
197 let queryValues = {
198 states: states,
199 outcome: outcome,
200 configurations: configurations,
201 testers: testers,
202 assignedTo: assignedTo,
203 entity: entity,
204 };
205 try {
206 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "300578da-7b40-4c1e-9542-7aed6029e504", routeValues, queryValues);
207 let url = verData.requestUrl;
208 let options = this.createRequestOptions('application/json', verData.apiVersion);
209 let res;
210 res = yield this.rest.get(url, options);
211 let ret = this.formatResponse(res.result, null, true);
212 resolve(ret);
213 }
214 catch (err) {
215 reject(err);
216 }
217 }));
218 });
219 }
220 /**
221 * Create a test plan.
222 *
223 * @param {TestPlanInterfaces.TestPlanCreateParams} testPlanCreateParams - A testPlanCreateParams object.TestPlanCreateParams
224 * @param {string} project - Project ID or project name
225 */
226 createTestPlan(testPlanCreateParams, project) {
227 return __awaiter(this, void 0, void 0, function* () {
228 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
229 let routeValues = {
230 project: project
231 };
232 try {
233 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "0e292477-a0c2-47f3-a9b6-34f153d627f4", routeValues);
234 let url = verData.requestUrl;
235 let options = this.createRequestOptions('application/json', verData.apiVersion);
236 let res;
237 res = yield this.rest.create(url, testPlanCreateParams, options);
238 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestPlan, false);
239 resolve(ret);
240 }
241 catch (err) {
242 reject(err);
243 }
244 }));
245 });
246 }
247 /**
248 * Delete a test plan.
249 *
250 * @param {string} project - Project ID or project name
251 * @param {number} planId - ID of the test plan to be deleted.
252 */
253 deleteTestPlan(project, planId) {
254 return __awaiter(this, void 0, void 0, function* () {
255 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
256 let routeValues = {
257 project: project,
258 planId: planId
259 };
260 try {
261 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "0e292477-a0c2-47f3-a9b6-34f153d627f4", routeValues);
262 let url = verData.requestUrl;
263 let options = this.createRequestOptions('application/json', verData.apiVersion);
264 let res;
265 res = yield this.rest.del(url, options);
266 let ret = this.formatResponse(res.result, null, false);
267 resolve(ret);
268 }
269 catch (err) {
270 reject(err);
271 }
272 }));
273 });
274 }
275 /**
276 * Get a test plan by Id.
277 *
278 * @param {string} project - Project ID or project name
279 * @param {number} planId - ID of the test plan to get.
280 */
281 getTestPlanById(project, planId) {
282 return __awaiter(this, void 0, void 0, function* () {
283 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
284 let routeValues = {
285 project: project,
286 planId: planId
287 };
288 try {
289 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "0e292477-a0c2-47f3-a9b6-34f153d627f4", routeValues);
290 let url = verData.requestUrl;
291 let options = this.createRequestOptions('application/json', verData.apiVersion);
292 let res;
293 res = yield this.rest.get(url, options);
294 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestPlan, false);
295 resolve(ret);
296 }
297 catch (err) {
298 reject(err);
299 }
300 }));
301 });
302 }
303 /**
304 * Get a list of test plans
305 *
306 * @param {string} project - Project ID or project name
307 * @param {string} owner - Filter for test plan by owner ID or name
308 * @param {string} continuationToken - If the list of plans returned is not complete, a continuation token to query next batch of plans is included in the response header as "x-ms-continuationtoken". Omit this parameter to get the first batch of test plans.
309 * @param {boolean} includePlanDetails - Get all properties of the test plan
310 * @param {boolean} filterActivePlans - Get just the active plans
311 */
312 getTestPlans(project, owner, continuationToken, includePlanDetails, filterActivePlans) {
313 return __awaiter(this, void 0, void 0, function* () {
314 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
315 let routeValues = {
316 project: project
317 };
318 let queryValues = {
319 owner: owner,
320 continuationToken: continuationToken,
321 includePlanDetails: includePlanDetails,
322 filterActivePlans: filterActivePlans,
323 };
324 try {
325 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "0e292477-a0c2-47f3-a9b6-34f153d627f4", routeValues, queryValues);
326 let url = verData.requestUrl;
327 let options = this.createRequestOptions('application/json', verData.apiVersion);
328 let res;
329 res = yield this.rest.get(url, options);
330 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestPlan, true);
331 resolve(ret);
332 }
333 catch (err) {
334 reject(err);
335 }
336 }));
337 });
338 }
339 /**
340 * Update a test plan.
341 *
342 * @param {TestPlanInterfaces.TestPlanUpdateParams} testPlanUpdateParams - A testPlanUpdateParams object.TestPlanUpdateParams
343 * @param {string} project - Project ID or project name
344 * @param {number} planId - ID of the test plan to be updated.
345 */
346 updateTestPlan(testPlanUpdateParams, project, planId) {
347 return __awaiter(this, void 0, void 0, function* () {
348 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
349 let routeValues = {
350 project: project,
351 planId: planId
352 };
353 try {
354 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "0e292477-a0c2-47f3-a9b6-34f153d627f4", routeValues);
355 let url = verData.requestUrl;
356 let options = this.createRequestOptions('application/json', verData.apiVersion);
357 let res;
358 res = yield this.rest.update(url, testPlanUpdateParams, options);
359 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestPlan, false);
360 resolve(ret);
361 }
362 catch (err) {
363 reject(err);
364 }
365 }));
366 });
367 }
368 /**
369 * Get a list of test suite entries in the test suite.
370 *
371 * @param {string} project - Project ID or project name
372 * @param {number} suiteId - Id of the parent suite.
373 * @param {TestPlanInterfaces.SuiteEntryTypes} suiteEntryType
374 */
375 getSuiteEntries(project, suiteId, suiteEntryType) {
376 return __awaiter(this, void 0, void 0, function* () {
377 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
378 let routeValues = {
379 project: project,
380 suiteId: suiteId
381 };
382 let queryValues = {
383 suiteEntryType: suiteEntryType,
384 };
385 try {
386 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "d6733edf-72f1-4252-925b-c560dfe9b75a", routeValues, queryValues);
387 let url = verData.requestUrl;
388 let options = this.createRequestOptions('application/json', verData.apiVersion);
389 let res;
390 res = yield this.rest.get(url, options);
391 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.SuiteEntry, true);
392 resolve(ret);
393 }
394 catch (err) {
395 reject(err);
396 }
397 }));
398 });
399 }
400 /**
401 * Reorder test suite entries in the test suite.
402 *
403 * @param {TestPlanInterfaces.SuiteEntryUpdateParams[]} suiteEntries - List of SuiteEntry to reorder.
404 * @param {string} project - Project ID or project name
405 * @param {number} suiteId - Id of the parent test suite.
406 */
407 reorderSuiteEntries(suiteEntries, project, suiteId) {
408 return __awaiter(this, void 0, void 0, function* () {
409 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
410 let routeValues = {
411 project: project,
412 suiteId: suiteId
413 };
414 try {
415 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "d6733edf-72f1-4252-925b-c560dfe9b75a", routeValues);
416 let url = verData.requestUrl;
417 let options = this.createRequestOptions('application/json', verData.apiVersion);
418 let res;
419 res = yield this.rest.update(url, suiteEntries, options);
420 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.SuiteEntry, true);
421 resolve(ret);
422 }
423 catch (err) {
424 reject(err);
425 }
426 }));
427 });
428 }
429 /**
430 * Create bulk requirement based test suites.
431 *
432 * @param {TestPlanInterfaces.TestSuiteCreateParams[]} testSuiteCreateParams - Parameters for suite creation
433 * @param {string} project - Project ID or project name
434 * @param {number} planId - ID of the test plan where requirement based suites need to be created.
435 * @param {number} parentSuiteId - ID of the parent suite under which requirement based suites will be created
436 */
437 createBulkTestSuites(testSuiteCreateParams, project, planId, parentSuiteId) {
438 return __awaiter(this, void 0, void 0, function* () {
439 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
440 let routeValues = {
441 project: project,
442 planId: planId,
443 parentSuiteId: parentSuiteId
444 };
445 try {
446 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "1e58fbe6-1761-43ce-97f6-5492ec9d438e", routeValues);
447 let url = verData.requestUrl;
448 let options = this.createRequestOptions('application/json', verData.apiVersion);
449 let res;
450 res = yield this.rest.create(url, testSuiteCreateParams, options);
451 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestSuite, true);
452 resolve(ret);
453 }
454 catch (err) {
455 reject(err);
456 }
457 }));
458 });
459 }
460 /**
461 * Create test suite.
462 *
463 * @param {TestPlanInterfaces.TestSuiteCreateParams} testSuiteCreateParams - Parameters for suite creation
464 * @param {string} project - Project ID or project name
465 * @param {number} planId - ID of the test plan that contains the suites.
466 */
467 createTestSuite(testSuiteCreateParams, project, planId) {
468 return __awaiter(this, void 0, void 0, function* () {
469 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
470 let routeValues = {
471 project: project,
472 planId: planId
473 };
474 try {
475 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "1046d5d3-ab61-4ca7-a65a-36118a978256", routeValues);
476 let url = verData.requestUrl;
477 let options = this.createRequestOptions('application/json', verData.apiVersion);
478 let res;
479 res = yield this.rest.create(url, testSuiteCreateParams, options);
480 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestSuite, false);
481 resolve(ret);
482 }
483 catch (err) {
484 reject(err);
485 }
486 }));
487 });
488 }
489 /**
490 * Delete test suite.
491 *
492 * @param {string} project - Project ID or project name
493 * @param {number} planId - ID of the test plan that contains the suite.
494 * @param {number} suiteId - ID of the test suite to delete.
495 */
496 deleteTestSuite(project, planId, suiteId) {
497 return __awaiter(this, void 0, void 0, function* () {
498 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
499 let routeValues = {
500 project: project,
501 planId: planId,
502 suiteId: suiteId
503 };
504 try {
505 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "1046d5d3-ab61-4ca7-a65a-36118a978256", routeValues);
506 let url = verData.requestUrl;
507 let options = this.createRequestOptions('application/json', verData.apiVersion);
508 let res;
509 res = yield this.rest.del(url, options);
510 let ret = this.formatResponse(res.result, null, false);
511 resolve(ret);
512 }
513 catch (err) {
514 reject(err);
515 }
516 }));
517 });
518 }
519 /**
520 * Get test suite by suite id.
521 *
522 * @param {string} project - Project ID or project name
523 * @param {number} planId - ID of the test plan that contains the suites.
524 * @param {number} suiteId - ID of the suite to get.
525 * @param {TestPlanInterfaces.SuiteExpand} expand - Include the children suites and testers details
526 */
527 getTestSuiteById(project, planId, suiteId, expand) {
528 return __awaiter(this, void 0, void 0, function* () {
529 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
530 let routeValues = {
531 project: project,
532 planId: planId,
533 suiteId: suiteId
534 };
535 let queryValues = {
536 expand: expand,
537 };
538 try {
539 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "1046d5d3-ab61-4ca7-a65a-36118a978256", routeValues, queryValues);
540 let url = verData.requestUrl;
541 let options = this.createRequestOptions('application/json', verData.apiVersion);
542 let res;
543 res = yield this.rest.get(url, options);
544 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestSuite, false);
545 resolve(ret);
546 }
547 catch (err) {
548 reject(err);
549 }
550 }));
551 });
552 }
553 /**
554 * Get test suites for plan.
555 *
556 * @param {string} project - Project ID or project name
557 * @param {number} planId - ID of the test plan for which suites are requested.
558 * @param {TestPlanInterfaces.SuiteExpand} expand - Include the children suites and testers details.
559 * @param {string} continuationToken - If the list of suites returned is not complete, a continuation token to query next batch of suites is included in the response header as "x-ms-continuationtoken". Omit this parameter to get the first batch of test suites.
560 * @param {boolean} asTreeView - If the suites returned should be in a tree structure.
561 */
562 getTestSuitesForPlan(project, planId, expand, continuationToken, asTreeView) {
563 return __awaiter(this, void 0, void 0, function* () {
564 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
565 let routeValues = {
566 project: project,
567 planId: planId
568 };
569 let queryValues = {
570 expand: expand,
571 continuationToken: continuationToken,
572 asTreeView: asTreeView,
573 };
574 try {
575 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "1046d5d3-ab61-4ca7-a65a-36118a978256", routeValues, queryValues);
576 let url = verData.requestUrl;
577 let options = this.createRequestOptions('application/json', verData.apiVersion);
578 let res;
579 res = yield this.rest.get(url, options);
580 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestSuite, true);
581 resolve(ret);
582 }
583 catch (err) {
584 reject(err);
585 }
586 }));
587 });
588 }
589 /**
590 * Update test suite.
591 *
592 * @param {TestPlanInterfaces.TestSuiteUpdateParams} testSuiteUpdateParams - Parameters for suite updation
593 * @param {string} project - Project ID or project name
594 * @param {number} planId - ID of the test plan that contains the suites.
595 * @param {number} suiteId - ID of the parent suite.
596 */
597 updateTestSuite(testSuiteUpdateParams, project, planId, suiteId) {
598 return __awaiter(this, void 0, void 0, function* () {
599 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
600 let routeValues = {
601 project: project,
602 planId: planId,
603 suiteId: suiteId
604 };
605 try {
606 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "1046d5d3-ab61-4ca7-a65a-36118a978256", routeValues);
607 let url = verData.requestUrl;
608 let options = this.createRequestOptions('application/json', verData.apiVersion);
609 let res;
610 res = yield this.rest.update(url, testSuiteUpdateParams, options);
611 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestSuite, false);
612 resolve(ret);
613 }
614 catch (err) {
615 reject(err);
616 }
617 }));
618 });
619 }
620 /**
621 * Find the list of all test suites in which a given test case is present. This is helpful if you need to find out which test suites are using a test case, when you need to make changes to a test case.
622 *
623 * @param {number} testCaseId - ID of the test case for which suites need to be fetched.
624 */
625 getSuitesByTestCaseId(testCaseId) {
626 return __awaiter(this, void 0, void 0, function* () {
627 if (testCaseId == null) {
628 throw new TypeError('testCaseId can not be null or undefined');
629 }
630 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
631 let routeValues = {};
632 let queryValues = {
633 testCaseId: testCaseId,
634 };
635 try {
636 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "a4080e84-f17b-4fad-84f1-7960b6525bf2", routeValues, queryValues);
637 let url = verData.requestUrl;
638 let options = this.createRequestOptions('application/json', verData.apiVersion);
639 let res;
640 res = yield this.rest.get(url, options);
641 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestSuite, true);
642 resolve(ret);
643 }
644 catch (err) {
645 reject(err);
646 }
647 }));
648 });
649 }
650 /**
651 * Add test cases to a suite with specified configurations
652 *
653 * @param {TestPlanInterfaces.SuiteTestCaseCreateUpdateParameters[]} suiteTestCaseCreateUpdateParameters - SuiteTestCaseCreateUpdateParameters object.
654 * @param {string} project - Project ID or project name
655 * @param {number} planId - ID of the test plan to which test cases are to be added.
656 * @param {number} suiteId - ID of the test suite to which test cases are to be added.
657 */
658 addTestCasesToSuite(suiteTestCaseCreateUpdateParameters, project, planId, suiteId) {
659 return __awaiter(this, void 0, void 0, function* () {
660 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
661 let routeValues = {
662 project: project,
663 planId: planId,
664 suiteId: suiteId
665 };
666 try {
667 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "testplan", "a9bd61ac-45cf-4d13-9441-43dcd01edf8d", routeValues);
668 let url = verData.requestUrl;
669 let options = this.createRequestOptions('application/json', verData.apiVersion);
670 let res;
671 res = yield this.rest.create(url, suiteTestCaseCreateUpdateParameters, options);
672 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestCase, true);
673 resolve(ret);
674 }
675 catch (err) {
676 reject(err);
677 }
678 }));
679 });
680 }
681 /**
682 * Get a particular Test Case from a Suite.
683 *
684 * @param {string} project - Project ID or project name
685 * @param {number} planId - ID of the test plan for which test cases are requested.
686 * @param {number} suiteId - ID of the test suite for which test cases are requested.
687 * @param {string} testCaseId - Test Case Id to be fetched.
688 * @param {string} witFields - Get the list of witFields.
689 * @param {boolean} returnIdentityRef - If set to true, returns all identity fields, like AssignedTo, ActivatedBy etc., as IdentityRef objects. If set to false, these fields are returned as unique names in string format. This is false by default.
690 */
691 getTestCase(project, planId, suiteId, testCaseId, witFields, returnIdentityRef) {
692 return __awaiter(this, void 0, void 0, function* () {
693 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
694 let routeValues = {
695 project: project,
696 planId: planId,
697 suiteId: suiteId,
698 testCaseId: testCaseId
699 };
700 let queryValues = {
701 witFields: witFields,
702 returnIdentityRef: returnIdentityRef,
703 };
704 try {
705 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "testplan", "a9bd61ac-45cf-4d13-9441-43dcd01edf8d", routeValues, queryValues);
706 let url = verData.requestUrl;
707 let options = this.createRequestOptions('application/json', verData.apiVersion);
708 let res;
709 res = yield this.rest.get(url, options);
710 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestCase, true);
711 resolve(ret);
712 }
713 catch (err) {
714 reject(err);
715 }
716 }));
717 });
718 }
719 /**
720 * Get Test Case List return those test cases which have all the configuration Ids as mentioned in the optional parameter. If configuration Ids is null, it return all the test cases
721 *
722 * @param {string} project - Project ID or project name
723 * @param {number} planId - ID of the test plan for which test cases are requested.
724 * @param {number} suiteId - ID of the test suite for which test cases are requested.
725 * @param {string} testIds - Test Case Ids to be fetched.
726 * @param {string} configurationIds - Fetch Test Cases which contains all the configuration Ids specified.
727 * @param {string} witFields - Get the list of witFields.
728 * @param {string} continuationToken - If the list of test cases returned is not complete, a continuation token to query next batch of test cases is included in the response header as "x-ms-continuationtoken". Omit this parameter to get the first batch of test cases.
729 * @param {boolean} returnIdentityRef - If set to true, returns all identity fields, like AssignedTo, ActivatedBy etc., as IdentityRef objects. If set to false, these fields are returned as unique names in string format. This is false by default.
730 * @param {boolean} expand - If set to false, will get a smaller payload containing only basic details about the suite test case object
731 * @param {TestPlanInterfaces.ExcludeFlags} excludeFlags - Flag to exclude various values from payload. For example to remove point assignments pass exclude = 1. To remove extra information (links, test plan , test suite) pass exclude = 2. To remove both extra information and point assignments pass exclude = 3 (1 + 2).
732 * @param {boolean} isRecursive
733 */
734 getTestCaseList(project, planId, suiteId, testIds, configurationIds, witFields, continuationToken, returnIdentityRef, expand, excludeFlags, isRecursive) {
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 project: project,
739 planId: planId,
740 suiteId: suiteId
741 };
742 let queryValues = {
743 testIds: testIds,
744 configurationIds: configurationIds,
745 witFields: witFields,
746 continuationToken: continuationToken,
747 returnIdentityRef: returnIdentityRef,
748 expand: expand,
749 excludeFlags: excludeFlags,
750 isRecursive: isRecursive,
751 };
752 try {
753 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "testplan", "a9bd61ac-45cf-4d13-9441-43dcd01edf8d", routeValues, queryValues);
754 let url = verData.requestUrl;
755 let options = this.createRequestOptions('application/json', verData.apiVersion);
756 let res;
757 res = yield this.rest.get(url, options);
758 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestCase, true);
759 resolve(ret);
760 }
761 catch (err) {
762 reject(err);
763 }
764 }));
765 });
766 }
767 /**
768 * Removes test cases from a suite based on the list of test case Ids provided.
769 *
770 * @param {string} project - Project ID or project name
771 * @param {number} planId - ID of the test plan from which test cases are to be removed.
772 * @param {number} suiteId - ID of the test suite from which test cases are to be removed.
773 * @param {string} testCaseIds - Test Case Ids to be removed.
774 */
775 removeTestCasesFromSuite(project, planId, suiteId, testCaseIds) {
776 return __awaiter(this, void 0, void 0, function* () {
777 if (testCaseIds == null) {
778 throw new TypeError('testCaseIds can not be null or undefined');
779 }
780 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
781 let routeValues = {
782 project: project,
783 planId: planId,
784 suiteId: suiteId
785 };
786 let queryValues = {
787 testCaseIds: testCaseIds,
788 };
789 try {
790 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "testplan", "a9bd61ac-45cf-4d13-9441-43dcd01edf8d", routeValues, queryValues);
791 let url = verData.requestUrl;
792 let options = this.createRequestOptions('application/json', verData.apiVersion);
793 let res;
794 res = yield this.rest.del(url, 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 * Removes test cases from a suite based on the list of test case Ids provided. This API can be used to remove a larger number of test cases.
806 *
807 * @param {string} project - Project ID or project name
808 * @param {number} planId - ID of the test plan from which test cases are to be removed.
809 * @param {number} suiteId - ID of the test suite from which test cases are to be removed.
810 * @param {string} testIds - Comma separated string of Test Case Ids to be removed.
811 */
812 removeTestCasesListFromSuite(project, planId, suiteId, testIds) {
813 return __awaiter(this, void 0, void 0, function* () {
814 if (testIds == null) {
815 throw new TypeError('testIds can not be null or undefined');
816 }
817 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
818 let routeValues = {
819 project: project,
820 planId: planId,
821 suiteId: suiteId
822 };
823 let queryValues = {
824 testIds: testIds,
825 };
826 try {
827 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "testplan", "a9bd61ac-45cf-4d13-9441-43dcd01edf8d", routeValues, queryValues);
828 let url = verData.requestUrl;
829 let options = this.createRequestOptions('application/json', verData.apiVersion);
830 let res;
831 res = yield this.rest.del(url, options);
832 let ret = this.formatResponse(res.result, null, false);
833 resolve(ret);
834 }
835 catch (err) {
836 reject(err);
837 }
838 }));
839 });
840 }
841 /**
842 * Update the configurations for test cases
843 *
844 * @param {TestPlanInterfaces.SuiteTestCaseCreateUpdateParameters[]} suiteTestCaseCreateUpdateParameters - A SuiteTestCaseCreateUpdateParameters object.
845 * @param {string} project - Project ID or project name
846 * @param {number} planId - ID of the test plan to which test cases are to be updated.
847 * @param {number} suiteId - ID of the test suite to which test cases are to be updated.
848 */
849 updateSuiteTestCases(suiteTestCaseCreateUpdateParameters, project, planId, suiteId) {
850 return __awaiter(this, void 0, void 0, function* () {
851 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
852 let routeValues = {
853 project: project,
854 planId: planId,
855 suiteId: suiteId
856 };
857 try {
858 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "testplan", "a9bd61ac-45cf-4d13-9441-43dcd01edf8d", routeValues);
859 let url = verData.requestUrl;
860 let options = this.createRequestOptions('application/json', verData.apiVersion);
861 let res;
862 res = yield this.rest.update(url, suiteTestCaseCreateUpdateParameters, options);
863 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestCase, true);
864 resolve(ret);
865 }
866 catch (err) {
867 reject(err);
868 }
869 }));
870 });
871 }
872 /**
873 * @param {TestPlanInterfaces.CloneTestCaseParams} cloneRequestBody
874 * @param {string} project - Project ID or project name
875 */
876 cloneTestCase(cloneRequestBody, project) {
877 return __awaiter(this, void 0, void 0, function* () {
878 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
879 let routeValues = {
880 project: project
881 };
882 try {
883 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testplan", "529b2b8d-82f4-4893-b1e4-1e74ea534673", routeValues);
884 let url = verData.requestUrl;
885 let options = this.createRequestOptions('application/json', verData.apiVersion);
886 let res;
887 res = yield this.rest.create(url, cloneRequestBody, options);
888 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.CloneTestCaseOperationInformation, false);
889 resolve(ret);
890 }
891 catch (err) {
892 reject(err);
893 }
894 }));
895 });
896 }
897 /**
898 * Get clone information.
899 *
900 * @param {string} project - Project ID or project name
901 * @param {number} cloneOperationId - Operation ID returned when we queue a clone operation
902 */
903 getTestCaseCloneInformation(project, cloneOperationId) {
904 return __awaiter(this, void 0, void 0, function* () {
905 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
906 let routeValues = {
907 project: project,
908 cloneOperationId: cloneOperationId
909 };
910 try {
911 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testplan", "529b2b8d-82f4-4893-b1e4-1e74ea534673", routeValues);
912 let url = verData.requestUrl;
913 let options = this.createRequestOptions('application/json', verData.apiVersion);
914 let res;
915 res = yield this.rest.get(url, options);
916 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.CloneTestCaseOperationInformation, false);
917 resolve(ret);
918 }
919 catch (err) {
920 reject(err);
921 }
922 }));
923 });
924 }
925 /**
926 * Exports a set of test cases from a suite to a file. Currently supported formats: xlsx
927 *
928 * @param {TestPlanInterfaces.ExportTestCaseParams} exportTestCaseRequestBody - A ExportTestCaseParams object.ExportTestCaseParams
929 * @param {string} project - Project ID or project name
930 */
931 exportTestCases(exportTestCaseRequestBody, project) {
932 return __awaiter(this, void 0, void 0, function* () {
933 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
934 let routeValues = {
935 project: project
936 };
937 try {
938 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "3b9d1c87-6b1a-4e7d-9e7d-1a8e543112bb", routeValues);
939 let url = verData.requestUrl;
940 let apiVersion = verData.apiVersion;
941 let accept = this.createAcceptHeader("application/octet-stream", apiVersion);
942 resolve((yield this.http.get(url, { "Accept": accept })).message);
943 }
944 catch (err) {
945 reject(err);
946 }
947 }));
948 });
949 }
950 /**
951 * Delete a test case.
952 *
953 * @param {string} project - Project ID or project name
954 * @param {number} testCaseId - Id of test case to be deleted.
955 */
956 deleteTestCase(project, testCaseId) {
957 return __awaiter(this, void 0, void 0, function* () {
958 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
959 let routeValues = {
960 project: project,
961 testCaseId: testCaseId
962 };
963 try {
964 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "29006fb5-816b-4ff7-a329-599943569229", routeValues);
965 let url = verData.requestUrl;
966 let options = this.createRequestOptions('application/json', verData.apiVersion);
967 let res;
968 res = yield this.rest.del(url, options);
969 let ret = this.formatResponse(res.result, null, false);
970 resolve(ret);
971 }
972 catch (err) {
973 reject(err);
974 }
975 }));
976 });
977 }
978 /**
979 * Clone test plan
980 *
981 * @param {TestPlanInterfaces.CloneTestPlanParams} cloneRequestBody - Plan Clone Request Body detail TestPlanCloneRequest
982 * @param {string} project - Project ID or project name
983 * @param {boolean} deepClone - Clones all the associated test cases as well
984 */
985 cloneTestPlan(cloneRequestBody, project, deepClone) {
986 return __awaiter(this, void 0, void 0, function* () {
987 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
988 let routeValues = {
989 project: project
990 };
991 let queryValues = {
992 deepClone: deepClone,
993 };
994 try {
995 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testplan", "e65df662-d8a3-46c7-ae1c-14e2d4df57e1", routeValues, queryValues);
996 let url = verData.requestUrl;
997 let options = this.createRequestOptions('application/json', verData.apiVersion);
998 let res;
999 res = yield this.rest.create(url, cloneRequestBody, options);
1000 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.CloneTestPlanOperationInformation, false);
1001 resolve(ret);
1002 }
1003 catch (err) {
1004 reject(err);
1005 }
1006 }));
1007 });
1008 }
1009 /**
1010 * Get clone information.
1011 *
1012 * @param {string} project - Project ID or project name
1013 * @param {number} cloneOperationId - Operation ID returned when we queue a clone operation
1014 */
1015 getCloneInformation(project, cloneOperationId) {
1016 return __awaiter(this, void 0, void 0, function* () {
1017 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1018 let routeValues = {
1019 project: project,
1020 cloneOperationId: cloneOperationId
1021 };
1022 try {
1023 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testplan", "e65df662-d8a3-46c7-ae1c-14e2d4df57e1", routeValues);
1024 let url = verData.requestUrl;
1025 let options = this.createRequestOptions('application/json', verData.apiVersion);
1026 let res;
1027 res = yield this.rest.get(url, options);
1028 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.CloneTestPlanOperationInformation, false);
1029 resolve(ret);
1030 }
1031 catch (err) {
1032 reject(err);
1033 }
1034 }));
1035 });
1036 }
1037 /**
1038 * Get a particular Test Point from a suite.
1039 *
1040 * @param {string} project - Project ID or project name
1041 * @param {number} planId - ID of the test plan for which test points are requested.
1042 * @param {number} suiteId - ID of the test suite for which test points are requested.
1043 * @param {string} pointId - ID of test point to be fetched.
1044 * @param {boolean} returnIdentityRef - If set to true, returns the AssignedTo field in TestCaseReference as IdentityRef object.
1045 * @param {boolean} includePointDetails - If set to false, will get a smaller payload containing only basic details about the test point object
1046 */
1047 getPoints(project, planId, suiteId, pointId, returnIdentityRef, includePointDetails) {
1048 return __awaiter(this, void 0, void 0, function* () {
1049 if (pointId == null) {
1050 throw new TypeError('pointId can not be null or undefined');
1051 }
1052 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1053 let routeValues = {
1054 project: project,
1055 planId: planId,
1056 suiteId: suiteId
1057 };
1058 let queryValues = {
1059 pointId: pointId,
1060 returnIdentityRef: returnIdentityRef,
1061 includePointDetails: includePointDetails,
1062 };
1063 try {
1064 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testplan", "52df686e-bae4-4334-b0ee-b6cf4e6f6b73", routeValues, queryValues);
1065 let url = verData.requestUrl;
1066 let options = this.createRequestOptions('application/json', verData.apiVersion);
1067 let res;
1068 res = yield this.rest.get(url, options);
1069 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestPoint, true);
1070 resolve(ret);
1071 }
1072 catch (err) {
1073 reject(err);
1074 }
1075 }));
1076 });
1077 }
1078 /**
1079 * Get all the points inside a suite based on some filters
1080 *
1081 * @param {string} project - Project ID or project name
1082 * @param {number} planId - ID of the test plan for which test points are requested.
1083 * @param {number} suiteId - ID of the test suite for which test points are requested
1084 * @param {string} testPointIds - ID of test points to fetch.
1085 * @param {string} testCaseId - Get Test Points for specific test case Ids.
1086 * @param {string} continuationToken - If the list of test point returned is not complete, a continuation token to query next batch of test points is included in the response header as "x-ms-continuationtoken". Omit this parameter to get the first batch of test points.
1087 * @param {boolean} returnIdentityRef - If set to true, returns the AssignedTo field in TestCaseReference as IdentityRef object.
1088 * @param {boolean} includePointDetails - If set to false, will get a smaller payload containing only basic details about the test point object
1089 * @param {boolean} isRecursive - If set to true, will also fetch test points belonging to child suites recursively.
1090 */
1091 getPointsList(project, planId, suiteId, testPointIds, testCaseId, continuationToken, returnIdentityRef, includePointDetails, isRecursive) {
1092 return __awaiter(this, void 0, void 0, function* () {
1093 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1094 let routeValues = {
1095 project: project,
1096 planId: planId,
1097 suiteId: suiteId
1098 };
1099 let queryValues = {
1100 testPointIds: testPointIds,
1101 testCaseId: testCaseId,
1102 continuationToken: continuationToken,
1103 returnIdentityRef: returnIdentityRef,
1104 includePointDetails: includePointDetails,
1105 isRecursive: isRecursive,
1106 };
1107 try {
1108 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testplan", "52df686e-bae4-4334-b0ee-b6cf4e6f6b73", routeValues, queryValues);
1109 let url = verData.requestUrl;
1110 let options = this.createRequestOptions('application/json', verData.apiVersion);
1111 let res;
1112 res = yield this.rest.get(url, options);
1113 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestPoint, true);
1114 resolve(ret);
1115 }
1116 catch (err) {
1117 reject(err);
1118 }
1119 }));
1120 });
1121 }
1122 /**
1123 * Update Test Points. This is used to Reset test point to active, update the outcome of a test point or update the tester of a test point
1124 *
1125 * @param {TestPlanInterfaces.TestPointUpdateParams[]} testPointUpdateParams - A TestPointUpdateParams Object.
1126 * @param {string} project - Project ID or project name
1127 * @param {number} planId - ID of the test plan for which test points are requested.
1128 * @param {number} suiteId - ID of the test suite for which test points are requested.
1129 * @param {boolean} includePointDetails - If set to false, will get a smaller payload containing only basic details about the test point object
1130 * @param {boolean} returnIdentityRef - If set to true, returns the AssignedTo field in TestCaseReference as IdentityRef object.
1131 */
1132 updateTestPoints(testPointUpdateParams, project, planId, suiteId, includePointDetails, returnIdentityRef) {
1133 return __awaiter(this, void 0, void 0, function* () {
1134 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1135 let routeValues = {
1136 project: project,
1137 planId: planId,
1138 suiteId: suiteId
1139 };
1140 let queryValues = {
1141 includePointDetails: includePointDetails,
1142 returnIdentityRef: returnIdentityRef,
1143 };
1144 try {
1145 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testplan", "52df686e-bae4-4334-b0ee-b6cf4e6f6b73", routeValues, queryValues);
1146 let url = verData.requestUrl;
1147 let options = this.createRequestOptions('application/json', verData.apiVersion);
1148 let res;
1149 res = yield this.rest.update(url, testPointUpdateParams, options);
1150 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestPoint, true);
1151 resolve(ret);
1152 }
1153 catch (err) {
1154 reject(err);
1155 }
1156 }));
1157 });
1158 }
1159 /**
1160 * Clone test suite
1161 *
1162 * @param {TestPlanInterfaces.CloneTestSuiteParams} cloneRequestBody - Suite Clone Request Body detail TestSuiteCloneRequest
1163 * @param {string} project - Project ID or project name
1164 * @param {boolean} deepClone - Clones all the associated test cases as well
1165 */
1166 cloneTestSuite(cloneRequestBody, project, deepClone) {
1167 return __awaiter(this, void 0, void 0, function* () {
1168 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1169 let routeValues = {
1170 project: project
1171 };
1172 let queryValues = {
1173 deepClone: deepClone,
1174 };
1175 try {
1176 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testplan", "181d4c97-0e98-4ee2-ad6a-4cada675e555", routeValues, queryValues);
1177 let url = verData.requestUrl;
1178 let options = this.createRequestOptions('application/json', verData.apiVersion);
1179 let res;
1180 res = yield this.rest.create(url, cloneRequestBody, options);
1181 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.CloneTestSuiteOperationInformation, false);
1182 resolve(ret);
1183 }
1184 catch (err) {
1185 reject(err);
1186 }
1187 }));
1188 });
1189 }
1190 /**
1191 * Get clone information.
1192 *
1193 * @param {string} project - Project ID or project name
1194 * @param {number} cloneOperationId - Operation ID returned when we queue a clone operation
1195 */
1196 getSuiteCloneInformation(project, cloneOperationId) {
1197 return __awaiter(this, void 0, void 0, function* () {
1198 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1199 let routeValues = {
1200 project: project,
1201 cloneOperationId: cloneOperationId
1202 };
1203 try {
1204 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testplan", "181d4c97-0e98-4ee2-ad6a-4cada675e555", routeValues);
1205 let url = verData.requestUrl;
1206 let options = this.createRequestOptions('application/json', verData.apiVersion);
1207 let res;
1208 res = yield this.rest.get(url, options);
1209 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.CloneTestSuiteOperationInformation, false);
1210 resolve(ret);
1211 }
1212 catch (err) {
1213 reject(err);
1214 }
1215 }));
1216 });
1217 }
1218 /**
1219 * Create a test variable.
1220 *
1221 * @param {TestPlanInterfaces.TestVariableCreateUpdateParameters} testVariableCreateUpdateParameters - TestVariableCreateUpdateParameters
1222 * @param {string} project - Project ID or project name
1223 */
1224 createTestVariable(testVariableCreateUpdateParameters, project) {
1225 return __awaiter(this, void 0, void 0, function* () {
1226 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1227 let routeValues = {
1228 project: project
1229 };
1230 try {
1231 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "2c61fac6-ac4e-45a5-8c38-1c2b8fd8ea6c", routeValues);
1232 let url = verData.requestUrl;
1233 let options = this.createRequestOptions('application/json', verData.apiVersion);
1234 let res;
1235 res = yield this.rest.create(url, testVariableCreateUpdateParameters, options);
1236 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestVariable, false);
1237 resolve(ret);
1238 }
1239 catch (err) {
1240 reject(err);
1241 }
1242 }));
1243 });
1244 }
1245 /**
1246 * Delete a test variable by its ID.
1247 *
1248 * @param {string} project - Project ID or project name
1249 * @param {number} testVariableId - ID of the test variable to delete.
1250 */
1251 deleteTestVariable(project, testVariableId) {
1252 return __awaiter(this, void 0, void 0, function* () {
1253 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1254 let routeValues = {
1255 project: project,
1256 testVariableId: testVariableId
1257 };
1258 try {
1259 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "2c61fac6-ac4e-45a5-8c38-1c2b8fd8ea6c", routeValues);
1260 let url = verData.requestUrl;
1261 let options = this.createRequestOptions('application/json', verData.apiVersion);
1262 let res;
1263 res = yield this.rest.del(url, options);
1264 let ret = this.formatResponse(res.result, null, false);
1265 resolve(ret);
1266 }
1267 catch (err) {
1268 reject(err);
1269 }
1270 }));
1271 });
1272 }
1273 /**
1274 * Get a test variable by its ID.
1275 *
1276 * @param {string} project - Project ID or project name
1277 * @param {number} testVariableId - ID of the test variable to get.
1278 */
1279 getTestVariableById(project, testVariableId) {
1280 return __awaiter(this, void 0, void 0, function* () {
1281 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1282 let routeValues = {
1283 project: project,
1284 testVariableId: testVariableId
1285 };
1286 try {
1287 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "2c61fac6-ac4e-45a5-8c38-1c2b8fd8ea6c", routeValues);
1288 let url = verData.requestUrl;
1289 let options = this.createRequestOptions('application/json', verData.apiVersion);
1290 let res;
1291 res = yield this.rest.get(url, options);
1292 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestVariable, false);
1293 resolve(ret);
1294 }
1295 catch (err) {
1296 reject(err);
1297 }
1298 }));
1299 });
1300 }
1301 /**
1302 * Get a list of test variables.
1303 *
1304 * @param {string} project - Project ID or project name
1305 * @param {string} continuationToken - If the list of variables returned is not complete, a continuation token to query next batch of variables is included in the response header as "x-ms-continuationtoken". Omit this parameter to get the first batch of test variables.
1306 */
1307 getTestVariables(project, continuationToken) {
1308 return __awaiter(this, void 0, void 0, function* () {
1309 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1310 let routeValues = {
1311 project: project
1312 };
1313 let queryValues = {
1314 continuationToken: continuationToken,
1315 };
1316 try {
1317 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "2c61fac6-ac4e-45a5-8c38-1c2b8fd8ea6c", routeValues, queryValues);
1318 let url = verData.requestUrl;
1319 let options = this.createRequestOptions('application/json', verData.apiVersion);
1320 let res;
1321 res = yield this.rest.get(url, options);
1322 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestVariable, true);
1323 resolve(ret);
1324 }
1325 catch (err) {
1326 reject(err);
1327 }
1328 }));
1329 });
1330 }
1331 /**
1332 * Update a test variable by its ID.
1333 *
1334 * @param {TestPlanInterfaces.TestVariableCreateUpdateParameters} testVariableCreateUpdateParameters - TestVariableCreateUpdateParameters
1335 * @param {string} project - Project ID or project name
1336 * @param {number} testVariableId - ID of the test variable to update.
1337 */
1338 updateTestVariable(testVariableCreateUpdateParameters, project, testVariableId) {
1339 return __awaiter(this, void 0, void 0, function* () {
1340 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1341 let routeValues = {
1342 project: project,
1343 testVariableId: testVariableId
1344 };
1345 try {
1346 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "2c61fac6-ac4e-45a5-8c38-1c2b8fd8ea6c", routeValues);
1347 let url = verData.requestUrl;
1348 let options = this.createRequestOptions('application/json', verData.apiVersion);
1349 let res;
1350 res = yield this.rest.update(url, testVariableCreateUpdateParameters, options);
1351 let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestVariable, false);
1352 resolve(ret);
1353 }
1354 catch (err) {
1355 reject(err);
1356 }
1357 }));
1358 });
1359 }
1360}
1361exports.TestPlanApi = TestPlanApi;