UNPKG

147 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.BuildApi = void 0;
22const basem = require("./ClientApiBases");
23const BuildInterfaces = require("./interfaces/BuildInterfaces");
24class BuildApi extends basem.ClientApiBase {
25 constructor(baseUrl, handlers, options) {
26 super(baseUrl, handlers, 'node-Build-api', options);
27 }
28 /**
29 * Associates an artifact with a build.
30 *
31 * @param {BuildInterfaces.BuildArtifact} artifact - The artifact.
32 * @param {string} project - Project ID or project name
33 * @param {number} buildId - The ID of the build.
34 */
35 createArtifact(artifact, project, buildId) {
36 return __awaiter(this, void 0, void 0, function* () {
37 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
38 let routeValues = {
39 project: project,
40 buildId: buildId
41 };
42 try {
43 let verData = yield this.vsoClient.getVersioningData("7.2-preview.5", "build", "1db06c96-014e-44e1-ac91-90b2d4b3e984", routeValues);
44 let url = verData.requestUrl;
45 let options = this.createRequestOptions('application/json', verData.apiVersion);
46 let res;
47 res = yield this.rest.create(url, artifact, options);
48 let ret = this.formatResponse(res.result, null, false);
49 resolve(ret);
50 }
51 catch (err) {
52 reject(err);
53 }
54 }));
55 });
56 }
57 /**
58 * Gets a specific artifact for a build.
59 *
60 * @param {string} project - Project ID or project name
61 * @param {number} buildId - The ID of the build.
62 * @param {string} artifactName - The name of the artifact.
63 */
64 getArtifact(project, buildId, artifactName) {
65 return __awaiter(this, void 0, void 0, function* () {
66 if (artifactName == null) {
67 throw new TypeError('artifactName can not be null or undefined');
68 }
69 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
70 let routeValues = {
71 project: project,
72 buildId: buildId
73 };
74 let queryValues = {
75 artifactName: artifactName,
76 };
77 try {
78 let verData = yield this.vsoClient.getVersioningData("7.2-preview.5", "build", "1db06c96-014e-44e1-ac91-90b2d4b3e984", routeValues, queryValues);
79 let url = verData.requestUrl;
80 let options = this.createRequestOptions('application/json', verData.apiVersion);
81 let res;
82 res = yield this.rest.get(url, options);
83 let ret = this.formatResponse(res.result, null, false);
84 resolve(ret);
85 }
86 catch (err) {
87 reject(err);
88 }
89 }));
90 });
91 }
92 /**
93 * Gets a specific artifact for a build.
94 *
95 * @param {string} project - Project ID or project name
96 * @param {number} buildId - The ID of the build.
97 * @param {string} artifactName - The name of the artifact.
98 */
99 getArtifactContentZip(project, buildId, artifactName) {
100 return __awaiter(this, void 0, void 0, function* () {
101 if (artifactName == null) {
102 throw new TypeError('artifactName can not be null or undefined');
103 }
104 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
105 let routeValues = {
106 project: project,
107 buildId: buildId
108 };
109 let queryValues = {
110 artifactName: artifactName,
111 };
112 try {
113 let verData = yield this.vsoClient.getVersioningData("7.2-preview.5", "build", "1db06c96-014e-44e1-ac91-90b2d4b3e984", routeValues, queryValues);
114 let url = verData.requestUrl;
115 let apiVersion = verData.apiVersion;
116 let accept = this.createAcceptHeader("application/zip", apiVersion);
117 resolve((yield this.http.get(url, { "Accept": accept })).message);
118 }
119 catch (err) {
120 reject(err);
121 }
122 }));
123 });
124 }
125 /**
126 * Gets all artifacts for a build.
127 *
128 * @param {string} project - Project ID or project name
129 * @param {number} buildId - The ID of the build.
130 */
131 getArtifacts(project, buildId) {
132 return __awaiter(this, void 0, void 0, function* () {
133 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
134 let routeValues = {
135 project: project,
136 buildId: buildId
137 };
138 try {
139 let verData = yield this.vsoClient.getVersioningData("7.2-preview.5", "build", "1db06c96-014e-44e1-ac91-90b2d4b3e984", routeValues);
140 let url = verData.requestUrl;
141 let options = this.createRequestOptions('application/json', verData.apiVersion);
142 let res;
143 res = yield this.rest.get(url, options);
144 let ret = this.formatResponse(res.result, null, true);
145 resolve(ret);
146 }
147 catch (err) {
148 reject(err);
149 }
150 }));
151 });
152 }
153 /**
154 * Gets a file from the build.
155 *
156 * @param {string} project - Project ID or project name
157 * @param {number} buildId - The ID of the build.
158 * @param {string} artifactName - The name of the artifact.
159 * @param {string} fileId - The primary key for the file.
160 * @param {string} fileName - The name that the file will be set to.
161 */
162 getFile(project, buildId, artifactName, fileId, fileName) {
163 return __awaiter(this, void 0, void 0, function* () {
164 if (artifactName == null) {
165 throw new TypeError('artifactName can not be null or undefined');
166 }
167 if (fileId == null) {
168 throw new TypeError('fileId can not be null or undefined');
169 }
170 if (fileName == null) {
171 throw new TypeError('fileName can not be null or undefined');
172 }
173 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
174 let routeValues = {
175 project: project,
176 buildId: buildId
177 };
178 let queryValues = {
179 artifactName: artifactName,
180 fileId: fileId,
181 fileName: fileName,
182 };
183 try {
184 let verData = yield this.vsoClient.getVersioningData("7.2-preview.5", "build", "1db06c96-014e-44e1-ac91-90b2d4b3e984", routeValues, queryValues);
185 let url = verData.requestUrl;
186 let apiVersion = verData.apiVersion;
187 let accept = this.createAcceptHeader("application/octet-stream", apiVersion);
188 resolve((yield this.http.get(url, { "Accept": accept })).message);
189 }
190 catch (err) {
191 reject(err);
192 }
193 }));
194 });
195 }
196 /**
197 * Gets the list of attachments of a specific type that are associated with a build.
198 *
199 * @param {string} project - Project ID or project name
200 * @param {number} buildId - The ID of the build.
201 * @param {string} type - The type of attachment.
202 */
203 getAttachments(project, buildId, type) {
204 return __awaiter(this, void 0, void 0, function* () {
205 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
206 let routeValues = {
207 project: project,
208 buildId: buildId,
209 type: type
210 };
211 try {
212 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "f2192269-89fa-4f94-baf6-8fb128c55159", routeValues);
213 let url = verData.requestUrl;
214 let options = this.createRequestOptions('application/json', verData.apiVersion);
215 let res;
216 res = yield this.rest.get(url, options);
217 let ret = this.formatResponse(res.result, null, true);
218 resolve(ret);
219 }
220 catch (err) {
221 reject(err);
222 }
223 }));
224 });
225 }
226 /**
227 * Gets a specific attachment.
228 *
229 * @param {string} project - Project ID or project name
230 * @param {number} buildId - The ID of the build.
231 * @param {string} timelineId - The ID of the timeline.
232 * @param {string} recordId - The ID of the timeline record.
233 * @param {string} type - The type of the attachment.
234 * @param {string} name - The name of the attachment.
235 */
236 getAttachment(project, buildId, timelineId, recordId, type, name) {
237 return __awaiter(this, void 0, void 0, function* () {
238 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
239 let routeValues = {
240 project: project,
241 buildId: buildId,
242 timelineId: timelineId,
243 recordId: recordId,
244 type: type,
245 name: name
246 };
247 try {
248 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "af5122d3-3438-485e-a25a-2dbbfde84ee6", routeValues);
249 let url = verData.requestUrl;
250 let apiVersion = verData.apiVersion;
251 let accept = this.createAcceptHeader("application/octet-stream", apiVersion);
252 resolve((yield this.http.get(url, { "Accept": accept })).message);
253 }
254 catch (err) {
255 reject(err);
256 }
257 }));
258 });
259 }
260 /**
261 * @param {BuildInterfaces.DefinitionResourceReference[]} resources
262 * @param {string} project - Project ID or project name
263 */
264 authorizeProjectResources(resources, project) {
265 return __awaiter(this, void 0, void 0, function* () {
266 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
267 let routeValues = {
268 project: project
269 };
270 try {
271 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "398c85bc-81aa-4822-947c-a194a05f0fef", routeValues);
272 let url = verData.requestUrl;
273 let options = this.createRequestOptions('application/json', verData.apiVersion);
274 let res;
275 res = yield this.rest.update(url, resources, options);
276 let ret = this.formatResponse(res.result, null, true);
277 resolve(ret);
278 }
279 catch (err) {
280 reject(err);
281 }
282 }));
283 });
284 }
285 /**
286 * @param {string} project - Project ID or project name
287 * @param {string} type
288 * @param {string} id
289 */
290 getProjectResources(project, type, id) {
291 return __awaiter(this, void 0, void 0, function* () {
292 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
293 let routeValues = {
294 project: project
295 };
296 let queryValues = {
297 type: type,
298 id: id,
299 };
300 try {
301 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "398c85bc-81aa-4822-947c-a194a05f0fef", routeValues, queryValues);
302 let url = verData.requestUrl;
303 let options = this.createRequestOptions('application/json', verData.apiVersion);
304 let res;
305 res = yield this.rest.get(url, options);
306 let ret = this.formatResponse(res.result, null, true);
307 resolve(ret);
308 }
309 catch (err) {
310 reject(err);
311 }
312 }));
313 });
314 }
315 /**
316 * Gets a badge that indicates the status of the most recent build for a definition. Note that this API is deprecated. Prefer StatusBadgeController.GetStatusBadge.
317 *
318 * @param {string} project - The project ID or name.
319 * @param {number} definitionId - The ID of the definition.
320 * @param {string} branchName - The name of the branch.
321 */
322 getBadge(project, definitionId, branchName) {
323 return __awaiter(this, void 0, void 0, function* () {
324 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
325 let routeValues = {
326 project: project,
327 definitionId: definitionId
328 };
329 let queryValues = {
330 branchName: branchName,
331 };
332 try {
333 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "de6a4df8-22cd-44ee-af2d-39f6aa7a4261", routeValues, queryValues);
334 let url = verData.requestUrl;
335 let options = this.createRequestOptions('application/json', verData.apiVersion);
336 let res;
337 res = yield this.rest.get(url, options);
338 let ret = this.formatResponse(res.result, null, false);
339 resolve(ret);
340 }
341 catch (err) {
342 reject(err);
343 }
344 }));
345 });
346 }
347 /**
348 * Gets a list of branches for the given source code repository.
349 *
350 * @param {string} project - Project ID or project name
351 * @param {string} providerName - The name of the source provider.
352 * @param {string} serviceEndpointId - If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit.
353 * @param {string} repository - The vendor-specific identifier or the name of the repository to get branches. Can only be omitted for providers that do not support multiple repositories.
354 * @param {string} branchName - If supplied, the name of the branch to check for specifically.
355 */
356 listBranches(project, providerName, serviceEndpointId, repository, branchName) {
357 return __awaiter(this, void 0, void 0, function* () {
358 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
359 let routeValues = {
360 project: project,
361 providerName: providerName
362 };
363 let queryValues = {
364 serviceEndpointId: serviceEndpointId,
365 repository: repository,
366 branchName: branchName,
367 };
368 try {
369 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "e05d4403-9b81-4244-8763-20fde28d1976", routeValues, queryValues);
370 let url = verData.requestUrl;
371 let options = this.createRequestOptions('application/json', verData.apiVersion);
372 let res;
373 res = yield this.rest.get(url, options);
374 let ret = this.formatResponse(res.result, null, true);
375 resolve(ret);
376 }
377 catch (err) {
378 reject(err);
379 }
380 }));
381 });
382 }
383 /**
384 * Gets a badge that indicates the status of the most recent build for the specified branch.
385 *
386 * @param {string} project - Project ID or project name
387 * @param {string} repoType - The repository type.
388 * @param {string} repoId - The repository ID.
389 * @param {string} branchName - The branch name.
390 */
391 getBuildBadge(project, repoType, repoId, branchName) {
392 return __awaiter(this, void 0, void 0, function* () {
393 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
394 let routeValues = {
395 project: project,
396 repoType: repoType
397 };
398 let queryValues = {
399 repoId: repoId,
400 branchName: branchName,
401 };
402 try {
403 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "21b3b9ce-fad5-4567-9ad0-80679794e003", routeValues, queryValues);
404 let url = verData.requestUrl;
405 let options = this.createRequestOptions('application/json', verData.apiVersion);
406 let res;
407 res = yield this.rest.get(url, options);
408 let ret = this.formatResponse(res.result, null, false);
409 resolve(ret);
410 }
411 catch (err) {
412 reject(err);
413 }
414 }));
415 });
416 }
417 /**
418 * Gets a badge that indicates the status of the most recent build for the specified branch.
419 *
420 * @param {string} project - Project ID or project name
421 * @param {string} repoType - The repository type.
422 * @param {string} repoId - The repository ID.
423 * @param {string} branchName - The branch name.
424 */
425 getBuildBadgeData(project, repoType, repoId, branchName) {
426 return __awaiter(this, void 0, void 0, function* () {
427 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
428 let routeValues = {
429 project: project,
430 repoType: repoType
431 };
432 let queryValues = {
433 repoId: repoId,
434 branchName: branchName,
435 };
436 try {
437 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "21b3b9ce-fad5-4567-9ad0-80679794e003", routeValues, queryValues);
438 let url = verData.requestUrl;
439 let options = this.createRequestOptions('application/json', verData.apiVersion);
440 let res;
441 res = yield this.rest.get(url, options);
442 let ret = this.formatResponse(res.result, null, false);
443 resolve(ret);
444 }
445 catch (err) {
446 reject(err);
447 }
448 }));
449 });
450 }
451 /**
452 * Gets all retention leases that apply to a specific build.
453 *
454 * @param {string} project - Project ID or project name
455 * @param {number} buildId - The ID of the build.
456 */
457 getRetentionLeasesForBuild(project, buildId) {
458 return __awaiter(this, void 0, void 0, function* () {
459 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
460 let routeValues = {
461 project: project,
462 buildId: buildId
463 };
464 try {
465 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "3da19a6a-f088-45c4-83ce-2ad3a87be6c4", routeValues);
466 let url = verData.requestUrl;
467 let options = this.createRequestOptions('application/json', verData.apiVersion);
468 let res;
469 res = yield this.rest.get(url, options);
470 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.RetentionLease, true);
471 resolve(ret);
472 }
473 catch (err) {
474 reject(err);
475 }
476 }));
477 });
478 }
479 /**
480 * Deletes a build.
481 *
482 * @param {string} project - Project ID or project name
483 * @param {number} buildId - The ID of the build.
484 */
485 deleteBuild(project, buildId) {
486 return __awaiter(this, void 0, void 0, function* () {
487 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
488 let routeValues = {
489 project: project,
490 buildId: buildId
491 };
492 try {
493 let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "0cd358e1-9217-4d94-8269-1c1ee6f93dcf", routeValues);
494 let url = verData.requestUrl;
495 let options = this.createRequestOptions('application/json', verData.apiVersion);
496 let res;
497 res = yield this.rest.del(url, options);
498 let ret = this.formatResponse(res.result, null, false);
499 resolve(ret);
500 }
501 catch (err) {
502 reject(err);
503 }
504 }));
505 });
506 }
507 /**
508 * Gets a build
509 *
510 * @param {string} project - Project ID or project name
511 * @param {number} buildId
512 * @param {string} propertyFilters
513 */
514 getBuild(project, buildId, propertyFilters) {
515 return __awaiter(this, void 0, void 0, function* () {
516 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
517 let routeValues = {
518 project: project,
519 buildId: buildId
520 };
521 let queryValues = {
522 propertyFilters: propertyFilters,
523 };
524 try {
525 let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "0cd358e1-9217-4d94-8269-1c1ee6f93dcf", routeValues, queryValues);
526 let url = verData.requestUrl;
527 let options = this.createRequestOptions('application/json', verData.apiVersion);
528 let res;
529 res = yield this.rest.get(url, options);
530 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Build, false);
531 resolve(ret);
532 }
533 catch (err) {
534 reject(err);
535 }
536 }));
537 });
538 }
539 /**
540 * Gets a list of builds.
541 *
542 * @param {string} project - Project ID or project name
543 * @param {number[]} definitions - A comma-delimited list of definition IDs. If specified, filters to builds for these definitions.
544 * @param {number[]} queues - A comma-delimited list of queue IDs. If specified, filters to builds that ran against these queues.
545 * @param {string} buildNumber - If specified, filters to builds that match this build number. Append * to do a prefix search.
546 * @param {Date} minTime - If specified, filters to builds that finished/started/queued after this date based on the queryOrder specified.
547 * @param {Date} maxTime - If specified, filters to builds that finished/started/queued before this date based on the queryOrder specified.
548 * @param {string} requestedFor - If specified, filters to builds requested for the specified user.
549 * @param {BuildInterfaces.BuildReason} reasonFilter - If specified, filters to builds that match this reason.
550 * @param {BuildInterfaces.BuildStatus} statusFilter - If specified, filters to builds that match this status.
551 * @param {BuildInterfaces.BuildResult} resultFilter - If specified, filters to builds that match this result.
552 * @param {string[]} tagFilters - A comma-delimited list of tags. If specified, filters to builds that have the specified tags.
553 * @param {string[]} properties - A comma-delimited list of properties to retrieve.
554 * @param {number} top - The maximum number of builds to return.
555 * @param {string} continuationToken - A continuation token, returned by a previous call to this method, that can be used to return the next set of builds.
556 * @param {number} maxBuildsPerDefinition - The maximum number of builds to return per definition.
557 * @param {BuildInterfaces.QueryDeletedOption} deletedFilter - Indicates whether to exclude, include, or only return deleted builds.
558 * @param {BuildInterfaces.BuildQueryOrder} queryOrder - The order in which builds should be returned.
559 * @param {string} branchName - If specified, filters to builds that built branches that built this branch.
560 * @param {number[]} buildIds - A comma-delimited list that specifies the IDs of builds to retrieve.
561 * @param {string} repositoryId - If specified, filters to builds that built from this repository.
562 * @param {string} repositoryType - If specified, filters to builds that built from repositories of this type.
563 */
564 getBuilds(project, definitions, queues, buildNumber, minTime, maxTime, requestedFor, reasonFilter, statusFilter, resultFilter, tagFilters, properties, top, continuationToken, maxBuildsPerDefinition, deletedFilter, queryOrder, branchName, buildIds, repositoryId, repositoryType) {
565 return __awaiter(this, void 0, void 0, function* () {
566 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
567 let routeValues = {
568 project: project
569 };
570 let queryValues = {
571 definitions: definitions && definitions.join(","),
572 queues: queues && queues.join(","),
573 buildNumber: buildNumber,
574 minTime: minTime,
575 maxTime: maxTime,
576 requestedFor: requestedFor,
577 reasonFilter: reasonFilter,
578 statusFilter: statusFilter,
579 resultFilter: resultFilter,
580 tagFilters: tagFilters && tagFilters.join(","),
581 properties: properties && properties.join(","),
582 '$top': top,
583 continuationToken: continuationToken,
584 maxBuildsPerDefinition: maxBuildsPerDefinition,
585 deletedFilter: deletedFilter,
586 queryOrder: queryOrder,
587 branchName: branchName,
588 buildIds: buildIds && buildIds.join(","),
589 repositoryId: repositoryId,
590 repositoryType: repositoryType,
591 };
592 try {
593 let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "0cd358e1-9217-4d94-8269-1c1ee6f93dcf", routeValues, queryValues);
594 let url = verData.requestUrl;
595 let options = this.createRequestOptions('application/json', verData.apiVersion);
596 let res;
597 res = yield this.rest.get(url, options);
598 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Build, true);
599 resolve(ret);
600 }
601 catch (err) {
602 reject(err);
603 }
604 }));
605 });
606 }
607 /**
608 * Queues a build
609 *
610 * @param {BuildInterfaces.Build} build
611 * @param {string} project - Project ID or project name
612 * @param {boolean} ignoreWarnings
613 * @param {string} checkInTicket
614 * @param {number} sourceBuildId
615 * @param {number} definitionId - Optional definition id to queue a build without a body. Ignored if there's a valid body
616 */
617 queueBuild(build, project, ignoreWarnings, checkInTicket, sourceBuildId, definitionId) {
618 return __awaiter(this, void 0, void 0, function* () {
619 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
620 let routeValues = {
621 project: project
622 };
623 let queryValues = {
624 ignoreWarnings: ignoreWarnings,
625 checkInTicket: checkInTicket,
626 sourceBuildId: sourceBuildId,
627 definitionId: definitionId,
628 };
629 try {
630 let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "0cd358e1-9217-4d94-8269-1c1ee6f93dcf", routeValues, queryValues);
631 let url = verData.requestUrl;
632 let options = this.createRequestOptions('application/json', verData.apiVersion);
633 let res;
634 res = yield this.rest.create(url, build, options);
635 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Build, false);
636 resolve(ret);
637 }
638 catch (err) {
639 reject(err);
640 }
641 }));
642 });
643 }
644 /**
645 * Updates a build.
646 *
647 * @param {BuildInterfaces.Build} build - The build.
648 * @param {string} project - Project ID or project name
649 * @param {number} buildId - The ID of the build.
650 * @param {boolean} retry
651 */
652 updateBuild(build, project, buildId, retry) {
653 return __awaiter(this, void 0, void 0, function* () {
654 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
655 let routeValues = {
656 project: project,
657 buildId: buildId
658 };
659 let queryValues = {
660 retry: retry,
661 };
662 try {
663 let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "0cd358e1-9217-4d94-8269-1c1ee6f93dcf", routeValues, queryValues);
664 let url = verData.requestUrl;
665 let options = this.createRequestOptions('application/json', verData.apiVersion);
666 let res;
667 res = yield this.rest.update(url, build, options);
668 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Build, false);
669 resolve(ret);
670 }
671 catch (err) {
672 reject(err);
673 }
674 }));
675 });
676 }
677 /**
678 * Updates multiple builds.
679 *
680 * @param {BuildInterfaces.Build[]} builds - The builds to update.
681 * @param {string} project - Project ID or project name
682 */
683 updateBuilds(builds, project) {
684 return __awaiter(this, void 0, void 0, function* () {
685 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
686 let routeValues = {
687 project: project
688 };
689 try {
690 let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "0cd358e1-9217-4d94-8269-1c1ee6f93dcf", routeValues);
691 let url = verData.requestUrl;
692 let options = this.createRequestOptions('application/json', verData.apiVersion);
693 let res;
694 res = yield this.rest.update(url, builds, options);
695 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Build, true);
696 resolve(ret);
697 }
698 catch (err) {
699 reject(err);
700 }
701 }));
702 });
703 }
704 /**
705 * Gets the changes associated with a build
706 *
707 * @param {string} project - Project ID or project name
708 * @param {number} buildId
709 * @param {string} continuationToken
710 * @param {number} top - The maximum number of changes to return
711 * @param {boolean} includeSourceChange
712 */
713 getBuildChanges(project, buildId, continuationToken, top, includeSourceChange) {
714 return __awaiter(this, void 0, void 0, function* () {
715 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
716 let routeValues = {
717 project: project,
718 buildId: buildId
719 };
720 let queryValues = {
721 continuationToken: continuationToken,
722 '$top': top,
723 includeSourceChange: includeSourceChange,
724 };
725 try {
726 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "54572c7b-bbd3-45d4-80dc-28be08941620", routeValues, queryValues);
727 let url = verData.requestUrl;
728 let options = this.createRequestOptions('application/json', verData.apiVersion);
729 let res;
730 res = yield this.rest.get(url, options);
731 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Change, true);
732 resolve(ret);
733 }
734 catch (err) {
735 reject(err);
736 }
737 }));
738 });
739 }
740 /**
741 * Gets the changes made to the repository between two given builds.
742 *
743 * @param {string} project - Project ID or project name
744 * @param {number} fromBuildId - The ID of the first build.
745 * @param {number} toBuildId - The ID of the last build.
746 * @param {number} top - The maximum number of changes to return.
747 */
748 getChangesBetweenBuilds(project, fromBuildId, toBuildId, top) {
749 return __awaiter(this, void 0, void 0, function* () {
750 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
751 let routeValues = {
752 project: project
753 };
754 let queryValues = {
755 fromBuildId: fromBuildId,
756 toBuildId: toBuildId,
757 '$top': top,
758 };
759 try {
760 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "f10f0ea5-18a1-43ec-a8fb-2042c7be9b43", routeValues, queryValues);
761 let url = verData.requestUrl;
762 let options = this.createRequestOptions('application/json', verData.apiVersion);
763 let res;
764 res = yield this.rest.get(url, options);
765 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Change, true);
766 resolve(ret);
767 }
768 catch (err) {
769 reject(err);
770 }
771 }));
772 });
773 }
774 /**
775 * Gets a controller
776 *
777 * @param {number} controllerId
778 */
779 getBuildController(controllerId) {
780 return __awaiter(this, void 0, void 0, function* () {
781 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
782 let routeValues = {
783 controllerId: controllerId
784 };
785 try {
786 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "fcac1932-2ee1-437f-9b6f-7f696be858f6", routeValues);
787 let url = verData.requestUrl;
788 let options = this.createRequestOptions('application/json', verData.apiVersion);
789 let res;
790 res = yield this.rest.get(url, options);
791 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildController, false);
792 resolve(ret);
793 }
794 catch (err) {
795 reject(err);
796 }
797 }));
798 });
799 }
800 /**
801 * Gets controller, optionally filtered by name
802 *
803 * @param {string} name
804 */
805 getBuildControllers(name) {
806 return __awaiter(this, void 0, void 0, function* () {
807 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
808 let routeValues = {};
809 let queryValues = {
810 name: name,
811 };
812 try {
813 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "fcac1932-2ee1-437f-9b6f-7f696be858f6", routeValues, queryValues);
814 let url = verData.requestUrl;
815 let options = this.createRequestOptions('application/json', verData.apiVersion);
816 let res;
817 res = yield this.rest.get(url, options);
818 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildController, true);
819 resolve(ret);
820 }
821 catch (err) {
822 reject(err);
823 }
824 }));
825 });
826 }
827 /**
828 * Creates a new definition.
829 *
830 * @param {BuildInterfaces.BuildDefinition} definition - The definition.
831 * @param {string} project - Project ID or project name
832 * @param {number} definitionToCloneId
833 * @param {number} definitionToCloneRevision
834 */
835 createDefinition(definition, project, definitionToCloneId, definitionToCloneRevision) {
836 return __awaiter(this, void 0, void 0, function* () {
837 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
838 let routeValues = {
839 project: project
840 };
841 let queryValues = {
842 definitionToCloneId: definitionToCloneId,
843 definitionToCloneRevision: definitionToCloneRevision,
844 };
845 try {
846 let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "dbeaf647-6167-421a-bda9-c9327b25e2e6", routeValues, queryValues);
847 let url = verData.requestUrl;
848 let options = this.createRequestOptions('application/json', verData.apiVersion);
849 let res;
850 res = yield this.rest.create(url, definition, options);
851 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildDefinition, false);
852 resolve(ret);
853 }
854 catch (err) {
855 reject(err);
856 }
857 }));
858 });
859 }
860 /**
861 * Deletes a definition and all associated builds.
862 *
863 * @param {string} project - Project ID or project name
864 * @param {number} definitionId - The ID of the definition.
865 */
866 deleteDefinition(project, definitionId) {
867 return __awaiter(this, void 0, void 0, function* () {
868 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
869 let routeValues = {
870 project: project,
871 definitionId: definitionId
872 };
873 try {
874 let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "dbeaf647-6167-421a-bda9-c9327b25e2e6", routeValues);
875 let url = verData.requestUrl;
876 let options = this.createRequestOptions('application/json', verData.apiVersion);
877 let res;
878 res = yield this.rest.del(url, options);
879 let ret = this.formatResponse(res.result, null, false);
880 resolve(ret);
881 }
882 catch (err) {
883 reject(err);
884 }
885 }));
886 });
887 }
888 /**
889 * Gets a definition, optionally at a specific revision.
890 *
891 * @param {string} project - Project ID or project name
892 * @param {number} definitionId - The ID of the definition.
893 * @param {number} revision - The revision number to retrieve. If this is not specified, the latest version will be returned.
894 * @param {Date} minMetricsTime - If specified, indicates the date from which metrics should be included.
895 * @param {string[]} propertyFilters - A comma-delimited list of properties to include in the results.
896 * @param {boolean} includeLatestBuilds
897 */
898 getDefinition(project, definitionId, revision, minMetricsTime, propertyFilters, includeLatestBuilds) {
899 return __awaiter(this, void 0, void 0, function* () {
900 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
901 let routeValues = {
902 project: project,
903 definitionId: definitionId
904 };
905 let queryValues = {
906 revision: revision,
907 minMetricsTime: minMetricsTime,
908 propertyFilters: propertyFilters && propertyFilters.join(","),
909 includeLatestBuilds: includeLatestBuilds,
910 };
911 try {
912 let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "dbeaf647-6167-421a-bda9-c9327b25e2e6", routeValues, queryValues);
913 let url = verData.requestUrl;
914 let options = this.createRequestOptions('application/json', verData.apiVersion);
915 let res;
916 res = yield this.rest.get(url, options);
917 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildDefinition, false);
918 resolve(ret);
919 }
920 catch (err) {
921 reject(err);
922 }
923 }));
924 });
925 }
926 /**
927 * Gets a list of definitions.
928 *
929 * @param {string} project - Project ID or project name
930 * @param {string} name - If specified, filters to definitions whose names match this pattern.
931 * @param {string} repositoryId - A repository ID. If specified, filters to definitions that use this repository.
932 * @param {string} repositoryType - If specified, filters to definitions that have a repository of this type.
933 * @param {BuildInterfaces.DefinitionQueryOrder} queryOrder - Indicates the order in which definitions should be returned.
934 * @param {number} top - The maximum number of definitions to return.
935 * @param {string} continuationToken - A continuation token, returned by a previous call to this method, that can be used to return the next set of definitions.
936 * @param {Date} minMetricsTime - If specified, indicates the date from which metrics should be included.
937 * @param {number[]} definitionIds - A comma-delimited list that specifies the IDs of definitions to retrieve.
938 * @param {string} path - If specified, filters to definitions under this folder.
939 * @param {Date} builtAfter - If specified, filters to definitions that have builds after this date.
940 * @param {Date} notBuiltAfter - If specified, filters to definitions that do not have builds after this date.
941 * @param {boolean} includeAllProperties - Indicates whether the full definitions should be returned. By default, shallow representations of the definitions are returned.
942 * @param {boolean} includeLatestBuilds - Indicates whether to return the latest and latest completed builds for this definition.
943 * @param {string} taskIdFilter - If specified, filters to definitions that use the specified task.
944 * @param {number} processType - If specified, filters to definitions with the given process type.
945 * @param {string} yamlFilename - If specified, filters to YAML definitions that match the given filename. To use this filter includeAllProperties should be set to true
946 */
947 getDefinitions(project, name, repositoryId, repositoryType, queryOrder, top, continuationToken, minMetricsTime, definitionIds, path, builtAfter, notBuiltAfter, includeAllProperties, includeLatestBuilds, taskIdFilter, processType, yamlFilename) {
948 return __awaiter(this, void 0, void 0, function* () {
949 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
950 let routeValues = {
951 project: project
952 };
953 let queryValues = {
954 name: name,
955 repositoryId: repositoryId,
956 repositoryType: repositoryType,
957 queryOrder: queryOrder,
958 '$top': top,
959 continuationToken: continuationToken,
960 minMetricsTime: minMetricsTime,
961 definitionIds: definitionIds && definitionIds.join(","),
962 path: path,
963 builtAfter: builtAfter,
964 notBuiltAfter: notBuiltAfter,
965 includeAllProperties: includeAllProperties,
966 includeLatestBuilds: includeLatestBuilds,
967 taskIdFilter: taskIdFilter,
968 processType: processType,
969 yamlFilename: yamlFilename,
970 };
971 try {
972 let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "dbeaf647-6167-421a-bda9-c9327b25e2e6", routeValues, queryValues);
973 let url = verData.requestUrl;
974 let options = this.createRequestOptions('application/json', verData.apiVersion);
975 let res;
976 res = yield this.rest.get(url, options);
977 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildDefinitionReference, true);
978 resolve(ret);
979 }
980 catch (err) {
981 reject(err);
982 }
983 }));
984 });
985 }
986 /**
987 * Restores a deleted definition
988 *
989 * @param {string} project - Project ID or project name
990 * @param {number} definitionId - The identifier of the definition to restore.
991 * @param {boolean} deleted - When false, restores a deleted definition.
992 */
993 restoreDefinition(project, definitionId, deleted) {
994 return __awaiter(this, void 0, void 0, function* () {
995 if (deleted == null) {
996 throw new TypeError('deleted can not be null or undefined');
997 }
998 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
999 let routeValues = {
1000 project: project,
1001 definitionId: definitionId
1002 };
1003 let queryValues = {
1004 deleted: deleted,
1005 };
1006 try {
1007 let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "dbeaf647-6167-421a-bda9-c9327b25e2e6", routeValues, queryValues);
1008 let url = verData.requestUrl;
1009 let options = this.createRequestOptions('application/json', verData.apiVersion);
1010 let res;
1011 res = yield this.rest.update(url, null, options);
1012 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildDefinition, false);
1013 resolve(ret);
1014 }
1015 catch (err) {
1016 reject(err);
1017 }
1018 }));
1019 });
1020 }
1021 /**
1022 * Updates an existing build definition. In order for this operation to succeed, the value of the "Revision" property of the request body must match the existing build definition's. It is recommended that you obtain the existing build definition by using GET, modify the build definition as necessary, and then submit the modified definition with PUT.
1023 *
1024 * @param {BuildInterfaces.BuildDefinition} definition - The new version of the definition. Its "Revision" property must match the existing definition for the update to be accepted.
1025 * @param {string} project - Project ID or project name
1026 * @param {number} definitionId - The ID of the definition.
1027 * @param {number} secretsSourceDefinitionId
1028 * @param {number} secretsSourceDefinitionRevision
1029 */
1030 updateDefinition(definition, project, definitionId, secretsSourceDefinitionId, secretsSourceDefinitionRevision) {
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 project: project,
1035 definitionId: definitionId
1036 };
1037 let queryValues = {
1038 secretsSourceDefinitionId: secretsSourceDefinitionId,
1039 secretsSourceDefinitionRevision: secretsSourceDefinitionRevision,
1040 };
1041 try {
1042 let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "dbeaf647-6167-421a-bda9-c9327b25e2e6", routeValues, queryValues);
1043 let url = verData.requestUrl;
1044 let options = this.createRequestOptions('application/json', verData.apiVersion);
1045 let res;
1046 res = yield this.rest.replace(url, definition, options);
1047 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildDefinition, false);
1048 resolve(ret);
1049 }
1050 catch (err) {
1051 reject(err);
1052 }
1053 }));
1054 });
1055 }
1056 /**
1057 * Gets the contents of a file in the given source code repository.
1058 *
1059 * @param {string} project - Project ID or project name
1060 * @param {string} providerName - The name of the source provider.
1061 * @param {string} serviceEndpointId - If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit.
1062 * @param {string} repository - If specified, the vendor-specific identifier or the name of the repository to get branches. Can only be omitted for providers that do not support multiple repositories.
1063 * @param {string} commitOrBranch - The identifier of the commit or branch from which a file's contents are retrieved.
1064 * @param {string} path - The path to the file to retrieve, relative to the root of the repository.
1065 */
1066 getFileContents(project, providerName, serviceEndpointId, repository, commitOrBranch, path) {
1067 return __awaiter(this, void 0, void 0, function* () {
1068 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1069 let routeValues = {
1070 project: project,
1071 providerName: providerName
1072 };
1073 let queryValues = {
1074 serviceEndpointId: serviceEndpointId,
1075 repository: repository,
1076 commitOrBranch: commitOrBranch,
1077 path: path,
1078 };
1079 try {
1080 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "29d12225-b1d9-425f-b668-6c594a981313", routeValues, queryValues);
1081 let url = verData.requestUrl;
1082 let apiVersion = verData.apiVersion;
1083 let accept = this.createAcceptHeader("text/plain", apiVersion);
1084 resolve((yield this.http.get(url, { "Accept": accept })).message);
1085 }
1086 catch (err) {
1087 reject(err);
1088 }
1089 }));
1090 });
1091 }
1092 /**
1093 * Creates a new folder.
1094 *
1095 * @param {BuildInterfaces.Folder} folder - The folder.
1096 * @param {string} project - Project ID or project name
1097 * @param {string} path - The full path of the folder.
1098 */
1099 createFolder(folder, project, path) {
1100 return __awaiter(this, void 0, void 0, function* () {
1101 if (path == null) {
1102 throw new TypeError('path can not be null or undefined');
1103 }
1104 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1105 let routeValues = {
1106 project: project
1107 };
1108 let queryValues = {
1109 path: path,
1110 };
1111 try {
1112 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "a906531b-d2da-4f55-bda7-f3e676cc50d9", routeValues, queryValues);
1113 let url = verData.requestUrl;
1114 let options = this.createRequestOptions('application/json', verData.apiVersion);
1115 let res;
1116 res = yield this.rest.replace(url, folder, options);
1117 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Folder, false);
1118 resolve(ret);
1119 }
1120 catch (err) {
1121 reject(err);
1122 }
1123 }));
1124 });
1125 }
1126 /**
1127 * Deletes a definition folder. Definitions and their corresponding builds will also be deleted.
1128 *
1129 * @param {string} project - Project ID or project name
1130 * @param {string} path - The full path to the folder.
1131 */
1132 deleteFolder(project, path) {
1133 return __awaiter(this, void 0, void 0, function* () {
1134 if (path == null) {
1135 throw new TypeError('path can not be null or undefined');
1136 }
1137 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1138 let routeValues = {
1139 project: project
1140 };
1141 let queryValues = {
1142 path: path,
1143 };
1144 try {
1145 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "a906531b-d2da-4f55-bda7-f3e676cc50d9", routeValues, queryValues);
1146 let url = verData.requestUrl;
1147 let options = this.createRequestOptions('application/json', verData.apiVersion);
1148 let res;
1149 res = yield this.rest.del(url, options);
1150 let ret = this.formatResponse(res.result, null, false);
1151 resolve(ret);
1152 }
1153 catch (err) {
1154 reject(err);
1155 }
1156 }));
1157 });
1158 }
1159 /**
1160 * Gets a list of build definition folders.
1161 *
1162 * @param {string} project - Project ID or project name
1163 * @param {string} path - The path to start with.
1164 * @param {BuildInterfaces.FolderQueryOrder} queryOrder - The order in which folders should be returned.
1165 */
1166 getFolders(project, path, queryOrder) {
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 path: path
1172 };
1173 let queryValues = {
1174 queryOrder: queryOrder,
1175 };
1176 try {
1177 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "a906531b-d2da-4f55-bda7-f3e676cc50d9", routeValues, queryValues);
1178 let url = verData.requestUrl;
1179 let options = this.createRequestOptions('application/json', verData.apiVersion);
1180 let res;
1181 res = yield this.rest.get(url, options);
1182 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Folder, true);
1183 resolve(ret);
1184 }
1185 catch (err) {
1186 reject(err);
1187 }
1188 }));
1189 });
1190 }
1191 /**
1192 * Updates an existing folder at given existing path
1193 *
1194 * @param {BuildInterfaces.Folder} folder - The new version of the folder.
1195 * @param {string} project - Project ID or project name
1196 * @param {string} path - The full path to the folder.
1197 */
1198 updateFolder(folder, project, path) {
1199 return __awaiter(this, void 0, void 0, function* () {
1200 if (path == null) {
1201 throw new TypeError('path can not be null or undefined');
1202 }
1203 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1204 let routeValues = {
1205 project: project
1206 };
1207 let queryValues = {
1208 path: path,
1209 };
1210 try {
1211 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "a906531b-d2da-4f55-bda7-f3e676cc50d9", routeValues, queryValues);
1212 let url = verData.requestUrl;
1213 let options = this.createRequestOptions('application/json', verData.apiVersion);
1214 let res;
1215 res = yield this.rest.create(url, folder, options);
1216 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Folder, false);
1217 resolve(ret);
1218 }
1219 catch (err) {
1220 reject(err);
1221 }
1222 }));
1223 });
1224 }
1225 /**
1226 * Gets pipeline general settings.
1227 *
1228 * @param {string} project - Project ID or project name
1229 */
1230 getBuildGeneralSettings(project) {
1231 return __awaiter(this, void 0, void 0, function* () {
1232 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1233 let routeValues = {
1234 project: project
1235 };
1236 try {
1237 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "c4aefd19-30ff-405b-80ad-aca021e7242a", routeValues);
1238 let url = verData.requestUrl;
1239 let options = this.createRequestOptions('application/json', verData.apiVersion);
1240 let res;
1241 res = yield this.rest.get(url, options);
1242 let ret = this.formatResponse(res.result, null, false);
1243 resolve(ret);
1244 }
1245 catch (err) {
1246 reject(err);
1247 }
1248 }));
1249 });
1250 }
1251 /**
1252 * Updates pipeline general settings.
1253 *
1254 * @param {BuildInterfaces.PipelineGeneralSettings} newSettings
1255 * @param {string} project - Project ID or project name
1256 */
1257 updateBuildGeneralSettings(newSettings, project) {
1258 return __awaiter(this, void 0, void 0, function* () {
1259 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1260 let routeValues = {
1261 project: project
1262 };
1263 try {
1264 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "c4aefd19-30ff-405b-80ad-aca021e7242a", routeValues);
1265 let url = verData.requestUrl;
1266 let options = this.createRequestOptions('application/json', verData.apiVersion);
1267 let res;
1268 res = yield this.rest.update(url, newSettings, options);
1269 let ret = this.formatResponse(res.result, null, false);
1270 resolve(ret);
1271 }
1272 catch (err) {
1273 reject(err);
1274 }
1275 }));
1276 });
1277 }
1278 /**
1279 * Returns the retention history for the project collection. This includes pipelines that have custom retention rules that may prevent the retention job from cleaning them up, runs per pipeline with retention type, files associated with pipelines owned by the collection with retention type, and the number of files per pipeline.
1280 *
1281 * @param {number} daysToLookback
1282 */
1283 getRetentionHistory(daysToLookback) {
1284 return __awaiter(this, void 0, void 0, function* () {
1285 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1286 let routeValues = {};
1287 let queryValues = {
1288 daysToLookback: daysToLookback,
1289 };
1290 try {
1291 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "1a9c48be-0ef5-4ec2-b94f-f053bdd2d3bf", routeValues, queryValues);
1292 let url = verData.requestUrl;
1293 let options = this.createRequestOptions('application/json', verData.apiVersion);
1294 let res;
1295 res = yield this.rest.get(url, options);
1296 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildRetentionHistory, false);
1297 resolve(ret);
1298 }
1299 catch (err) {
1300 reject(err);
1301 }
1302 }));
1303 });
1304 }
1305 /**
1306 * Gets the latest build for a definition, optionally scoped to a specific branch.
1307 *
1308 * @param {string} project - Project ID or project name
1309 * @param {string} definition - definition name with optional leading folder path, or the definition id
1310 * @param {string} branchName - optional parameter that indicates the specific branch to use. If not specified, the default branch is used.
1311 */
1312 getLatestBuild(project, definition, branchName) {
1313 return __awaiter(this, void 0, void 0, function* () {
1314 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1315 let routeValues = {
1316 project: project,
1317 definition: definition
1318 };
1319 let queryValues = {
1320 branchName: branchName,
1321 };
1322 try {
1323 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "54481611-01f4-47f3-998f-160da0f0c229", routeValues, queryValues);
1324 let url = verData.requestUrl;
1325 let options = this.createRequestOptions('application/json', verData.apiVersion);
1326 let res;
1327 res = yield this.rest.get(url, options);
1328 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Build, false);
1329 resolve(ret);
1330 }
1331 catch (err) {
1332 reject(err);
1333 }
1334 }));
1335 });
1336 }
1337 /**
1338 * Adds new leases for pipeline runs.
1339 *
1340 * @param {BuildInterfaces.NewRetentionLease[]} newLeases
1341 * @param {string} project - Project ID or project name
1342 */
1343 addRetentionLeases(newLeases, project) {
1344 return __awaiter(this, void 0, void 0, function* () {
1345 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1346 let routeValues = {
1347 project: project
1348 };
1349 try {
1350 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "272051e4-9af1-45b5-ae22-8d960a5539d4", routeValues);
1351 let url = verData.requestUrl;
1352 let options = this.createRequestOptions('application/json', verData.apiVersion);
1353 let res;
1354 res = yield this.rest.create(url, newLeases, options);
1355 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.RetentionLease, true);
1356 resolve(ret);
1357 }
1358 catch (err) {
1359 reject(err);
1360 }
1361 }));
1362 });
1363 }
1364 /**
1365 * Removes specific retention leases.
1366 *
1367 * @param {string} project - Project ID or project name
1368 * @param {number[]} ids
1369 */
1370 deleteRetentionLeasesById(project, ids) {
1371 return __awaiter(this, void 0, void 0, function* () {
1372 if (ids == null) {
1373 throw new TypeError('ids can not be null or undefined');
1374 }
1375 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1376 let routeValues = {
1377 project: project
1378 };
1379 let queryValues = {
1380 ids: ids && ids.join(","),
1381 };
1382 try {
1383 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "272051e4-9af1-45b5-ae22-8d960a5539d4", routeValues, queryValues);
1384 let url = verData.requestUrl;
1385 let options = this.createRequestOptions('application/json', verData.apiVersion);
1386 let res;
1387 res = yield this.rest.del(url, options);
1388 let ret = this.formatResponse(res.result, null, false);
1389 resolve(ret);
1390 }
1391 catch (err) {
1392 reject(err);
1393 }
1394 }));
1395 });
1396 }
1397 /**
1398 * Returns the details of the retention lease given a lease id.
1399 *
1400 * @param {string} project - Project ID or project name
1401 * @param {number} leaseId
1402 */
1403 getRetentionLease(project, leaseId) {
1404 return __awaiter(this, void 0, void 0, function* () {
1405 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1406 let routeValues = {
1407 project: project,
1408 leaseId: leaseId
1409 };
1410 try {
1411 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "272051e4-9af1-45b5-ae22-8d960a5539d4", routeValues);
1412 let url = verData.requestUrl;
1413 let options = this.createRequestOptions('application/json', verData.apiVersion);
1414 let res;
1415 res = yield this.rest.get(url, options);
1416 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.RetentionLease, false);
1417 resolve(ret);
1418 }
1419 catch (err) {
1420 reject(err);
1421 }
1422 }));
1423 });
1424 }
1425 /**
1426 * Returns any leases matching the specified MinimalRetentionLeases
1427 *
1428 * @param {string} project - Project ID or project name
1429 * @param {BuildInterfaces.MinimalRetentionLease[]} leasesToFetch - List of JSON-serialized MinimalRetentionLeases separated by '|'
1430 */
1431 getRetentionLeasesByMinimalRetentionLeases(project, leasesToFetch) {
1432 return __awaiter(this, void 0, void 0, function* () {
1433 if (leasesToFetch == null) {
1434 throw new TypeError('leasesToFetch can not be null or undefined');
1435 }
1436 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1437 let routeValues = {
1438 project: project
1439 };
1440 let queryValues = {
1441 leasesToFetch: leasesToFetch && leasesToFetch.join("|"),
1442 };
1443 try {
1444 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "272051e4-9af1-45b5-ae22-8d960a5539d4", routeValues, queryValues);
1445 let url = verData.requestUrl;
1446 let options = this.createRequestOptions('application/json', verData.apiVersion);
1447 let res;
1448 res = yield this.rest.get(url, options);
1449 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.RetentionLease, true);
1450 resolve(ret);
1451 }
1452 catch (err) {
1453 reject(err);
1454 }
1455 }));
1456 });
1457 }
1458 /**
1459 * Returns any leases owned by the specified entity, optionally scoped to a single pipeline definition and run.
1460 *
1461 * @param {string} project - Project ID or project name
1462 * @param {string} ownerId
1463 * @param {number} definitionId - An optional parameter to limit the search to a specific pipeline definition.
1464 * @param {number} runId - An optional parameter to limit the search to a single pipeline run. Requires definitionId.
1465 */
1466 getRetentionLeasesByOwnerId(project, ownerId, definitionId, runId) {
1467 return __awaiter(this, void 0, void 0, function* () {
1468 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1469 let routeValues = {
1470 project: project
1471 };
1472 let queryValues = {
1473 ownerId: ownerId,
1474 definitionId: definitionId,
1475 runId: runId,
1476 };
1477 try {
1478 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "272051e4-9af1-45b5-ae22-8d960a5539d4", routeValues, queryValues);
1479 let url = verData.requestUrl;
1480 let options = this.createRequestOptions('application/json', verData.apiVersion);
1481 let res;
1482 res = yield this.rest.get(url, options);
1483 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.RetentionLease, true);
1484 resolve(ret);
1485 }
1486 catch (err) {
1487 reject(err);
1488 }
1489 }));
1490 });
1491 }
1492 /**
1493 * Returns any leases owned by the specified user, optionally scoped to a single pipeline definition and run.
1494 *
1495 * @param {string} project - Project ID or project name
1496 * @param {string} userOwnerId - The user id to search for.
1497 * @param {number} definitionId - An optional parameter to limit the search to a specific pipeline definition.
1498 * @param {number} runId - An optional parameter to limit the search to a single pipeline run. Requires definitionId.
1499 */
1500 getRetentionLeasesByUserId(project, userOwnerId, definitionId, runId) {
1501 return __awaiter(this, void 0, void 0, function* () {
1502 if (userOwnerId == null) {
1503 throw new TypeError('userOwnerId can not be null or undefined');
1504 }
1505 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1506 let routeValues = {
1507 project: project
1508 };
1509 let queryValues = {
1510 userOwnerId: userOwnerId,
1511 definitionId: definitionId,
1512 runId: runId,
1513 };
1514 try {
1515 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "272051e4-9af1-45b5-ae22-8d960a5539d4", routeValues, queryValues);
1516 let url = verData.requestUrl;
1517 let options = this.createRequestOptions('application/json', verData.apiVersion);
1518 let res;
1519 res = yield this.rest.get(url, options);
1520 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.RetentionLease, true);
1521 resolve(ret);
1522 }
1523 catch (err) {
1524 reject(err);
1525 }
1526 }));
1527 });
1528 }
1529 /**
1530 * Updates the duration or pipeline protection status of a retention lease.
1531 *
1532 * @param {BuildInterfaces.RetentionLeaseUpdate} leaseUpdate - The new data for the retention lease.
1533 * @param {string} project - Project ID or project name
1534 * @param {number} leaseId - The ID of the lease to update.
1535 */
1536 updateRetentionLease(leaseUpdate, project, leaseId) {
1537 return __awaiter(this, void 0, void 0, function* () {
1538 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1539 let routeValues = {
1540 project: project,
1541 leaseId: leaseId
1542 };
1543 try {
1544 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "272051e4-9af1-45b5-ae22-8d960a5539d4", routeValues);
1545 let url = verData.requestUrl;
1546 let options = this.createRequestOptions('application/json', verData.apiVersion);
1547 let res;
1548 res = yield this.rest.update(url, leaseUpdate, options);
1549 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.RetentionLease, false);
1550 resolve(ret);
1551 }
1552 catch (err) {
1553 reject(err);
1554 }
1555 }));
1556 });
1557 }
1558 /**
1559 * Gets an individual log file for a build.
1560 *
1561 * @param {string} project - Project ID or project name
1562 * @param {number} buildId - The ID of the build.
1563 * @param {number} logId - The ID of the log file.
1564 * @param {number} startLine - The start line.
1565 * @param {number} endLine - The end line.
1566 */
1567 getBuildLog(project, buildId, logId, startLine, endLine) {
1568 return __awaiter(this, void 0, void 0, function* () {
1569 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1570 let routeValues = {
1571 project: project,
1572 buildId: buildId,
1573 logId: logId
1574 };
1575 let queryValues = {
1576 startLine: startLine,
1577 endLine: endLine,
1578 };
1579 try {
1580 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "35a80daf-7f30-45fc-86e8-6b813d9c90df", routeValues, queryValues);
1581 let url = verData.requestUrl;
1582 let apiVersion = verData.apiVersion;
1583 let accept = this.createAcceptHeader("text/plain", apiVersion);
1584 resolve((yield this.http.get(url, { "Accept": accept })).message);
1585 }
1586 catch (err) {
1587 reject(err);
1588 }
1589 }));
1590 });
1591 }
1592 /**
1593 * Gets an individual log file for a build.
1594 *
1595 * @param {string} project - Project ID or project name
1596 * @param {number} buildId - The ID of the build.
1597 * @param {number} logId - The ID of the log file.
1598 * @param {number} startLine - The start line.
1599 * @param {number} endLine - The end line.
1600 */
1601 getBuildLogLines(project, buildId, logId, startLine, endLine) {
1602 return __awaiter(this, void 0, void 0, function* () {
1603 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1604 let routeValues = {
1605 project: project,
1606 buildId: buildId,
1607 logId: logId
1608 };
1609 let queryValues = {
1610 startLine: startLine,
1611 endLine: endLine,
1612 };
1613 try {
1614 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "35a80daf-7f30-45fc-86e8-6b813d9c90df", routeValues, queryValues);
1615 let url = verData.requestUrl;
1616 let options = this.createRequestOptions('application/json', verData.apiVersion);
1617 let res;
1618 res = yield this.rest.get(url, options);
1619 let ret = this.formatResponse(res.result, null, true);
1620 resolve(ret);
1621 }
1622 catch (err) {
1623 reject(err);
1624 }
1625 }));
1626 });
1627 }
1628 /**
1629 * Gets the logs for a build.
1630 *
1631 * @param {string} project - Project ID or project name
1632 * @param {number} buildId - The ID of the build.
1633 */
1634 getBuildLogs(project, buildId) {
1635 return __awaiter(this, void 0, void 0, function* () {
1636 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1637 let routeValues = {
1638 project: project,
1639 buildId: buildId
1640 };
1641 try {
1642 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "35a80daf-7f30-45fc-86e8-6b813d9c90df", routeValues);
1643 let url = verData.requestUrl;
1644 let options = this.createRequestOptions('application/json', verData.apiVersion);
1645 let res;
1646 res = yield this.rest.get(url, options);
1647 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildLog, true);
1648 resolve(ret);
1649 }
1650 catch (err) {
1651 reject(err);
1652 }
1653 }));
1654 });
1655 }
1656 /**
1657 * Gets the logs for a build.
1658 *
1659 * @param {string} project - Project ID or project name
1660 * @param {number} buildId - The ID of the build.
1661 */
1662 getBuildLogsZip(project, buildId) {
1663 return __awaiter(this, void 0, void 0, function* () {
1664 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1665 let routeValues = {
1666 project: project,
1667 buildId: buildId
1668 };
1669 try {
1670 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "35a80daf-7f30-45fc-86e8-6b813d9c90df", routeValues);
1671 let url = verData.requestUrl;
1672 let apiVersion = verData.apiVersion;
1673 let accept = this.createAcceptHeader("application/zip", apiVersion);
1674 resolve((yield this.http.get(url, { "Accept": accept })).message);
1675 }
1676 catch (err) {
1677 reject(err);
1678 }
1679 }));
1680 });
1681 }
1682 /**
1683 * Gets an individual log file for a build.
1684 *
1685 * @param {string} project - Project ID or project name
1686 * @param {number} buildId - The ID of the build.
1687 * @param {number} logId - The ID of the log file.
1688 * @param {number} startLine - The start line.
1689 * @param {number} endLine - The end line.
1690 */
1691 getBuildLogZip(project, buildId, logId, startLine, endLine) {
1692 return __awaiter(this, void 0, void 0, function* () {
1693 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1694 let routeValues = {
1695 project: project,
1696 buildId: buildId,
1697 logId: logId
1698 };
1699 let queryValues = {
1700 startLine: startLine,
1701 endLine: endLine,
1702 };
1703 try {
1704 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "35a80daf-7f30-45fc-86e8-6b813d9c90df", routeValues, queryValues);
1705 let url = verData.requestUrl;
1706 let apiVersion = verData.apiVersion;
1707 let accept = this.createAcceptHeader("application/zip", apiVersion);
1708 resolve((yield this.http.get(url, { "Accept": accept })).message);
1709 }
1710 catch (err) {
1711 reject(err);
1712 }
1713 }));
1714 });
1715 }
1716 /**
1717 * Gets build metrics for a project.
1718 *
1719 * @param {string} project - Project ID or project name
1720 * @param {string} metricAggregationType - The aggregation type to use (hourly, daily).
1721 * @param {Date} minMetricsTime - The date from which to calculate metrics.
1722 */
1723 getProjectMetrics(project, metricAggregationType, minMetricsTime) {
1724 return __awaiter(this, void 0, void 0, function* () {
1725 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1726 let routeValues = {
1727 project: project,
1728 metricAggregationType: metricAggregationType
1729 };
1730 let queryValues = {
1731 minMetricsTime: minMetricsTime,
1732 };
1733 try {
1734 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "7433fae7-a6bc-41dc-a6e2-eef9005ce41a", routeValues, queryValues);
1735 let url = verData.requestUrl;
1736 let options = this.createRequestOptions('application/json', verData.apiVersion);
1737 let res;
1738 res = yield this.rest.get(url, options);
1739 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildMetric, true);
1740 resolve(ret);
1741 }
1742 catch (err) {
1743 reject(err);
1744 }
1745 }));
1746 });
1747 }
1748 /**
1749 * Gets build metrics for a definition.
1750 *
1751 * @param {string} project - Project ID or project name
1752 * @param {number} definitionId - The ID of the definition.
1753 * @param {Date} minMetricsTime - The date from which to calculate metrics.
1754 */
1755 getDefinitionMetrics(project, definitionId, minMetricsTime) {
1756 return __awaiter(this, void 0, void 0, function* () {
1757 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1758 let routeValues = {
1759 project: project,
1760 definitionId: definitionId
1761 };
1762 let queryValues = {
1763 minMetricsTime: minMetricsTime,
1764 };
1765 try {
1766 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "d973b939-0ce0-4fec-91d8-da3940fa1827", routeValues, queryValues);
1767 let url = verData.requestUrl;
1768 let options = this.createRequestOptions('application/json', verData.apiVersion);
1769 let res;
1770 res = yield this.rest.get(url, options);
1771 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildMetric, true);
1772 resolve(ret);
1773 }
1774 catch (err) {
1775 reject(err);
1776 }
1777 }));
1778 });
1779 }
1780 /**
1781 * Gets all build definition options supported by the system.
1782 *
1783 * @param {string} project - Project ID or project name
1784 */
1785 getBuildOptionDefinitions(project) {
1786 return __awaiter(this, void 0, void 0, function* () {
1787 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1788 let routeValues = {
1789 project: project
1790 };
1791 try {
1792 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "591cb5a4-2d46-4f3a-a697-5cd42b6bd332", routeValues);
1793 let url = verData.requestUrl;
1794 let options = this.createRequestOptions('application/json', verData.apiVersion);
1795 let res;
1796 res = yield this.rest.get(url, options);
1797 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildOptionDefinition, true);
1798 resolve(ret);
1799 }
1800 catch (err) {
1801 reject(err);
1802 }
1803 }));
1804 });
1805 }
1806 /**
1807 * Gets the contents of a directory in the given source code repository.
1808 *
1809 * @param {string} project - Project ID or project name
1810 * @param {string} providerName - The name of the source provider.
1811 * @param {string} serviceEndpointId - If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit.
1812 * @param {string} repository - If specified, the vendor-specific identifier or the name of the repository to get branches. Can only be omitted for providers that do not support multiple repositories.
1813 * @param {string} commitOrBranch - The identifier of the commit or branch from which a file's contents are retrieved.
1814 * @param {string} path - The path contents to list, relative to the root of the repository.
1815 */
1816 getPathContents(project, providerName, serviceEndpointId, repository, commitOrBranch, path) {
1817 return __awaiter(this, void 0, void 0, function* () {
1818 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1819 let routeValues = {
1820 project: project,
1821 providerName: providerName
1822 };
1823 let queryValues = {
1824 serviceEndpointId: serviceEndpointId,
1825 repository: repository,
1826 commitOrBranch: commitOrBranch,
1827 path: path,
1828 };
1829 try {
1830 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "7944d6fb-df01-4709-920a-7a189aa34037", routeValues, queryValues);
1831 let url = verData.requestUrl;
1832 let options = this.createRequestOptions('application/json', verData.apiVersion);
1833 let res;
1834 res = yield this.rest.get(url, options);
1835 let ret = this.formatResponse(res.result, null, true);
1836 resolve(ret);
1837 }
1838 catch (err) {
1839 reject(err);
1840 }
1841 }));
1842 });
1843 }
1844 /**
1845 * Gets properties for a build.
1846 *
1847 * @param {string} project - Project ID or project name
1848 * @param {number} buildId - The ID of the build.
1849 * @param {string[]} filter - A comma-delimited list of properties. If specified, filters to these specific properties.
1850 */
1851 getBuildProperties(project, buildId, filter) {
1852 return __awaiter(this, void 0, void 0, function* () {
1853 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1854 let routeValues = {
1855 project: project,
1856 buildId: buildId
1857 };
1858 let queryValues = {
1859 filter: filter && filter.join(","),
1860 };
1861 try {
1862 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "0a6312e9-0627-49b7-8083-7d74a64849c9", routeValues, queryValues);
1863 let url = verData.requestUrl;
1864 let options = this.createRequestOptions('application/json', verData.apiVersion);
1865 let res;
1866 res = yield this.rest.get(url, options);
1867 let ret = this.formatResponse(res.result, null, false);
1868 resolve(ret);
1869 }
1870 catch (err) {
1871 reject(err);
1872 }
1873 }));
1874 });
1875 }
1876 /**
1877 * Updates properties for a build.
1878 *
1879 * @param {VSSInterfaces.JsonPatchDocument} document - A json-patch document describing the properties to update.
1880 * @param {string} project - Project ID or project name
1881 * @param {number} buildId - The ID of the build.
1882 */
1883 updateBuildProperties(customHeaders, document, project, buildId) {
1884 return __awaiter(this, void 0, void 0, function* () {
1885 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1886 let routeValues = {
1887 project: project,
1888 buildId: buildId
1889 };
1890 customHeaders = customHeaders || {};
1891 customHeaders["Content-Type"] = "application/json-patch+json";
1892 try {
1893 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "0a6312e9-0627-49b7-8083-7d74a64849c9", routeValues);
1894 let url = verData.requestUrl;
1895 let options = this.createRequestOptions('application/json', verData.apiVersion);
1896 options.additionalHeaders = customHeaders;
1897 let res;
1898 res = yield this.rest.update(url, document, options);
1899 let ret = this.formatResponse(res.result, null, false);
1900 resolve(ret);
1901 }
1902 catch (err) {
1903 reject(err);
1904 }
1905 }));
1906 });
1907 }
1908 /**
1909 * Gets properties for a definition.
1910 *
1911 * @param {string} project - Project ID or project name
1912 * @param {number} definitionId - The ID of the definition.
1913 * @param {string[]} filter - A comma-delimited list of properties. If specified, filters to these specific properties.
1914 */
1915 getDefinitionProperties(project, definitionId, filter) {
1916 return __awaiter(this, void 0, void 0, function* () {
1917 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1918 let routeValues = {
1919 project: project,
1920 definitionId: definitionId
1921 };
1922 let queryValues = {
1923 filter: filter && filter.join(","),
1924 };
1925 try {
1926 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "d9826ad7-2a68-46a9-a6e9-677698777895", routeValues, queryValues);
1927 let url = verData.requestUrl;
1928 let options = this.createRequestOptions('application/json', verData.apiVersion);
1929 let res;
1930 res = yield this.rest.get(url, options);
1931 let ret = this.formatResponse(res.result, null, false);
1932 resolve(ret);
1933 }
1934 catch (err) {
1935 reject(err);
1936 }
1937 }));
1938 });
1939 }
1940 /**
1941 * Updates properties for a definition.
1942 *
1943 * @param {VSSInterfaces.JsonPatchDocument} document - A json-patch document describing the properties to update.
1944 * @param {string} project - Project ID or project name
1945 * @param {number} definitionId - The ID of the definition.
1946 */
1947 updateDefinitionProperties(customHeaders, document, project, definitionId) {
1948 return __awaiter(this, void 0, void 0, function* () {
1949 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1950 let routeValues = {
1951 project: project,
1952 definitionId: definitionId
1953 };
1954 customHeaders = customHeaders || {};
1955 customHeaders["Content-Type"] = "application/json-patch+json";
1956 try {
1957 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "d9826ad7-2a68-46a9-a6e9-677698777895", routeValues);
1958 let url = verData.requestUrl;
1959 let options = this.createRequestOptions('application/json', verData.apiVersion);
1960 options.additionalHeaders = customHeaders;
1961 let res;
1962 res = yield this.rest.update(url, document, options);
1963 let ret = this.formatResponse(res.result, null, false);
1964 resolve(ret);
1965 }
1966 catch (err) {
1967 reject(err);
1968 }
1969 }));
1970 });
1971 }
1972 /**
1973 * Gets a pull request object from source provider.
1974 *
1975 * @param {string} project - Project ID or project name
1976 * @param {string} providerName - The name of the source provider.
1977 * @param {string} pullRequestId - Vendor-specific id of the pull request.
1978 * @param {string} repositoryId - Vendor-specific identifier or the name of the repository that contains the pull request.
1979 * @param {string} serviceEndpointId - If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit.
1980 */
1981 getPullRequest(project, providerName, pullRequestId, repositoryId, serviceEndpointId) {
1982 return __awaiter(this, void 0, void 0, function* () {
1983 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1984 let routeValues = {
1985 project: project,
1986 providerName: providerName,
1987 pullRequestId: pullRequestId
1988 };
1989 let queryValues = {
1990 repositoryId: repositoryId,
1991 serviceEndpointId: serviceEndpointId,
1992 };
1993 try {
1994 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "d8763ec7-9ff0-4fb4-b2b2-9d757906ff14", routeValues, queryValues);
1995 let url = verData.requestUrl;
1996 let options = this.createRequestOptions('application/json', verData.apiVersion);
1997 let res;
1998 res = yield this.rest.get(url, options);
1999 let ret = this.formatResponse(res.result, null, false);
2000 resolve(ret);
2001 }
2002 catch (err) {
2003 reject(err);
2004 }
2005 }));
2006 });
2007 }
2008 /**
2009 * Gets a build report.
2010 *
2011 * @param {string} project - Project ID or project name
2012 * @param {number} buildId - The ID of the build.
2013 * @param {string} type
2014 */
2015 getBuildReport(project, buildId, type) {
2016 return __awaiter(this, void 0, void 0, function* () {
2017 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2018 let routeValues = {
2019 project: project,
2020 buildId: buildId
2021 };
2022 let queryValues = {
2023 type: type,
2024 };
2025 try {
2026 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "45bcaa88-67e1-4042-a035-56d3b4a7d44c", routeValues, queryValues);
2027 let url = verData.requestUrl;
2028 let options = this.createRequestOptions('application/json', verData.apiVersion);
2029 let res;
2030 res = yield this.rest.get(url, options);
2031 let ret = this.formatResponse(res.result, null, false);
2032 resolve(ret);
2033 }
2034 catch (err) {
2035 reject(err);
2036 }
2037 }));
2038 });
2039 }
2040 /**
2041 * Gets a build report.
2042 *
2043 * @param {string} project - Project ID or project name
2044 * @param {number} buildId - The ID of the build.
2045 * @param {string} type
2046 */
2047 getBuildReportHtmlContent(project, buildId, type) {
2048 return __awaiter(this, void 0, void 0, function* () {
2049 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2050 let routeValues = {
2051 project: project,
2052 buildId: buildId
2053 };
2054 let queryValues = {
2055 type: type,
2056 };
2057 try {
2058 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "45bcaa88-67e1-4042-a035-56d3b4a7d44c", routeValues, queryValues);
2059 let url = verData.requestUrl;
2060 let apiVersion = verData.apiVersion;
2061 let accept = this.createAcceptHeader("text/html", apiVersion);
2062 resolve((yield this.http.get(url, { "Accept": accept })).message);
2063 }
2064 catch (err) {
2065 reject(err);
2066 }
2067 }));
2068 });
2069 }
2070 /**
2071 * Gets a list of source code repositories.
2072 *
2073 * @param {string} project - Project ID or project name
2074 * @param {string} providerName - The name of the source provider.
2075 * @param {string} serviceEndpointId - If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit.
2076 * @param {string} repository - If specified, the vendor-specific identifier or the name of a single repository to get.
2077 * @param {BuildInterfaces.ResultSet} resultSet - 'top' for the repositories most relevant for the endpoint. If not set, all repositories are returned. Ignored if 'repository' is set.
2078 * @param {boolean} pageResults - If set to true, this will limit the set of results and will return a continuation token to continue the query.
2079 * @param {string} continuationToken - When paging results, this is a continuation token, returned by a previous call to this method, that can be used to return the next set of repositories.
2080 */
2081 listRepositories(project, providerName, serviceEndpointId, repository, resultSet, pageResults, continuationToken) {
2082 return __awaiter(this, void 0, void 0, function* () {
2083 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2084 let routeValues = {
2085 project: project,
2086 providerName: providerName
2087 };
2088 let queryValues = {
2089 serviceEndpointId: serviceEndpointId,
2090 repository: repository,
2091 resultSet: resultSet,
2092 pageResults: pageResults,
2093 continuationToken: continuationToken,
2094 };
2095 try {
2096 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "d44d1680-f978-4834-9b93-8c6e132329c9", routeValues, queryValues);
2097 let url = verData.requestUrl;
2098 let options = this.createRequestOptions('application/json', verData.apiVersion);
2099 let res;
2100 res = yield this.rest.get(url, options);
2101 let ret = this.formatResponse(res.result, null, false);
2102 resolve(ret);
2103 }
2104 catch (err) {
2105 reject(err);
2106 }
2107 }));
2108 });
2109 }
2110 /**
2111 * @param {BuildInterfaces.DefinitionResourceReference[]} resources
2112 * @param {string} project - Project ID or project name
2113 * @param {number} definitionId
2114 */
2115 authorizeDefinitionResources(resources, project, definitionId) {
2116 return __awaiter(this, void 0, void 0, function* () {
2117 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2118 let routeValues = {
2119 project: project,
2120 definitionId: definitionId
2121 };
2122 try {
2123 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "ea623316-1967-45eb-89ab-e9e6110cf2d6", routeValues);
2124 let url = verData.requestUrl;
2125 let options = this.createRequestOptions('application/json', verData.apiVersion);
2126 let res;
2127 res = yield this.rest.update(url, resources, options);
2128 let ret = this.formatResponse(res.result, null, true);
2129 resolve(ret);
2130 }
2131 catch (err) {
2132 reject(err);
2133 }
2134 }));
2135 });
2136 }
2137 /**
2138 * @param {string} project - Project ID or project name
2139 * @param {number} definitionId
2140 */
2141 getDefinitionResources(project, definitionId) {
2142 return __awaiter(this, void 0, void 0, function* () {
2143 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2144 let routeValues = {
2145 project: project,
2146 definitionId: definitionId
2147 };
2148 try {
2149 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "ea623316-1967-45eb-89ab-e9e6110cf2d6", routeValues);
2150 let url = verData.requestUrl;
2151 let options = this.createRequestOptions('application/json', verData.apiVersion);
2152 let res;
2153 res = yield this.rest.get(url, options);
2154 let ret = this.formatResponse(res.result, null, true);
2155 resolve(ret);
2156 }
2157 catch (err) {
2158 reject(err);
2159 }
2160 }));
2161 });
2162 }
2163 /**
2164 * Gets information about build resources in the system.
2165 *
2166 */
2167 getResourceUsage() {
2168 return __awaiter(this, void 0, void 0, function* () {
2169 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2170 let routeValues = {};
2171 try {
2172 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "3813d06c-9e36-4ea1-aac3-61a485d60e3d", routeValues);
2173 let url = verData.requestUrl;
2174 let options = this.createRequestOptions('application/json', verData.apiVersion);
2175 let res;
2176 res = yield this.rest.get(url, options);
2177 let ret = this.formatResponse(res.result, null, false);
2178 resolve(ret);
2179 }
2180 catch (err) {
2181 reject(err);
2182 }
2183 }));
2184 });
2185 }
2186 /**
2187 * Gets the project's retention settings.
2188 *
2189 * @param {string} project - Project ID or project name
2190 */
2191 getRetentionSettings(project) {
2192 return __awaiter(this, void 0, void 0, function* () {
2193 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2194 let routeValues = {
2195 project: project
2196 };
2197 try {
2198 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "dadb46e7-5851-4c72-820e-ae8abb82f59f", routeValues);
2199 let url = verData.requestUrl;
2200 let options = this.createRequestOptions('application/json', verData.apiVersion);
2201 let res;
2202 res = yield this.rest.get(url, options);
2203 let ret = this.formatResponse(res.result, null, false);
2204 resolve(ret);
2205 }
2206 catch (err) {
2207 reject(err);
2208 }
2209 }));
2210 });
2211 }
2212 /**
2213 * Updates the project's retention settings.
2214 *
2215 * @param {BuildInterfaces.UpdateProjectRetentionSettingModel} updateModel
2216 * @param {string} project - Project ID or project name
2217 */
2218 updateRetentionSettings(updateModel, project) {
2219 return __awaiter(this, void 0, void 0, function* () {
2220 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2221 let routeValues = {
2222 project: project
2223 };
2224 try {
2225 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "dadb46e7-5851-4c72-820e-ae8abb82f59f", routeValues);
2226 let url = verData.requestUrl;
2227 let options = this.createRequestOptions('application/json', verData.apiVersion);
2228 let res;
2229 res = yield this.rest.update(url, updateModel, options);
2230 let ret = this.formatResponse(res.result, null, false);
2231 resolve(ret);
2232 }
2233 catch (err) {
2234 reject(err);
2235 }
2236 }));
2237 });
2238 }
2239 /**
2240 * Gets all revisions of a definition.
2241 *
2242 * @param {string} project - Project ID or project name
2243 * @param {number} definitionId - The ID of the definition.
2244 */
2245 getDefinitionRevisions(project, definitionId) {
2246 return __awaiter(this, void 0, void 0, function* () {
2247 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2248 let routeValues = {
2249 project: project,
2250 definitionId: definitionId
2251 };
2252 try {
2253 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "7c116775-52e5-453e-8c5d-914d9762d8c4", routeValues);
2254 let url = verData.requestUrl;
2255 let options = this.createRequestOptions('application/json', verData.apiVersion);
2256 let res;
2257 res = yield this.rest.get(url, options);
2258 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildDefinitionRevision, true);
2259 resolve(ret);
2260 }
2261 catch (err) {
2262 reject(err);
2263 }
2264 }));
2265 });
2266 }
2267 /**
2268 * Gets the build settings.
2269 *
2270 * @param {string} project - Project ID or project name
2271 */
2272 getBuildSettings(project) {
2273 return __awaiter(this, void 0, void 0, function* () {
2274 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2275 let routeValues = {
2276 project: project
2277 };
2278 try {
2279 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "aa8c1c9c-ef8b-474a-b8c4-785c7b191d0d", routeValues);
2280 let url = verData.requestUrl;
2281 let options = this.createRequestOptions('application/json', verData.apiVersion);
2282 let res;
2283 res = yield this.rest.get(url, options);
2284 let ret = this.formatResponse(res.result, null, false);
2285 resolve(ret);
2286 }
2287 catch (err) {
2288 reject(err);
2289 }
2290 }));
2291 });
2292 }
2293 /**
2294 * Updates the build settings.
2295 *
2296 * @param {BuildInterfaces.BuildSettings} settings - The new settings.
2297 * @param {string} project - Project ID or project name
2298 */
2299 updateBuildSettings(settings, project) {
2300 return __awaiter(this, void 0, void 0, function* () {
2301 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2302 let routeValues = {
2303 project: project
2304 };
2305 try {
2306 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "aa8c1c9c-ef8b-474a-b8c4-785c7b191d0d", routeValues);
2307 let url = verData.requestUrl;
2308 let options = this.createRequestOptions('application/json', verData.apiVersion);
2309 let res;
2310 res = yield this.rest.update(url, settings, options);
2311 let ret = this.formatResponse(res.result, null, false);
2312 resolve(ret);
2313 }
2314 catch (err) {
2315 reject(err);
2316 }
2317 }));
2318 });
2319 }
2320 /**
2321 * Get a list of source providers and their capabilities.
2322 *
2323 * @param {string} project - Project ID or project name
2324 */
2325 listSourceProviders(project) {
2326 return __awaiter(this, void 0, void 0, function* () {
2327 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2328 let routeValues = {
2329 project: project
2330 };
2331 try {
2332 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "3ce81729-954f-423d-a581-9fea01d25186", routeValues);
2333 let url = verData.requestUrl;
2334 let options = this.createRequestOptions('application/json', verData.apiVersion);
2335 let res;
2336 res = yield this.rest.get(url, options);
2337 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.SourceProviderAttributes, true);
2338 resolve(ret);
2339 }
2340 catch (err) {
2341 reject(err);
2342 }
2343 }));
2344 });
2345 }
2346 /**
2347 * Update a build stage
2348 *
2349 * @param {BuildInterfaces.UpdateStageParameters} updateParameters
2350 * @param {number} buildId
2351 * @param {string} stageRefName
2352 * @param {string} project - Project ID or project name
2353 */
2354 updateStage(updateParameters, buildId, stageRefName, project) {
2355 return __awaiter(this, void 0, void 0, function* () {
2356 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2357 let routeValues = {
2358 project: project,
2359 buildId: buildId,
2360 stageRefName: stageRefName
2361 };
2362 try {
2363 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "b8aac6c9-744b-46e1-88fc-3550969f9313", routeValues);
2364 let url = verData.requestUrl;
2365 let options = this.createRequestOptions('application/json', verData.apiVersion);
2366 let res;
2367 res = yield this.rest.update(url, updateParameters, options);
2368 let ret = this.formatResponse(res.result, null, false);
2369 resolve(ret);
2370 }
2371 catch (err) {
2372 reject(err);
2373 }
2374 }));
2375 });
2376 }
2377 /**
2378 * <p>Gets the build status for a definition, optionally scoped to a specific branch, stage, job, and configuration.</p> <p>If there are more than one, then it is required to pass in a stageName value when specifying a jobName, and the same rule then applies for both if passing a configuration parameter.</p>
2379 *
2380 * @param {string} project - Project ID or project name
2381 * @param {string} definition - Either the definition name with optional leading folder path, or the definition id.
2382 * @param {string} branchName - Only consider the most recent build for this branch. If not specified, the default branch is used.
2383 * @param {string} stageName - Use this stage within the pipeline to render the status.
2384 * @param {string} jobName - Use this job within a stage of the pipeline to render the status.
2385 * @param {string} configuration - Use this job configuration to render the status
2386 * @param {string} label - Replaces the default text on the left side of the badge.
2387 */
2388 getStatusBadge(project, definition, branchName, stageName, jobName, configuration, label) {
2389 return __awaiter(this, void 0, void 0, function* () {
2390 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2391 let routeValues = {
2392 project: project,
2393 definition: definition
2394 };
2395 let queryValues = {
2396 branchName: branchName,
2397 stageName: stageName,
2398 jobName: jobName,
2399 configuration: configuration,
2400 label: label,
2401 };
2402 try {
2403 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "07acfdce-4757-4439-b422-ddd13a2fcc10", routeValues, queryValues);
2404 let url = verData.requestUrl;
2405 let options = this.createRequestOptions('application/json', verData.apiVersion);
2406 let res;
2407 res = yield this.rest.get(url, options);
2408 let ret = this.formatResponse(res.result, null, false);
2409 resolve(ret);
2410 }
2411 catch (err) {
2412 reject(err);
2413 }
2414 }));
2415 });
2416 }
2417 /**
2418 * Adds a tag to a build.
2419 *
2420 * @param {string} project - Project ID or project name
2421 * @param {number} buildId - The ID of the build.
2422 * @param {string} tag - The tag to add.
2423 */
2424 addBuildTag(project, buildId, tag) {
2425 return __awaiter(this, void 0, void 0, function* () {
2426 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2427 let routeValues = {
2428 project: project,
2429 buildId: buildId,
2430 tag: tag
2431 };
2432 try {
2433 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "6e6114b2-8161-44c8-8f6c-c5505782427f", routeValues);
2434 let url = verData.requestUrl;
2435 let options = this.createRequestOptions('application/json', verData.apiVersion);
2436 let res;
2437 res = yield this.rest.replace(url, null, options);
2438 let ret = this.formatResponse(res.result, null, true);
2439 resolve(ret);
2440 }
2441 catch (err) {
2442 reject(err);
2443 }
2444 }));
2445 });
2446 }
2447 /**
2448 * Adds tags to a build.
2449 *
2450 * @param {string[]} tags - The tags to add. Request body is composed directly from listed tags.
2451 * @param {string} project - Project ID or project name
2452 * @param {number} buildId - The ID of the build.
2453 */
2454 addBuildTags(tags, project, buildId) {
2455 return __awaiter(this, void 0, void 0, function* () {
2456 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2457 let routeValues = {
2458 project: project,
2459 buildId: buildId
2460 };
2461 try {
2462 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "6e6114b2-8161-44c8-8f6c-c5505782427f", routeValues);
2463 let url = verData.requestUrl;
2464 let options = this.createRequestOptions('application/json', verData.apiVersion);
2465 let res;
2466 res = yield this.rest.create(url, tags, options);
2467 let ret = this.formatResponse(res.result, null, true);
2468 resolve(ret);
2469 }
2470 catch (err) {
2471 reject(err);
2472 }
2473 }));
2474 });
2475 }
2476 /**
2477 * Removes a tag from a build. NOTE: This API will not work for tags with special characters. To remove tags with special characters, use the PATCH method instead (in 6.0+)
2478 *
2479 * @param {string} project - Project ID or project name
2480 * @param {number} buildId - The ID of the build.
2481 * @param {string} tag - The tag to remove.
2482 */
2483 deleteBuildTag(project, buildId, tag) {
2484 return __awaiter(this, void 0, void 0, function* () {
2485 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2486 let routeValues = {
2487 project: project,
2488 buildId: buildId,
2489 tag: tag
2490 };
2491 try {
2492 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "6e6114b2-8161-44c8-8f6c-c5505782427f", routeValues);
2493 let url = verData.requestUrl;
2494 let options = this.createRequestOptions('application/json', verData.apiVersion);
2495 let res;
2496 res = yield this.rest.del(url, options);
2497 let ret = this.formatResponse(res.result, null, true);
2498 resolve(ret);
2499 }
2500 catch (err) {
2501 reject(err);
2502 }
2503 }));
2504 });
2505 }
2506 /**
2507 * Gets the tags for a build.
2508 *
2509 * @param {string} project - Project ID or project name
2510 * @param {number} buildId - The ID of the build.
2511 */
2512 getBuildTags(project, buildId) {
2513 return __awaiter(this, void 0, void 0, function* () {
2514 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2515 let routeValues = {
2516 project: project,
2517 buildId: buildId
2518 };
2519 try {
2520 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "6e6114b2-8161-44c8-8f6c-c5505782427f", routeValues);
2521 let url = verData.requestUrl;
2522 let options = this.createRequestOptions('application/json', verData.apiVersion);
2523 let res;
2524 res = yield this.rest.get(url, options);
2525 let ret = this.formatResponse(res.result, null, true);
2526 resolve(ret);
2527 }
2528 catch (err) {
2529 reject(err);
2530 }
2531 }));
2532 });
2533 }
2534 /**
2535 * Adds/Removes tags from a build.
2536 *
2537 * @param {BuildInterfaces.UpdateTagParameters} updateParameters - The tags to add/remove.
2538 * @param {string} project - Project ID or project name
2539 * @param {number} buildId - The ID of the build.
2540 */
2541 updateBuildTags(updateParameters, project, buildId) {
2542 return __awaiter(this, void 0, void 0, function* () {
2543 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2544 let routeValues = {
2545 project: project,
2546 buildId: buildId
2547 };
2548 try {
2549 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "6e6114b2-8161-44c8-8f6c-c5505782427f", routeValues);
2550 let url = verData.requestUrl;
2551 let options = this.createRequestOptions('application/json', verData.apiVersion);
2552 let res;
2553 res = yield this.rest.update(url, updateParameters, options);
2554 let ret = this.formatResponse(res.result, null, true);
2555 resolve(ret);
2556 }
2557 catch (err) {
2558 reject(err);
2559 }
2560 }));
2561 });
2562 }
2563 /**
2564 * Adds a tag to a definition
2565 *
2566 * @param {string} project - Project ID or project name
2567 * @param {number} definitionId - The ID of the definition.
2568 * @param {string} tag - The tag to add.
2569 */
2570 addDefinitionTag(project, definitionId, tag) {
2571 return __awaiter(this, void 0, void 0, function* () {
2572 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2573 let routeValues = {
2574 project: project,
2575 definitionId: definitionId,
2576 tag: tag
2577 };
2578 try {
2579 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "cb894432-134a-4d31-a839-83beceaace4b", routeValues);
2580 let url = verData.requestUrl;
2581 let options = this.createRequestOptions('application/json', verData.apiVersion);
2582 let res;
2583 res = yield this.rest.replace(url, null, options);
2584 let ret = this.formatResponse(res.result, null, true);
2585 resolve(ret);
2586 }
2587 catch (err) {
2588 reject(err);
2589 }
2590 }));
2591 });
2592 }
2593 /**
2594 * Adds multiple tags to a definition.
2595 *
2596 * @param {string[]} tags - The tags to add.
2597 * @param {string} project - Project ID or project name
2598 * @param {number} definitionId - The ID of the definition.
2599 */
2600 addDefinitionTags(tags, project, definitionId) {
2601 return __awaiter(this, void 0, void 0, function* () {
2602 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2603 let routeValues = {
2604 project: project,
2605 definitionId: definitionId
2606 };
2607 try {
2608 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "cb894432-134a-4d31-a839-83beceaace4b", routeValues);
2609 let url = verData.requestUrl;
2610 let options = this.createRequestOptions('application/json', verData.apiVersion);
2611 let res;
2612 res = yield this.rest.create(url, tags, options);
2613 let ret = this.formatResponse(res.result, null, true);
2614 resolve(ret);
2615 }
2616 catch (err) {
2617 reject(err);
2618 }
2619 }));
2620 });
2621 }
2622 /**
2623 * Removes a tag from a definition. NOTE: This API will not work for tags with special characters. To remove tags with special characters, use the PATCH method instead (in 6.0+)
2624 *
2625 * @param {string} project - Project ID or project name
2626 * @param {number} definitionId - The ID of the definition.
2627 * @param {string} tag - The tag to remove.
2628 */
2629 deleteDefinitionTag(project, definitionId, tag) {
2630 return __awaiter(this, void 0, void 0, function* () {
2631 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2632 let routeValues = {
2633 project: project,
2634 definitionId: definitionId,
2635 tag: tag
2636 };
2637 try {
2638 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "cb894432-134a-4d31-a839-83beceaace4b", routeValues);
2639 let url = verData.requestUrl;
2640 let options = this.createRequestOptions('application/json', verData.apiVersion);
2641 let res;
2642 res = yield this.rest.del(url, options);
2643 let ret = this.formatResponse(res.result, null, true);
2644 resolve(ret);
2645 }
2646 catch (err) {
2647 reject(err);
2648 }
2649 }));
2650 });
2651 }
2652 /**
2653 * Gets the tags for a definition.
2654 *
2655 * @param {string} project - Project ID or project name
2656 * @param {number} definitionId - The ID of the definition.
2657 * @param {number} revision - The definition revision number. If not specified, uses the latest revision of the definition.
2658 */
2659 getDefinitionTags(project, definitionId, revision) {
2660 return __awaiter(this, void 0, void 0, function* () {
2661 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2662 let routeValues = {
2663 project: project,
2664 definitionId: definitionId
2665 };
2666 let queryValues = {
2667 revision: revision,
2668 };
2669 try {
2670 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "cb894432-134a-4d31-a839-83beceaace4b", routeValues, queryValues);
2671 let url = verData.requestUrl;
2672 let options = this.createRequestOptions('application/json', verData.apiVersion);
2673 let res;
2674 res = yield this.rest.get(url, options);
2675 let ret = this.formatResponse(res.result, null, true);
2676 resolve(ret);
2677 }
2678 catch (err) {
2679 reject(err);
2680 }
2681 }));
2682 });
2683 }
2684 /**
2685 * Adds/Removes tags from a definition.
2686 *
2687 * @param {BuildInterfaces.UpdateTagParameters} updateParameters - The tags to add/remove.
2688 * @param {string} project - Project ID or project name
2689 * @param {number} definitionId - The ID of the definition.
2690 */
2691 updateDefinitionTags(updateParameters, project, definitionId) {
2692 return __awaiter(this, void 0, void 0, function* () {
2693 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2694 let routeValues = {
2695 project: project,
2696 definitionId: definitionId
2697 };
2698 try {
2699 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "cb894432-134a-4d31-a839-83beceaace4b", routeValues);
2700 let url = verData.requestUrl;
2701 let options = this.createRequestOptions('application/json', verData.apiVersion);
2702 let res;
2703 res = yield this.rest.update(url, updateParameters, options);
2704 let ret = this.formatResponse(res.result, null, true);
2705 resolve(ret);
2706 }
2707 catch (err) {
2708 reject(err);
2709 }
2710 }));
2711 });
2712 }
2713 /**
2714 * Removes a tag from builds, definitions, and from the tag store
2715 *
2716 * @param {string} project - Project ID or project name
2717 * @param {string} tag - The tag to remove.
2718 */
2719 deleteTag(project, tag) {
2720 return __awaiter(this, void 0, void 0, function* () {
2721 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2722 let routeValues = {
2723 project: project,
2724 tag: tag
2725 };
2726 try {
2727 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "d84ac5c6-edc7-43d5-adc9-1b34be5dea09", routeValues);
2728 let url = verData.requestUrl;
2729 let options = this.createRequestOptions('application/json', verData.apiVersion);
2730 let res;
2731 res = yield this.rest.del(url, options);
2732 let ret = this.formatResponse(res.result, null, true);
2733 resolve(ret);
2734 }
2735 catch (err) {
2736 reject(err);
2737 }
2738 }));
2739 });
2740 }
2741 /**
2742 * Gets a list of all build tags in the project.
2743 *
2744 * @param {string} project - Project ID or project name
2745 */
2746 getTags(project) {
2747 return __awaiter(this, void 0, void 0, function* () {
2748 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2749 let routeValues = {
2750 project: project
2751 };
2752 try {
2753 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "d84ac5c6-edc7-43d5-adc9-1b34be5dea09", routeValues);
2754 let url = verData.requestUrl;
2755 let options = this.createRequestOptions('application/json', verData.apiVersion);
2756 let res;
2757 res = yield this.rest.get(url, options);
2758 let ret = this.formatResponse(res.result, null, true);
2759 resolve(ret);
2760 }
2761 catch (err) {
2762 reject(err);
2763 }
2764 }));
2765 });
2766 }
2767 /**
2768 * Deletes a build definition template.
2769 *
2770 * @param {string} project - Project ID or project name
2771 * @param {string} templateId - The ID of the template.
2772 */
2773 deleteTemplate(project, templateId) {
2774 return __awaiter(this, void 0, void 0, function* () {
2775 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2776 let routeValues = {
2777 project: project,
2778 templateId: templateId
2779 };
2780 try {
2781 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "e884571e-7f92-4d6a-9274-3f5649900835", routeValues);
2782 let url = verData.requestUrl;
2783 let options = this.createRequestOptions('application/json', verData.apiVersion);
2784 let res;
2785 res = yield this.rest.del(url, options);
2786 let ret = this.formatResponse(res.result, null, false);
2787 resolve(ret);
2788 }
2789 catch (err) {
2790 reject(err);
2791 }
2792 }));
2793 });
2794 }
2795 /**
2796 * Gets a specific build definition template.
2797 *
2798 * @param {string} project - Project ID or project name
2799 * @param {string} templateId - The ID of the requested template.
2800 */
2801 getTemplate(project, templateId) {
2802 return __awaiter(this, void 0, void 0, function* () {
2803 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2804 let routeValues = {
2805 project: project,
2806 templateId: templateId
2807 };
2808 try {
2809 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "e884571e-7f92-4d6a-9274-3f5649900835", routeValues);
2810 let url = verData.requestUrl;
2811 let options = this.createRequestOptions('application/json', verData.apiVersion);
2812 let res;
2813 res = yield this.rest.get(url, options);
2814 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildDefinitionTemplate, false);
2815 resolve(ret);
2816 }
2817 catch (err) {
2818 reject(err);
2819 }
2820 }));
2821 });
2822 }
2823 /**
2824 * Gets all definition templates.
2825 *
2826 * @param {string} project - Project ID or project name
2827 */
2828 getTemplates(project) {
2829 return __awaiter(this, void 0, void 0, function* () {
2830 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2831 let routeValues = {
2832 project: project
2833 };
2834 try {
2835 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "e884571e-7f92-4d6a-9274-3f5649900835", routeValues);
2836 let url = verData.requestUrl;
2837 let options = this.createRequestOptions('application/json', verData.apiVersion);
2838 let res;
2839 res = yield this.rest.get(url, options);
2840 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildDefinitionTemplate, true);
2841 resolve(ret);
2842 }
2843 catch (err) {
2844 reject(err);
2845 }
2846 }));
2847 });
2848 }
2849 /**
2850 * Updates an existing build definition template.
2851 *
2852 * @param {BuildInterfaces.BuildDefinitionTemplate} template - The new version of the template.
2853 * @param {string} project - Project ID or project name
2854 * @param {string} templateId - The ID of the template.
2855 */
2856 saveTemplate(template, project, templateId) {
2857 return __awaiter(this, void 0, void 0, function* () {
2858 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2859 let routeValues = {
2860 project: project,
2861 templateId: templateId
2862 };
2863 try {
2864 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "e884571e-7f92-4d6a-9274-3f5649900835", routeValues);
2865 let url = verData.requestUrl;
2866 let options = this.createRequestOptions('application/json', verData.apiVersion);
2867 let res;
2868 res = yield this.rest.replace(url, template, options);
2869 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildDefinitionTemplate, false);
2870 resolve(ret);
2871 }
2872 catch (err) {
2873 reject(err);
2874 }
2875 }));
2876 });
2877 }
2878 /**
2879 * Gets details for a build
2880 *
2881 * @param {string} project - Project ID or project name
2882 * @param {number} buildId
2883 * @param {string} timelineId
2884 * @param {number} changeId
2885 * @param {string} planId
2886 */
2887 getBuildTimeline(project, buildId, timelineId, changeId, planId) {
2888 return __awaiter(this, void 0, void 0, function* () {
2889 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2890 let routeValues = {
2891 project: project,
2892 buildId: buildId,
2893 timelineId: timelineId
2894 };
2895 let queryValues = {
2896 changeId: changeId,
2897 planId: planId,
2898 };
2899 try {
2900 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "8baac422-4c6e-4de5-8532-db96d92acffa", routeValues, queryValues);
2901 let url = verData.requestUrl;
2902 let options = this.createRequestOptions('application/json', verData.apiVersion);
2903 let res;
2904 res = yield this.rest.get(url, options);
2905 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Timeline, false);
2906 resolve(ret);
2907 }
2908 catch (err) {
2909 reject(err);
2910 }
2911 }));
2912 });
2913 }
2914 /**
2915 * Recreates the webhooks for the specified triggers in the given source code repository.
2916 *
2917 * @param {BuildInterfaces.DefinitionTriggerType[]} triggerTypes - The types of triggers to restore webhooks for.
2918 * @param {string} project - Project ID or project name
2919 * @param {string} providerName - The name of the source provider.
2920 * @param {string} serviceEndpointId - If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit.
2921 * @param {string} repository - If specified, the vendor-specific identifier or the name of the repository to get webhooks. Can only be omitted for providers that do not support multiple repositories.
2922 */
2923 restoreWebhooks(triggerTypes, project, providerName, serviceEndpointId, repository) {
2924 return __awaiter(this, void 0, void 0, function* () {
2925 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2926 let routeValues = {
2927 project: project,
2928 providerName: providerName
2929 };
2930 let queryValues = {
2931 serviceEndpointId: serviceEndpointId,
2932 repository: repository,
2933 };
2934 try {
2935 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "793bceb8-9736-4030-bd2f-fb3ce6d6b478", routeValues, queryValues);
2936 let url = verData.requestUrl;
2937 let options = this.createRequestOptions('application/json', verData.apiVersion);
2938 let res;
2939 res = yield this.rest.create(url, triggerTypes, options);
2940 let ret = this.formatResponse(res.result, null, false);
2941 resolve(ret);
2942 }
2943 catch (err) {
2944 reject(err);
2945 }
2946 }));
2947 });
2948 }
2949 /**
2950 * Gets a list of webhooks installed in the given source code repository.
2951 *
2952 * @param {string} project - Project ID or project name
2953 * @param {string} providerName - The name of the source provider.
2954 * @param {string} serviceEndpointId - If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit.
2955 * @param {string} repository - If specified, the vendor-specific identifier or the name of the repository to get webhooks. Can only be omitted for providers that do not support multiple repositories.
2956 */
2957 listWebhooks(project, providerName, serviceEndpointId, repository) {
2958 return __awaiter(this, void 0, void 0, function* () {
2959 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2960 let routeValues = {
2961 project: project,
2962 providerName: providerName
2963 };
2964 let queryValues = {
2965 serviceEndpointId: serviceEndpointId,
2966 repository: repository,
2967 };
2968 try {
2969 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "8f20ff82-9498-4812-9f6e-9c01bdc50e99", routeValues, queryValues);
2970 let url = verData.requestUrl;
2971 let options = this.createRequestOptions('application/json', verData.apiVersion);
2972 let res;
2973 res = yield this.rest.get(url, options);
2974 let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.RepositoryWebhook, true);
2975 resolve(ret);
2976 }
2977 catch (err) {
2978 reject(err);
2979 }
2980 }));
2981 });
2982 }
2983 /**
2984 * Gets the work items associated with a build. Only work items in the same project are returned.
2985 *
2986 * @param {string} project - Project ID or project name
2987 * @param {number} buildId - The ID of the build.
2988 * @param {number} top - The maximum number of work items to return.
2989 */
2990 getBuildWorkItemsRefs(project, buildId, top) {
2991 return __awaiter(this, void 0, void 0, function* () {
2992 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2993 let routeValues = {
2994 project: project,
2995 buildId: buildId
2996 };
2997 let queryValues = {
2998 '$top': top,
2999 };
3000 try {
3001 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "5a21f5d2-5642-47e4-a0bd-1356e6731bee", routeValues, queryValues);
3002 let url = verData.requestUrl;
3003 let options = this.createRequestOptions('application/json', verData.apiVersion);
3004 let res;
3005 res = yield this.rest.get(url, options);
3006 let ret = this.formatResponse(res.result, null, true);
3007 resolve(ret);
3008 }
3009 catch (err) {
3010 reject(err);
3011 }
3012 }));
3013 });
3014 }
3015 /**
3016 * Gets the work items associated with a build, filtered to specific commits.
3017 *
3018 * @param {string[]} commitIds - A comma-delimited list of commit IDs.
3019 * @param {string} project - Project ID or project name
3020 * @param {number} buildId - The ID of the build.
3021 * @param {number} top - The maximum number of work items to return, or the number of commits to consider if no commit IDs are specified.
3022 */
3023 getBuildWorkItemsRefsFromCommits(commitIds, project, buildId, top) {
3024 return __awaiter(this, void 0, void 0, function* () {
3025 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3026 let routeValues = {
3027 project: project,
3028 buildId: buildId
3029 };
3030 let queryValues = {
3031 '$top': top,
3032 };
3033 try {
3034 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "5a21f5d2-5642-47e4-a0bd-1356e6731bee", routeValues, queryValues);
3035 let url = verData.requestUrl;
3036 let options = this.createRequestOptions('application/json', verData.apiVersion);
3037 let res;
3038 res = yield this.rest.create(url, commitIds, options);
3039 let ret = this.formatResponse(res.result, null, true);
3040 resolve(ret);
3041 }
3042 catch (err) {
3043 reject(err);
3044 }
3045 }));
3046 });
3047 }
3048 /**
3049 * Gets all the work items between two builds.
3050 *
3051 * @param {string} project - Project ID or project name
3052 * @param {number} fromBuildId - The ID of the first build.
3053 * @param {number} toBuildId - The ID of the last build.
3054 * @param {number} top - The maximum number of work items to return.
3055 */
3056 getWorkItemsBetweenBuilds(project, fromBuildId, toBuildId, top) {
3057 return __awaiter(this, void 0, void 0, function* () {
3058 if (fromBuildId == null) {
3059 throw new TypeError('fromBuildId can not be null or undefined');
3060 }
3061 if (toBuildId == null) {
3062 throw new TypeError('toBuildId can not be null or undefined');
3063 }
3064 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3065 let routeValues = {
3066 project: project
3067 };
3068 let queryValues = {
3069 fromBuildId: fromBuildId,
3070 toBuildId: toBuildId,
3071 '$top': top,
3072 };
3073 try {
3074 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "52ba8915-5518-42e3-a4bb-b0182d159e2d", routeValues, queryValues);
3075 let url = verData.requestUrl;
3076 let options = this.createRequestOptions('application/json', verData.apiVersion);
3077 let res;
3078 res = yield this.rest.get(url, options);
3079 let ret = this.formatResponse(res.result, null, true);
3080 resolve(ret);
3081 }
3082 catch (err) {
3083 reject(err);
3084 }
3085 }));
3086 });
3087 }
3088 /**
3089 * Converts a definition to YAML, optionally at a specific revision.
3090 *
3091 * @param {string} project - Project ID or project name
3092 * @param {number} definitionId - The ID of the definition.
3093 * @param {number} revision - The revision number to retrieve. If this is not specified, the latest version will be returned.
3094 * @param {Date} minMetricsTime - If specified, indicates the date from which metrics should be included.
3095 * @param {string[]} propertyFilters - A comma-delimited list of properties to include in the results.
3096 * @param {boolean} includeLatestBuilds
3097 */
3098 getDefinitionYaml(project, definitionId, revision, minMetricsTime, propertyFilters, includeLatestBuilds) {
3099 return __awaiter(this, void 0, void 0, function* () {
3100 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3101 let routeValues = {
3102 project: project,
3103 definitionId: definitionId
3104 };
3105 let queryValues = {
3106 revision: revision,
3107 minMetricsTime: minMetricsTime,
3108 propertyFilters: propertyFilters && propertyFilters.join(","),
3109 includeLatestBuilds: includeLatestBuilds,
3110 };
3111 try {
3112 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "7c3df3a1-7e51-4150-8cf7-540347f8697f", routeValues, queryValues);
3113 let url = verData.requestUrl;
3114 let options = this.createRequestOptions('application/json', verData.apiVersion);
3115 let res;
3116 res = yield this.rest.get(url, options);
3117 let ret = this.formatResponse(res.result, null, false);
3118 resolve(ret);
3119 }
3120 catch (err) {
3121 reject(err);
3122 }
3123 }));
3124 });
3125 }
3126}
3127exports.BuildApi = BuildApi;
3128BuildApi.RESOURCE_AREA_ID = "965220d5-5bb9-42cf-8d67-9b146df2a5a4";