UNPKG

133 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.ReleaseApi = void 0;
22const basem = require("./ClientApiBases");
23const ReleaseInterfaces = require("./interfaces/ReleaseInterfaces");
24class ReleaseApi extends basem.ClientApiBase {
25 constructor(baseUrl, handlers, options) {
26 super(baseUrl, handlers, 'node-Release-api', options);
27 }
28 /**
29 * Returns the artifact details that automation agent requires
30 *
31 * @param {string} project - Project ID or project name
32 * @param {number} releaseId
33 */
34 getAgentArtifactDefinitions(project, releaseId) {
35 return __awaiter(this, void 0, void 0, function* () {
36 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
37 let routeValues = {
38 project: project,
39 releaseId: releaseId
40 };
41 try {
42 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "f2571c27-bf50-4938-b396-32d109ddef26", routeValues);
43 let url = verData.requestUrl;
44 let options = this.createRequestOptions('application/json', verData.apiVersion);
45 let res;
46 res = yield this.rest.get(url, options);
47 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.AgentArtifactDefinition, true);
48 resolve(ret);
49 }
50 catch (err) {
51 reject(err);
52 }
53 }));
54 });
55 }
56 /**
57 * Get a list of approvals
58 *
59 * @param {string} project - Project ID or project name
60 * @param {string} assignedToFilter - Approvals assigned to this user.
61 * @param {ReleaseInterfaces.ApprovalStatus} statusFilter - Approvals with this status. Default is 'pending'.
62 * @param {number[]} releaseIdsFilter - Approvals for release id(s) mentioned in the filter. Multiple releases can be mentioned by separating them with ',' e.g. releaseIdsFilter=1,2,3,4.
63 * @param {ReleaseInterfaces.ApprovalType} typeFilter - Approval with this type.
64 * @param {number} top - Number of approvals to get. Default is 50.
65 * @param {number} continuationToken - Gets the approvals after the continuation token provided.
66 * @param {ReleaseInterfaces.ReleaseQueryOrder} queryOrder - Gets the results in the defined order of created approvals. Default is 'descending'.
67 * @param {boolean} includeMyGroupApprovals - 'true' to include my group approvals. Default is 'false'.
68 */
69 getApprovals(project, assignedToFilter, statusFilter, releaseIdsFilter, typeFilter, top, continuationToken, queryOrder, includeMyGroupApprovals) {
70 return __awaiter(this, void 0, void 0, function* () {
71 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
72 let routeValues = {
73 project: project
74 };
75 let queryValues = {
76 assignedToFilter: assignedToFilter,
77 statusFilter: statusFilter,
78 releaseIdsFilter: releaseIdsFilter && releaseIdsFilter.join(","),
79 typeFilter: typeFilter,
80 top: top,
81 continuationToken: continuationToken,
82 queryOrder: queryOrder,
83 includeMyGroupApprovals: includeMyGroupApprovals,
84 };
85 try {
86 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Release", "b47c6458-e73b-47cb-a770-4df1e8813a91", routeValues, queryValues);
87 let url = verData.requestUrl;
88 let options = this.createRequestOptions('application/json', verData.apiVersion);
89 let res;
90 res = yield this.rest.get(url, options);
91 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseApproval, true);
92 resolve(ret);
93 }
94 catch (err) {
95 reject(err);
96 }
97 }));
98 });
99 }
100 /**
101 * Get approval history.
102 *
103 * @param {string} project - Project ID or project name
104 * @param {number} approvalStepId - Id of the approval.
105 */
106 getApprovalHistory(project, approvalStepId) {
107 return __awaiter(this, void 0, void 0, function* () {
108 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
109 let routeValues = {
110 project: project,
111 approvalStepId: approvalStepId
112 };
113 try {
114 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Release", "250c7158-852e-4130-a00f-a0cce9b72d05", routeValues);
115 let url = verData.requestUrl;
116 let options = this.createRequestOptions('application/json', verData.apiVersion);
117 let res;
118 res = yield this.rest.get(url, options);
119 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseApproval, false);
120 resolve(ret);
121 }
122 catch (err) {
123 reject(err);
124 }
125 }));
126 });
127 }
128 /**
129 * Get an approval.
130 *
131 * @param {string} project - Project ID or project name
132 * @param {number} approvalId - Id of the approval.
133 * @param {boolean} includeHistory - 'true' to include history of the approval. Default is 'false'.
134 */
135 getApproval(project, approvalId, includeHistory) {
136 return __awaiter(this, void 0, void 0, function* () {
137 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
138 let routeValues = {
139 project: project,
140 approvalId: approvalId
141 };
142 let queryValues = {
143 includeHistory: includeHistory,
144 };
145 try {
146 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Release", "9328e074-59fb-465a-89d9-b09c82ee5109", routeValues, queryValues);
147 let url = verData.requestUrl;
148 let options = this.createRequestOptions('application/json', verData.apiVersion);
149 let res;
150 res = yield this.rest.get(url, options);
151 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseApproval, false);
152 resolve(ret);
153 }
154 catch (err) {
155 reject(err);
156 }
157 }));
158 });
159 }
160 /**
161 * Update status of an approval
162 *
163 * @param {ReleaseInterfaces.ReleaseApproval} approval - ReleaseApproval object having status, approver and comments.
164 * @param {string} project - Project ID or project name
165 * @param {number} approvalId - Id of the approval.
166 */
167 updateReleaseApproval(approval, project, approvalId) {
168 return __awaiter(this, void 0, void 0, function* () {
169 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
170 let routeValues = {
171 project: project,
172 approvalId: approvalId
173 };
174 try {
175 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Release", "9328e074-59fb-465a-89d9-b09c82ee5109", routeValues);
176 let url = verData.requestUrl;
177 let options = this.createRequestOptions('application/json', verData.apiVersion);
178 let res;
179 res = yield this.rest.update(url, approval, options);
180 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseApproval, false);
181 resolve(ret);
182 }
183 catch (err) {
184 reject(err);
185 }
186 }));
187 });
188 }
189 /**
190 * @param {ReleaseInterfaces.ReleaseApproval[]} approvals
191 * @param {string} project - Project ID or project name
192 */
193 updateReleaseApprovals(approvals, project) {
194 return __awaiter(this, void 0, void 0, function* () {
195 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
196 let routeValues = {
197 project: project
198 };
199 try {
200 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Release", "c957584a-82aa-4131-8222-6d47f78bfa7a", routeValues);
201 let url = verData.requestUrl;
202 let options = this.createRequestOptions('application/json', verData.apiVersion);
203 let res;
204 res = yield this.rest.update(url, approvals, options);
205 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseApproval, true);
206 resolve(ret);
207 }
208 catch (err) {
209 reject(err);
210 }
211 }));
212 });
213 }
214 /**
215 * Get a task attachment.
216 *
217 * @param {string} project - Project ID or project name
218 * @param {number} releaseId - Id of the release.
219 * @param {number} environmentId - Id of the release environment.
220 * @param {number} attemptId - Attempt number of deployment.
221 * @param {string} timelineId - Timeline Id of the task.
222 * @param {string} recordId - Record Id of attachment.
223 * @param {string} type - Type of the attachment.
224 * @param {string} name - Name of the attachment.
225 */
226 getTaskAttachmentContent(project, releaseId, environmentId, attemptId, timelineId, recordId, type, name) {
227 return __awaiter(this, void 0, void 0, function* () {
228 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
229 let routeValues = {
230 project: project,
231 releaseId: releaseId,
232 environmentId: environmentId,
233 attemptId: attemptId,
234 timelineId: timelineId,
235 recordId: recordId,
236 type: type,
237 name: name
238 };
239 try {
240 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "c4071f6d-3697-46ca-858e-8b10ff09e52f", routeValues);
241 let url = verData.requestUrl;
242 let apiVersion = verData.apiVersion;
243 let accept = this.createAcceptHeader("application/octet-stream", apiVersion);
244 resolve((yield this.http.get(url, { "Accept": accept })).message);
245 }
246 catch (err) {
247 reject(err);
248 }
249 }));
250 });
251 }
252 /**
253 * Get a release task attachment.
254 *
255 * @param {string} project - Project ID or project name
256 * @param {number} releaseId - Id of the release.
257 * @param {number} environmentId - Id of the release environment.
258 * @param {number} attemptId - Attempt number of deployment.
259 * @param {string} planId - Plan Id of the deploy phase.
260 * @param {string} timelineId - Timeline Id of the task.
261 * @param {string} recordId - Record Id of attachment.
262 * @param {string} type - Type of the attachment.
263 * @param {string} name - Name of the attachment.
264 */
265 getReleaseTaskAttachmentContent(project, releaseId, environmentId, attemptId, planId, timelineId, recordId, type, name) {
266 return __awaiter(this, void 0, void 0, function* () {
267 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
268 let routeValues = {
269 project: project,
270 releaseId: releaseId,
271 environmentId: environmentId,
272 attemptId: attemptId,
273 planId: planId,
274 timelineId: timelineId,
275 recordId: recordId,
276 type: type,
277 name: name
278 };
279 try {
280 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "60b86efb-7b8c-4853-8f9f-aa142b77b479", routeValues);
281 let url = verData.requestUrl;
282 let apiVersion = verData.apiVersion;
283 let accept = this.createAcceptHeader("application/octet-stream", apiVersion);
284 resolve((yield this.http.get(url, { "Accept": accept })).message);
285 }
286 catch (err) {
287 reject(err);
288 }
289 }));
290 });
291 }
292 /**
293 * Get the task attachments.
294 *
295 * @param {string} project - Project ID or project name
296 * @param {number} releaseId - Id of the release.
297 * @param {number} environmentId - Id of the release environment.
298 * @param {number} attemptId - Attempt number of deployment.
299 * @param {string} timelineId - Timeline Id of the task.
300 * @param {string} type - Type of the attachment.
301 */
302 getTaskAttachments(project, releaseId, environmentId, attemptId, timelineId, type) {
303 return __awaiter(this, void 0, void 0, function* () {
304 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
305 let routeValues = {
306 project: project,
307 releaseId: releaseId,
308 environmentId: environmentId,
309 attemptId: attemptId,
310 timelineId: timelineId,
311 type: type
312 };
313 try {
314 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "214111ee-2415-4df2-8ed2-74417f7d61f9", routeValues);
315 let url = verData.requestUrl;
316 let options = this.createRequestOptions('application/json', verData.apiVersion);
317 let res;
318 res = yield this.rest.get(url, options);
319 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseTaskAttachment, true);
320 resolve(ret);
321 }
322 catch (err) {
323 reject(err);
324 }
325 }));
326 });
327 }
328 /**
329 * Get the release task attachments.
330 *
331 * @param {string} project - Project ID or project name
332 * @param {number} releaseId - Id of the release.
333 * @param {number} environmentId - Id of the release environment.
334 * @param {number} attemptId - Attempt number of deployment.
335 * @param {string} planId - Plan Id of the deploy phase.
336 * @param {string} type - Type of the attachment.
337 */
338 getReleaseTaskAttachments(project, releaseId, environmentId, attemptId, planId, type) {
339 return __awaiter(this, void 0, void 0, function* () {
340 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
341 let routeValues = {
342 project: project,
343 releaseId: releaseId,
344 environmentId: environmentId,
345 attemptId: attemptId,
346 planId: planId,
347 type: type
348 };
349 try {
350 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "a4d06688-0dfa-4895-82a5-f43ec9452306", routeValues);
351 let url = verData.requestUrl;
352 let options = this.createRequestOptions('application/json', verData.apiVersion);
353 let res;
354 res = yield this.rest.get(url, options);
355 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseTaskAttachment, true);
356 resolve(ret);
357 }
358 catch (err) {
359 reject(err);
360 }
361 }));
362 });
363 }
364 /**
365 * @param {string} artifactType
366 * @param {string} sourceId
367 * @param {string} artifactVersionId
368 * @param {string} project - Project ID or project name
369 */
370 getAutoTriggerIssues(artifactType, sourceId, artifactVersionId, project) {
371 return __awaiter(this, void 0, void 0, function* () {
372 if (artifactType == null) {
373 throw new TypeError('artifactType can not be null or undefined');
374 }
375 if (sourceId == null) {
376 throw new TypeError('sourceId can not be null or undefined');
377 }
378 if (artifactVersionId == null) {
379 throw new TypeError('artifactVersionId can not be null or undefined');
380 }
381 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
382 let routeValues = {
383 project: project
384 };
385 let queryValues = {
386 artifactType: artifactType,
387 sourceId: sourceId,
388 artifactVersionId: artifactVersionId,
389 };
390 try {
391 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "c1a68497-69da-40fb-9423-cab19cfeeca9", routeValues, queryValues);
392 let url = verData.requestUrl;
393 let options = this.createRequestOptions('application/json', verData.apiVersion);
394 let res;
395 res = yield this.rest.get(url, options);
396 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.AutoTriggerIssue, true);
397 resolve(ret);
398 }
399 catch (err) {
400 reject(err);
401 }
402 }));
403 });
404 }
405 /**
406 * Gets a badge that indicates the status of the most recent deployment for an environment.
407 *
408 * @param {string} projectId - The ID of the Project.
409 * @param {number} releaseDefinitionId - The ID of the Release Definition.
410 * @param {number} environmentId - The ID of the Environment.
411 * @param {string} branchName - The name of the branch.
412 */
413 getDeploymentBadge(projectId, releaseDefinitionId, environmentId, branchName) {
414 return __awaiter(this, void 0, void 0, function* () {
415 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
416 let routeValues = {
417 projectId: projectId,
418 releaseDefinitionId: releaseDefinitionId,
419 environmentId: environmentId,
420 branchName: branchName
421 };
422 try {
423 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "1a60a35d-b8c9-45fb-bf67-da0829711147", routeValues);
424 let url = verData.requestUrl;
425 let options = this.createRequestOptions('application/json', verData.apiVersion);
426 let res;
427 res = yield this.rest.get(url, options);
428 let ret = this.formatResponse(res.result, null, false);
429 resolve(ret);
430 }
431 catch (err) {
432 reject(err);
433 }
434 }));
435 });
436 }
437 /**
438 * @param {string} project - Project ID or project name
439 * @param {number} releaseId
440 * @param {number} baseReleaseId
441 * @param {number} top
442 * @param {string} artifactAlias
443 */
444 getReleaseChanges(project, releaseId, baseReleaseId, top, artifactAlias) {
445 return __awaiter(this, void 0, void 0, function* () {
446 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
447 let routeValues = {
448 project: project,
449 releaseId: releaseId
450 };
451 let queryValues = {
452 baseReleaseId: baseReleaseId,
453 '$top': top,
454 artifactAlias: artifactAlias,
455 };
456 try {
457 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "8dcf9fe9-ca37-4113-8ee1-37928e98407c", routeValues, queryValues);
458 let url = verData.requestUrl;
459 let options = this.createRequestOptions('application/json', verData.apiVersion);
460 let res;
461 res = yield this.rest.get(url, options);
462 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.Change, true);
463 resolve(ret);
464 }
465 catch (err) {
466 reject(err);
467 }
468 }));
469 });
470 }
471 /**
472 * @param {string} project - Project ID or project name
473 * @param {string} taskGroupId
474 * @param {string[]} propertyFilters
475 */
476 getDefinitionEnvironments(project, taskGroupId, propertyFilters) {
477 return __awaiter(this, void 0, void 0, function* () {
478 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
479 let routeValues = {
480 project: project
481 };
482 let queryValues = {
483 taskGroupId: taskGroupId,
484 propertyFilters: propertyFilters && propertyFilters.join(","),
485 };
486 try {
487 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "12b5d21a-f54c-430e-a8c1-7515d196890e", routeValues, queryValues);
488 let url = verData.requestUrl;
489 let options = this.createRequestOptions('application/json', verData.apiVersion);
490 let res;
491 res = yield this.rest.get(url, options);
492 let ret = this.formatResponse(res.result, null, true);
493 resolve(ret);
494 }
495 catch (err) {
496 reject(err);
497 }
498 }));
499 });
500 }
501 /**
502 * Create a release definition
503 *
504 * @param {ReleaseInterfaces.ReleaseDefinition} releaseDefinition - release definition object to create.
505 * @param {string} project - Project ID or project name
506 */
507 createReleaseDefinition(releaseDefinition, project) {
508 return __awaiter(this, void 0, void 0, function* () {
509 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
510 let routeValues = {
511 project: project
512 };
513 try {
514 let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Release", "d8f96f24-8ea7-4cb6-baab-2df8fc515665", routeValues);
515 let url = verData.requestUrl;
516 let options = this.createRequestOptions('application/json', verData.apiVersion);
517 let res;
518 res = yield this.rest.create(url, releaseDefinition, options);
519 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseDefinition, false);
520 resolve(ret);
521 }
522 catch (err) {
523 reject(err);
524 }
525 }));
526 });
527 }
528 /**
529 * Delete a release definition.
530 *
531 * @param {string} project - Project ID or project name
532 * @param {number} definitionId - Id of the release definition.
533 * @param {string} comment - Comment for deleting a release definition.
534 * @param {boolean} forceDelete - 'true' to automatically cancel any in-progress release deployments and proceed with release definition deletion . Default is 'false'.
535 */
536 deleteReleaseDefinition(project, definitionId, comment, forceDelete) {
537 return __awaiter(this, void 0, void 0, function* () {
538 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
539 let routeValues = {
540 project: project,
541 definitionId: definitionId
542 };
543 let queryValues = {
544 comment: comment,
545 forceDelete: forceDelete,
546 };
547 try {
548 let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Release", "d8f96f24-8ea7-4cb6-baab-2df8fc515665", routeValues, queryValues);
549 let url = verData.requestUrl;
550 let options = this.createRequestOptions('application/json', verData.apiVersion);
551 let res;
552 res = yield this.rest.del(url, options);
553 let ret = this.formatResponse(res.result, null, false);
554 resolve(ret);
555 }
556 catch (err) {
557 reject(err);
558 }
559 }));
560 });
561 }
562 /**
563 * Get a release definition.
564 *
565 * @param {string} project - Project ID or project name
566 * @param {number} definitionId - Id of the release definition.
567 * @param {string[]} propertyFilters - A comma-delimited list of extended properties to be retrieved. If set, the returned Release Definition will contain values for the specified property Ids (if they exist). If not set, properties will not be included.
568 */
569 getReleaseDefinition(project, definitionId, propertyFilters) {
570 return __awaiter(this, void 0, void 0, function* () {
571 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
572 let routeValues = {
573 project: project,
574 definitionId: definitionId
575 };
576 let queryValues = {
577 propertyFilters: propertyFilters && propertyFilters.join(","),
578 };
579 try {
580 let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Release", "d8f96f24-8ea7-4cb6-baab-2df8fc515665", routeValues, queryValues);
581 let url = verData.requestUrl;
582 let options = this.createRequestOptions('application/json', verData.apiVersion);
583 let res;
584 res = yield this.rest.get(url, options);
585 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseDefinition, false);
586 resolve(ret);
587 }
588 catch (err) {
589 reject(err);
590 }
591 }));
592 });
593 }
594 /**
595 * Get release definition of a given revision.
596 *
597 * @param {string} project - Project ID or project name
598 * @param {number} definitionId - Id of the release definition.
599 * @param {number} revision - Revision number of the release definition.
600 */
601 getReleaseDefinitionRevision(project, definitionId, revision) {
602 return __awaiter(this, void 0, void 0, function* () {
603 if (revision == null) {
604 throw new TypeError('revision can not be null or undefined');
605 }
606 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
607 let routeValues = {
608 project: project,
609 definitionId: definitionId
610 };
611 let queryValues = {
612 revision: revision,
613 };
614 try {
615 let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Release", "d8f96f24-8ea7-4cb6-baab-2df8fc515665", routeValues, queryValues);
616 let url = verData.requestUrl;
617 let apiVersion = verData.apiVersion;
618 let accept = this.createAcceptHeader("text/plain", apiVersion);
619 resolve((yield this.http.get(url, { "Accept": accept })).message);
620 }
621 catch (err) {
622 reject(err);
623 }
624 }));
625 });
626 }
627 /**
628 * Get a list of release definitions.
629 *
630 * @param {string} project - Project ID or project name
631 * @param {string} searchText - Get release definitions with names containing searchText.
632 * @param {ReleaseInterfaces.ReleaseDefinitionExpands} expand - The properties that should be expanded in the list of Release definitions.
633 * @param {string} artifactType - Release definitions with given artifactType will be returned. Values can be Build, Jenkins, GitHub, Nuget, Team Build (external), ExternalTFSBuild, Git, TFVC, ExternalTfsXamlBuild.
634 * @param {string} artifactSourceId - Release definitions with given artifactSourceId will be returned. e.g. For build it would be {projectGuid}:{BuildDefinitionId}, for Jenkins it would be {JenkinsConnectionId}:{JenkinsDefinitionId}, for TfsOnPrem it would be {TfsOnPremConnectionId}:{ProjectName}:{TfsOnPremDefinitionId}. For third-party artifacts e.g. TeamCity, BitBucket you may refer 'uniqueSourceIdentifier' inside vss-extension.json at https://github.com/Microsoft/vsts-rm-extensions/blob/master/Extensions.
635 * @param {number} top - Number of release definitions to get.
636 * @param {string} continuationToken - Gets the release definitions after the continuation token provided.
637 * @param {ReleaseInterfaces.ReleaseDefinitionQueryOrder} queryOrder - Gets the results in the defined order. Default is 'IdAscending'.
638 * @param {string} path - Gets the release definitions under the specified path.
639 * @param {boolean} isExactNameMatch - 'true'to gets the release definitions with exact match as specified in searchText. Default is 'false'.
640 * @param {string[]} tagFilter - A comma-delimited list of tags. Only release definitions with these tags will be returned.
641 * @param {string[]} propertyFilters - A comma-delimited list of extended properties to be retrieved. If set, the returned Release Definitions will contain values for the specified property Ids (if they exist). If not set, properties will not be included. Note that this will not filter out any Release Definition from results irrespective of whether it has property set or not.
642 * @param {string[]} definitionIdFilter - A comma-delimited list of release definitions to retrieve.
643 * @param {boolean} isDeleted - 'true' to get release definitions that has been deleted. Default is 'false'
644 * @param {boolean} searchTextContainsFolderName - 'true' to get the release definitions under the folder with name as specified in searchText. Default is 'false'.
645 */
646 getReleaseDefinitions(project, searchText, expand, artifactType, artifactSourceId, top, continuationToken, queryOrder, path, isExactNameMatch, tagFilter, propertyFilters, definitionIdFilter, isDeleted, searchTextContainsFolderName) {
647 return __awaiter(this, void 0, void 0, function* () {
648 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
649 let routeValues = {
650 project: project
651 };
652 let queryValues = {
653 searchText: searchText,
654 '$expand': expand,
655 artifactType: artifactType,
656 artifactSourceId: artifactSourceId,
657 '$top': top,
658 continuationToken: continuationToken,
659 queryOrder: queryOrder,
660 path: path,
661 isExactNameMatch: isExactNameMatch,
662 tagFilter: tagFilter && tagFilter.join(","),
663 propertyFilters: propertyFilters && propertyFilters.join(","),
664 definitionIdFilter: definitionIdFilter && definitionIdFilter.join(","),
665 isDeleted: isDeleted,
666 searchTextContainsFolderName: searchTextContainsFolderName,
667 };
668 try {
669 let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Release", "d8f96f24-8ea7-4cb6-baab-2df8fc515665", routeValues, queryValues);
670 let url = verData.requestUrl;
671 let options = this.createRequestOptions('application/json', verData.apiVersion);
672 let res;
673 res = yield this.rest.get(url, options);
674 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseDefinition, true);
675 resolve(ret);
676 }
677 catch (err) {
678 reject(err);
679 }
680 }));
681 });
682 }
683 /**
684 * Undelete a release definition.
685 *
686 * @param {ReleaseInterfaces.ReleaseDefinitionUndeleteParameter} releaseDefinitionUndeleteParameter - Object for undelete release definition.
687 * @param {string} project - Project ID or project name
688 * @param {number} definitionId - Id of the release definition to be undeleted
689 */
690 undeleteReleaseDefinition(releaseDefinitionUndeleteParameter, project, definitionId) {
691 return __awaiter(this, void 0, void 0, function* () {
692 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
693 let routeValues = {
694 project: project,
695 definitionId: definitionId
696 };
697 try {
698 let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Release", "d8f96f24-8ea7-4cb6-baab-2df8fc515665", routeValues);
699 let url = verData.requestUrl;
700 let options = this.createRequestOptions('application/json', verData.apiVersion);
701 let res;
702 res = yield this.rest.update(url, releaseDefinitionUndeleteParameter, options);
703 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseDefinition, false);
704 resolve(ret);
705 }
706 catch (err) {
707 reject(err);
708 }
709 }));
710 });
711 }
712 /**
713 * Update a release definition.
714 *
715 * @param {ReleaseInterfaces.ReleaseDefinition} releaseDefinition - Release definition object to update.
716 * @param {string} project - Project ID or project name
717 */
718 updateReleaseDefinition(releaseDefinition, project) {
719 return __awaiter(this, void 0, void 0, function* () {
720 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
721 let routeValues = {
722 project: project
723 };
724 try {
725 let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Release", "d8f96f24-8ea7-4cb6-baab-2df8fc515665", routeValues);
726 let url = verData.requestUrl;
727 let options = this.createRequestOptions('application/json', verData.apiVersion);
728 let res;
729 res = yield this.rest.replace(url, releaseDefinition, options);
730 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseDefinition, false);
731 resolve(ret);
732 }
733 catch (err) {
734 reject(err);
735 }
736 }));
737 });
738 }
739 /**
740 * Get a list of deployments
741 *
742 * @param {string} project - Project ID or project name
743 * @param {number} definitionId - List the deployments for a given definition id.
744 * @param {number} definitionEnvironmentId - List the deployments for a given definition environment id.
745 * @param {string} createdBy - List the deployments for which deployments are created as identity specified.
746 * @param {Date} minModifiedTime - List the deployments with LastModified time >= minModifiedTime.
747 * @param {Date} maxModifiedTime - List the deployments with LastModified time <= maxModifiedTime.
748 * @param {ReleaseInterfaces.DeploymentStatus} deploymentStatus - List the deployments with given deployment status. Defult is 'All'.
749 * @param {ReleaseInterfaces.DeploymentOperationStatus} operationStatus - List the deployments with given operation status. Default is 'All'.
750 * @param {boolean} latestAttemptsOnly - 'true' to include deployments with latest attempt only. Default is 'false'.
751 * @param {ReleaseInterfaces.ReleaseQueryOrder} queryOrder - List the deployments with given query order. Default is 'Descending'.
752 * @param {number} top - List the deployments with given top. Default top is '50' and Max top is '100'.
753 * @param {number} continuationToken - List the deployments with deployment id >= continuationToken.
754 * @param {string} createdFor - List the deployments for which deployments are requested as identity specified.
755 * @param {Date} minStartedTime - List the deployments with StartedOn time >= minStartedTime.
756 * @param {Date} maxStartedTime - List the deployments with StartedOn time <= maxStartedTime.
757 * @param {string} sourceBranch - List the deployments that are deployed from given branch name.
758 */
759 getDeployments(project, definitionId, definitionEnvironmentId, createdBy, minModifiedTime, maxModifiedTime, deploymentStatus, operationStatus, latestAttemptsOnly, queryOrder, top, continuationToken, createdFor, minStartedTime, maxStartedTime, sourceBranch) {
760 return __awaiter(this, void 0, void 0, function* () {
761 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
762 let routeValues = {
763 project: project
764 };
765 let queryValues = {
766 definitionId: definitionId,
767 definitionEnvironmentId: definitionEnvironmentId,
768 createdBy: createdBy,
769 minModifiedTime: minModifiedTime,
770 maxModifiedTime: maxModifiedTime,
771 deploymentStatus: deploymentStatus,
772 operationStatus: operationStatus,
773 latestAttemptsOnly: latestAttemptsOnly,
774 queryOrder: queryOrder,
775 '$top': top,
776 continuationToken: continuationToken,
777 createdFor: createdFor,
778 minStartedTime: minStartedTime,
779 maxStartedTime: maxStartedTime,
780 sourceBranch: sourceBranch,
781 };
782 try {
783 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Release", "b005ef73-cddc-448e-9ba2-5193bf36b19f", routeValues, queryValues);
784 let url = verData.requestUrl;
785 let options = this.createRequestOptions('application/json', verData.apiVersion);
786 let res;
787 res = yield this.rest.get(url, options);
788 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.Deployment, true);
789 resolve(ret);
790 }
791 catch (err) {
792 reject(err);
793 }
794 }));
795 });
796 }
797 /**
798 * @param {ReleaseInterfaces.DeploymentQueryParameters} queryParameters
799 * @param {string} project - Project ID or project name
800 */
801 getDeploymentsForMultipleEnvironments(queryParameters, project) {
802 return __awaiter(this, void 0, void 0, function* () {
803 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
804 let routeValues = {
805 project: project
806 };
807 try {
808 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Release", "b005ef73-cddc-448e-9ba2-5193bf36b19f", routeValues);
809 let url = verData.requestUrl;
810 let options = this.createRequestOptions('application/json', verData.apiVersion);
811 let res;
812 res = yield this.rest.create(url, queryParameters, options);
813 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.Deployment, true);
814 resolve(ret);
815 }
816 catch (err) {
817 reject(err);
818 }
819 }));
820 });
821 }
822 /**
823 * Get a release environment.
824 *
825 * @param {string} project - Project ID or project name
826 * @param {number} releaseId - Id of the release.
827 * @param {number} environmentId - Id of the release environment.
828 * @param {ReleaseInterfaces.ReleaseEnvironmentExpands} expand - A property that should be expanded in the environment.
829 */
830 getReleaseEnvironment(project, releaseId, environmentId, expand) {
831 return __awaiter(this, void 0, void 0, function* () {
832 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
833 let routeValues = {
834 project: project,
835 releaseId: releaseId,
836 environmentId: environmentId
837 };
838 let queryValues = {
839 '$expand': expand,
840 };
841 try {
842 let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "Release", "a7e426b1-03dc-48af-9dfe-c98bac612dcb", routeValues, queryValues);
843 let url = verData.requestUrl;
844 let options = this.createRequestOptions('application/json', verData.apiVersion);
845 let res;
846 res = yield this.rest.get(url, options);
847 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseEnvironment, false);
848 resolve(ret);
849 }
850 catch (err) {
851 reject(err);
852 }
853 }));
854 });
855 }
856 /**
857 * Update the status of a release environment
858 *
859 * @param {ReleaseInterfaces.ReleaseEnvironmentUpdateMetadata} environmentUpdateData - Environment update meta data.
860 * @param {string} project - Project ID or project name
861 * @param {number} releaseId - Id of the release.
862 * @param {number} environmentId - Id of release environment.
863 */
864 updateReleaseEnvironment(environmentUpdateData, project, releaseId, environmentId) {
865 return __awaiter(this, void 0, void 0, function* () {
866 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
867 let routeValues = {
868 project: project,
869 releaseId: releaseId,
870 environmentId: environmentId
871 };
872 try {
873 let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "Release", "a7e426b1-03dc-48af-9dfe-c98bac612dcb", routeValues);
874 let url = verData.requestUrl;
875 let options = this.createRequestOptions('application/json', verData.apiVersion);
876 let res;
877 res = yield this.rest.update(url, environmentUpdateData, options);
878 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseEnvironment, false);
879 resolve(ret);
880 }
881 catch (err) {
882 reject(err);
883 }
884 }));
885 });
886 }
887 /**
888 * Creates a definition environment template
889 *
890 * @param {ReleaseInterfaces.ReleaseDefinitionEnvironmentTemplate} template - Definition environment template to create
891 * @param {string} project - Project ID or project name
892 */
893 createDefinitionEnvironmentTemplate(template, project) {
894 return __awaiter(this, void 0, void 0, function* () {
895 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
896 let routeValues = {
897 project: project
898 };
899 try {
900 let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Release", "6b03b696-824e-4479-8eb2-6644a51aba89", routeValues);
901 let url = verData.requestUrl;
902 let options = this.createRequestOptions('application/json', verData.apiVersion);
903 let res;
904 res = yield this.rest.create(url, template, options);
905 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseDefinitionEnvironmentTemplate, false);
906 resolve(ret);
907 }
908 catch (err) {
909 reject(err);
910 }
911 }));
912 });
913 }
914 /**
915 * Delete a definition environment template
916 *
917 * @param {string} project - Project ID or project name
918 * @param {string} templateId - Id of the definition environment template
919 */
920 deleteDefinitionEnvironmentTemplate(project, templateId) {
921 return __awaiter(this, void 0, void 0, function* () {
922 if (templateId == null) {
923 throw new TypeError('templateId can not be null or undefined');
924 }
925 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
926 let routeValues = {
927 project: project
928 };
929 let queryValues = {
930 templateId: templateId,
931 };
932 try {
933 let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Release", "6b03b696-824e-4479-8eb2-6644a51aba89", routeValues, queryValues);
934 let url = verData.requestUrl;
935 let options = this.createRequestOptions('application/json', verData.apiVersion);
936 let res;
937 res = yield this.rest.del(url, options);
938 let ret = this.formatResponse(res.result, null, false);
939 resolve(ret);
940 }
941 catch (err) {
942 reject(err);
943 }
944 }));
945 });
946 }
947 /**
948 * Gets a definition environment template
949 *
950 * @param {string} project - Project ID or project name
951 * @param {string} templateId - Id of the definition environment template
952 */
953 getDefinitionEnvironmentTemplate(project, templateId) {
954 return __awaiter(this, void 0, void 0, function* () {
955 if (templateId == null) {
956 throw new TypeError('templateId can not be null or undefined');
957 }
958 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
959 let routeValues = {
960 project: project
961 };
962 let queryValues = {
963 templateId: templateId,
964 };
965 try {
966 let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Release", "6b03b696-824e-4479-8eb2-6644a51aba89", routeValues, queryValues);
967 let url = verData.requestUrl;
968 let options = this.createRequestOptions('application/json', verData.apiVersion);
969 let res;
970 res = yield this.rest.get(url, options);
971 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseDefinitionEnvironmentTemplate, false);
972 resolve(ret);
973 }
974 catch (err) {
975 reject(err);
976 }
977 }));
978 });
979 }
980 /**
981 * Gets a list of definition environment templates
982 *
983 * @param {string} project - Project ID or project name
984 * @param {boolean} isDeleted - 'true' to get definition environment templates that have been deleted. Default is 'false'
985 */
986 listDefinitionEnvironmentTemplates(project, isDeleted) {
987 return __awaiter(this, void 0, void 0, function* () {
988 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
989 let routeValues = {
990 project: project
991 };
992 let queryValues = {
993 isDeleted: isDeleted,
994 };
995 try {
996 let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Release", "6b03b696-824e-4479-8eb2-6644a51aba89", routeValues, queryValues);
997 let url = verData.requestUrl;
998 let options = this.createRequestOptions('application/json', verData.apiVersion);
999 let res;
1000 res = yield this.rest.get(url, options);
1001 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseDefinitionEnvironmentTemplate, true);
1002 resolve(ret);
1003 }
1004 catch (err) {
1005 reject(err);
1006 }
1007 }));
1008 });
1009 }
1010 /**
1011 * Undelete a release definition environment template.
1012 *
1013 * @param {string} project - Project ID or project name
1014 * @param {string} templateId - Id of the definition environment template to be undeleted
1015 */
1016 undeleteReleaseDefinitionEnvironmentTemplate(project, templateId) {
1017 return __awaiter(this, void 0, void 0, function* () {
1018 if (templateId == null) {
1019 throw new TypeError('templateId can not be null or undefined');
1020 }
1021 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1022 let routeValues = {
1023 project: project
1024 };
1025 let queryValues = {
1026 templateId: templateId,
1027 };
1028 try {
1029 let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Release", "6b03b696-824e-4479-8eb2-6644a51aba89", routeValues, queryValues);
1030 let url = verData.requestUrl;
1031 let options = this.createRequestOptions('application/json', verData.apiVersion);
1032 let res;
1033 res = yield this.rest.update(url, null, options);
1034 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseDefinitionEnvironmentTemplate, false);
1035 resolve(ret);
1036 }
1037 catch (err) {
1038 reject(err);
1039 }
1040 }));
1041 });
1042 }
1043 /**
1044 * @param {ReleaseInterfaces.FavoriteItem[]} favoriteItems
1045 * @param {string} project - Project ID or project name
1046 * @param {string} scope
1047 * @param {string} identityId
1048 */
1049 createFavorites(favoriteItems, project, scope, identityId) {
1050 return __awaiter(this, void 0, void 0, function* () {
1051 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1052 let routeValues = {
1053 project: project,
1054 scope: scope
1055 };
1056 let queryValues = {
1057 identityId: identityId,
1058 };
1059 try {
1060 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "938f7222-9acb-48fe-b8a3-4eda04597171", routeValues, queryValues);
1061 let url = verData.requestUrl;
1062 let options = this.createRequestOptions('application/json', verData.apiVersion);
1063 let res;
1064 res = yield this.rest.create(url, favoriteItems, options);
1065 let ret = this.formatResponse(res.result, null, true);
1066 resolve(ret);
1067 }
1068 catch (err) {
1069 reject(err);
1070 }
1071 }));
1072 });
1073 }
1074 /**
1075 * @param {string} project - Project ID or project name
1076 * @param {string} scope
1077 * @param {string} identityId
1078 * @param {string} favoriteItemIds
1079 */
1080 deleteFavorites(project, scope, identityId, favoriteItemIds) {
1081 return __awaiter(this, void 0, void 0, function* () {
1082 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1083 let routeValues = {
1084 project: project,
1085 scope: scope
1086 };
1087 let queryValues = {
1088 identityId: identityId,
1089 favoriteItemIds: favoriteItemIds,
1090 };
1091 try {
1092 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "938f7222-9acb-48fe-b8a3-4eda04597171", routeValues, queryValues);
1093 let url = verData.requestUrl;
1094 let options = this.createRequestOptions('application/json', verData.apiVersion);
1095 let res;
1096 res = yield this.rest.del(url, options);
1097 let ret = this.formatResponse(res.result, null, false);
1098 resolve(ret);
1099 }
1100 catch (err) {
1101 reject(err);
1102 }
1103 }));
1104 });
1105 }
1106 /**
1107 * @param {string} project - Project ID or project name
1108 * @param {string} scope
1109 * @param {string} identityId
1110 */
1111 getFavorites(project, scope, identityId) {
1112 return __awaiter(this, void 0, void 0, function* () {
1113 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1114 let routeValues = {
1115 project: project,
1116 scope: scope
1117 };
1118 let queryValues = {
1119 identityId: identityId,
1120 };
1121 try {
1122 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "938f7222-9acb-48fe-b8a3-4eda04597171", routeValues, queryValues);
1123 let url = verData.requestUrl;
1124 let options = this.createRequestOptions('application/json', verData.apiVersion);
1125 let res;
1126 res = yield this.rest.get(url, options);
1127 let ret = this.formatResponse(res.result, null, true);
1128 resolve(ret);
1129 }
1130 catch (err) {
1131 reject(err);
1132 }
1133 }));
1134 });
1135 }
1136 /**
1137 * @param {string} flightName
1138 */
1139 getFlightAssignments(flightName) {
1140 return __awaiter(this, void 0, void 0, function* () {
1141 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1142 let routeValues = {};
1143 let queryValues = {
1144 flightName: flightName,
1145 };
1146 try {
1147 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "409d301f-3046-46f3-beb9-4357fbce0a8c", routeValues, queryValues);
1148 let url = verData.requestUrl;
1149 let options = this.createRequestOptions('application/json', verData.apiVersion);
1150 let res;
1151 res = yield this.rest.get(url, options);
1152 let ret = this.formatResponse(res.result, null, true);
1153 resolve(ret);
1154 }
1155 catch (err) {
1156 reject(err);
1157 }
1158 }));
1159 });
1160 }
1161 /**
1162 * Creates a new folder.
1163 *
1164 * @param {ReleaseInterfaces.Folder} folder - folder.
1165 * @param {string} project - Project ID or project name
1166 * @param {string} path - Path of the folder.
1167 */
1168 createFolder(folder, project, path) {
1169 return __awaiter(this, void 0, void 0, function* () {
1170 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1171 let routeValues = {
1172 project: project,
1173 path: path
1174 };
1175 try {
1176 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Release", "f7ddf76d-ce0c-4d68-94ff-becaec5d9dea", routeValues);
1177 let url = verData.requestUrl;
1178 let options = this.createRequestOptions('application/json', verData.apiVersion);
1179 let res;
1180 res = yield this.rest.create(url, folder, options);
1181 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.Folder, false);
1182 resolve(ret);
1183 }
1184 catch (err) {
1185 reject(err);
1186 }
1187 }));
1188 });
1189 }
1190 /**
1191 * Deletes a definition folder for given folder name and path and all it's existing definitions.
1192 *
1193 * @param {string} project - Project ID or project name
1194 * @param {string} path - Path of the folder to delete.
1195 */
1196 deleteFolder(project, path) {
1197 return __awaiter(this, void 0, void 0, function* () {
1198 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1199 let routeValues = {
1200 project: project,
1201 path: path
1202 };
1203 try {
1204 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Release", "f7ddf76d-ce0c-4d68-94ff-becaec5d9dea", routeValues);
1205 let url = verData.requestUrl;
1206 let options = this.createRequestOptions('application/json', verData.apiVersion);
1207 let res;
1208 res = yield this.rest.del(url, options);
1209 let ret = this.formatResponse(res.result, null, false);
1210 resolve(ret);
1211 }
1212 catch (err) {
1213 reject(err);
1214 }
1215 }));
1216 });
1217 }
1218 /**
1219 * Gets folders.
1220 *
1221 * @param {string} project - Project ID or project name
1222 * @param {string} path - Path of the folder.
1223 * @param {ReleaseInterfaces.FolderPathQueryOrder} queryOrder - Gets the results in the defined order. Default is 'None'.
1224 */
1225 getFolders(project, path, queryOrder) {
1226 return __awaiter(this, void 0, void 0, function* () {
1227 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1228 let routeValues = {
1229 project: project,
1230 path: path
1231 };
1232 let queryValues = {
1233 queryOrder: queryOrder,
1234 };
1235 try {
1236 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Release", "f7ddf76d-ce0c-4d68-94ff-becaec5d9dea", routeValues, queryValues);
1237 let url = verData.requestUrl;
1238 let options = this.createRequestOptions('application/json', verData.apiVersion);
1239 let res;
1240 res = yield this.rest.get(url, options);
1241 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.Folder, true);
1242 resolve(ret);
1243 }
1244 catch (err) {
1245 reject(err);
1246 }
1247 }));
1248 });
1249 }
1250 /**
1251 * Updates an existing folder at given existing path.
1252 *
1253 * @param {ReleaseInterfaces.Folder} folder - folder.
1254 * @param {string} project - Project ID or project name
1255 * @param {string} path - Path of the folder to update.
1256 */
1257 updateFolder(folder, project, path) {
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 path: path
1263 };
1264 try {
1265 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Release", "f7ddf76d-ce0c-4d68-94ff-becaec5d9dea", routeValues);
1266 let url = verData.requestUrl;
1267 let options = this.createRequestOptions('application/json', verData.apiVersion);
1268 let res;
1269 res = yield this.rest.update(url, folder, options);
1270 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.Folder, false);
1271 resolve(ret);
1272 }
1273 catch (err) {
1274 reject(err);
1275 }
1276 }));
1277 });
1278 }
1279 /**
1280 * Updates the gate for a deployment.
1281 *
1282 * @param {ReleaseInterfaces.GateUpdateMetadata} gateUpdateMetadata - Metadata to patch the Release Gates.
1283 * @param {string} project - Project ID or project name
1284 * @param {number} gateStepId - Gate step Id.
1285 */
1286 updateGates(gateUpdateMetadata, project, gateStepId) {
1287 return __awaiter(this, void 0, void 0, function* () {
1288 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1289 let routeValues = {
1290 project: project,
1291 gateStepId: gateStepId
1292 };
1293 try {
1294 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "2666a539-2001-4f80-bcc7-0379956749d4", routeValues);
1295 let url = verData.requestUrl;
1296 let options = this.createRequestOptions('application/json', verData.apiVersion);
1297 let res;
1298 res = yield this.rest.update(url, gateUpdateMetadata, options);
1299 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseGates, false);
1300 resolve(ret);
1301 }
1302 catch (err) {
1303 reject(err);
1304 }
1305 }));
1306 });
1307 }
1308 /**
1309 * @param {string} project - Project ID or project name
1310 * @param {number} releaseId
1311 */
1312 getReleaseHistory(project, releaseId) {
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 releaseId: releaseId
1318 };
1319 try {
1320 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "23f461c8-629a-4144-a076-3054fa5f268a", routeValues);
1321 let url = verData.requestUrl;
1322 let options = this.createRequestOptions('application/json', verData.apiVersion);
1323 let res;
1324 res = yield this.rest.get(url, options);
1325 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseRevision, true);
1326 resolve(ret);
1327 }
1328 catch (err) {
1329 reject(err);
1330 }
1331 }));
1332 });
1333 }
1334 /**
1335 * @param {FormInputInterfaces.InputValuesQuery} query
1336 * @param {string} project - Project ID or project name
1337 */
1338 getInputValues(query, project) {
1339 return __awaiter(this, void 0, void 0, function* () {
1340 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1341 let routeValues = {
1342 project: project
1343 };
1344 try {
1345 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "71dd499b-317d-45ea-9134-140ea1932b5e", routeValues);
1346 let url = verData.requestUrl;
1347 let options = this.createRequestOptions('application/json', verData.apiVersion);
1348 let res;
1349 res = yield this.rest.create(url, query, options);
1350 let ret = this.formatResponse(res.result, null, false);
1351 resolve(ret);
1352 }
1353 catch (err) {
1354 reject(err);
1355 }
1356 }));
1357 });
1358 }
1359 /**
1360 * @param {string} project - Project ID or project name
1361 * @param {number} buildId
1362 * @param {string} sourceId
1363 */
1364 getIssues(project, buildId, sourceId) {
1365 return __awaiter(this, void 0, void 0, function* () {
1366 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1367 let routeValues = {
1368 project: project,
1369 buildId: buildId
1370 };
1371 let queryValues = {
1372 sourceId: sourceId,
1373 };
1374 try {
1375 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "cd42261a-f5c6-41c8-9259-f078989b9f25", routeValues, queryValues);
1376 let url = verData.requestUrl;
1377 let options = this.createRequestOptions('application/json', verData.apiVersion);
1378 let res;
1379 res = yield this.rest.get(url, options);
1380 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.AutoTriggerIssue, true);
1381 resolve(ret);
1382 }
1383 catch (err) {
1384 reject(err);
1385 }
1386 }));
1387 });
1388 }
1389 /**
1390 * Gets gate logs
1391 *
1392 * @param {string} project - Project ID or project name
1393 * @param {number} releaseId - Id of the release.
1394 * @param {number} environmentId - Id of release environment.
1395 * @param {number} gateId - Id of the gate.
1396 * @param {number} taskId - ReleaseTask Id for the log.
1397 */
1398 getGateLog(project, releaseId, environmentId, gateId, taskId) {
1399 return __awaiter(this, void 0, void 0, function* () {
1400 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1401 let routeValues = {
1402 project: project,
1403 releaseId: releaseId,
1404 environmentId: environmentId,
1405 gateId: gateId,
1406 taskId: taskId
1407 };
1408 try {
1409 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Release", "dec7ca5a-7f7f-4797-8bf1-8efc0dc93b28", routeValues);
1410 let url = verData.requestUrl;
1411 let apiVersion = verData.apiVersion;
1412 let accept = this.createAcceptHeader("text/plain", apiVersion);
1413 resolve((yield this.http.get(url, { "Accept": accept })).message);
1414 }
1415 catch (err) {
1416 reject(err);
1417 }
1418 }));
1419 });
1420 }
1421 /**
1422 * Get logs for a release Id.
1423 *
1424 * @param {string} project - Project ID or project name
1425 * @param {number} releaseId - Id of the release.
1426 */
1427 getLogs(project, releaseId) {
1428 return __awaiter(this, void 0, void 0, function* () {
1429 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1430 let routeValues = {
1431 project: project,
1432 releaseId: releaseId
1433 };
1434 try {
1435 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Release", "c37fbab5-214b-48e4-a55b-cb6b4f6e4038", routeValues);
1436 let url = verData.requestUrl;
1437 let apiVersion = verData.apiVersion;
1438 let accept = this.createAcceptHeader("application/zip", apiVersion);
1439 resolve((yield this.http.get(url, { "Accept": accept })).message);
1440 }
1441 catch (err) {
1442 reject(err);
1443 }
1444 }));
1445 });
1446 }
1447 /**
1448 * Gets logs
1449 *
1450 * @param {string} project - Project ID or project name
1451 * @param {number} releaseId - Id of the release.
1452 * @param {number} environmentId - Id of release environment.
1453 * @param {number} taskId - ReleaseTask Id for the log.
1454 * @param {number} attemptId - Id of the attempt.
1455 */
1456 getLog(project, releaseId, environmentId, taskId, attemptId) {
1457 return __awaiter(this, void 0, void 0, function* () {
1458 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1459 let routeValues = {
1460 project: project,
1461 releaseId: releaseId,
1462 environmentId: environmentId,
1463 taskId: taskId
1464 };
1465 let queryValues = {
1466 attemptId: attemptId,
1467 };
1468 try {
1469 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Release", "e71ba1ed-c0a4-4a28-a61f-2dd5f68cf3fd", routeValues, queryValues);
1470 let url = verData.requestUrl;
1471 let apiVersion = verData.apiVersion;
1472 let accept = this.createAcceptHeader("text/plain", apiVersion);
1473 resolve((yield this.http.get(url, { "Accept": accept })).message);
1474 }
1475 catch (err) {
1476 reject(err);
1477 }
1478 }));
1479 });
1480 }
1481 /**
1482 * Gets the task log of a release as a plain text file.
1483 *
1484 * @param {string} project - Project ID or project name
1485 * @param {number} releaseId - Id of the release.
1486 * @param {number} environmentId - Id of release environment.
1487 * @param {number} attemptId
1488 * @param {string} timelineId
1489 * @param {number} taskId - ReleaseTask Id for the log.
1490 * @param {number} startLine - Starting line number for logs
1491 * @param {number} endLine - Ending line number for logs
1492 */
1493 getTaskLog2(project, releaseId, environmentId, attemptId, timelineId, taskId, startLine, endLine) {
1494 return __awaiter(this, void 0, void 0, function* () {
1495 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1496 let routeValues = {
1497 project: project,
1498 releaseId: releaseId,
1499 environmentId: environmentId,
1500 attemptId: attemptId,
1501 timelineId: timelineId,
1502 taskId: taskId
1503 };
1504 let queryValues = {
1505 startLine: startLine,
1506 endLine: endLine,
1507 };
1508 try {
1509 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Release", "2577e6c3-6999-4400-bc69-fe1d837755fe", routeValues, queryValues);
1510 let url = verData.requestUrl;
1511 let apiVersion = verData.apiVersion;
1512 let accept = this.createAcceptHeader("text/plain", apiVersion);
1513 resolve((yield this.http.get(url, { "Accept": accept })).message);
1514 }
1515 catch (err) {
1516 reject(err);
1517 }
1518 }));
1519 });
1520 }
1521 /**
1522 * Gets the task log of a release as a plain text file.
1523 *
1524 * @param {string} project - Project ID or project name
1525 * @param {number} releaseId - Id of the release.
1526 * @param {number} environmentId - Id of release environment.
1527 * @param {number} releaseDeployPhaseId - Release deploy phase Id.
1528 * @param {number} taskId - ReleaseTask Id for the log.
1529 * @param {number} startLine - Starting line number for logs
1530 * @param {number} endLine - Ending line number for logs
1531 */
1532 getTaskLog(project, releaseId, environmentId, releaseDeployPhaseId, taskId, startLine, endLine) {
1533 return __awaiter(this, void 0, void 0, function* () {
1534 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1535 let routeValues = {
1536 project: project,
1537 releaseId: releaseId,
1538 environmentId: environmentId,
1539 releaseDeployPhaseId: releaseDeployPhaseId,
1540 taskId: taskId
1541 };
1542 let queryValues = {
1543 startLine: startLine,
1544 endLine: endLine,
1545 };
1546 try {
1547 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Release", "17c91af7-09fd-4256-bff1-c24ee4f73bc0", routeValues, queryValues);
1548 let url = verData.requestUrl;
1549 let apiVersion = verData.apiVersion;
1550 let accept = this.createAcceptHeader("text/plain", apiVersion);
1551 resolve((yield this.http.get(url, { "Accept": accept })).message);
1552 }
1553 catch (err) {
1554 reject(err);
1555 }
1556 }));
1557 });
1558 }
1559 /**
1560 * Get manual intervention for a given release and manual intervention id.
1561 *
1562 * @param {string} project - Project ID or project name
1563 * @param {number} releaseId - Id of the release.
1564 * @param {number} manualInterventionId - Id of the manual intervention.
1565 */
1566 getManualIntervention(project, releaseId, manualInterventionId) {
1567 return __awaiter(this, void 0, void 0, function* () {
1568 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1569 let routeValues = {
1570 project: project,
1571 releaseId: releaseId,
1572 manualInterventionId: manualInterventionId
1573 };
1574 try {
1575 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "616c46e4-f370-4456-adaa-fbaf79c7b79e", routeValues);
1576 let url = verData.requestUrl;
1577 let options = this.createRequestOptions('application/json', verData.apiVersion);
1578 let res;
1579 res = yield this.rest.get(url, options);
1580 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ManualIntervention, false);
1581 resolve(ret);
1582 }
1583 catch (err) {
1584 reject(err);
1585 }
1586 }));
1587 });
1588 }
1589 /**
1590 * List all manual interventions for a given release.
1591 *
1592 * @param {string} project - Project ID or project name
1593 * @param {number} releaseId - Id of the release.
1594 */
1595 getManualInterventions(project, releaseId) {
1596 return __awaiter(this, void 0, void 0, function* () {
1597 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1598 let routeValues = {
1599 project: project,
1600 releaseId: releaseId
1601 };
1602 try {
1603 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "616c46e4-f370-4456-adaa-fbaf79c7b79e", routeValues);
1604 let url = verData.requestUrl;
1605 let options = this.createRequestOptions('application/json', verData.apiVersion);
1606 let res;
1607 res = yield this.rest.get(url, options);
1608 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ManualIntervention, true);
1609 resolve(ret);
1610 }
1611 catch (err) {
1612 reject(err);
1613 }
1614 }));
1615 });
1616 }
1617 /**
1618 * Update manual intervention.
1619 *
1620 * @param {ReleaseInterfaces.ManualInterventionUpdateMetadata} manualInterventionUpdateMetadata - Meta data to update manual intervention.
1621 * @param {string} project - Project ID or project name
1622 * @param {number} releaseId - Id of the release.
1623 * @param {number} manualInterventionId - Id of the manual intervention.
1624 */
1625 updateManualIntervention(manualInterventionUpdateMetadata, project, releaseId, manualInterventionId) {
1626 return __awaiter(this, void 0, void 0, function* () {
1627 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1628 let routeValues = {
1629 project: project,
1630 releaseId: releaseId,
1631 manualInterventionId: manualInterventionId
1632 };
1633 try {
1634 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "616c46e4-f370-4456-adaa-fbaf79c7b79e", routeValues);
1635 let url = verData.requestUrl;
1636 let options = this.createRequestOptions('application/json', verData.apiVersion);
1637 let res;
1638 res = yield this.rest.update(url, manualInterventionUpdateMetadata, options);
1639 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ManualIntervention, false);
1640 resolve(ret);
1641 }
1642 catch (err) {
1643 reject(err);
1644 }
1645 }));
1646 });
1647 }
1648 /**
1649 * @param {string} project - Project ID or project name
1650 * @param {Date} minMetricsTime
1651 */
1652 getMetrics(project, minMetricsTime) {
1653 return __awaiter(this, void 0, void 0, function* () {
1654 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1655 let routeValues = {
1656 project: project
1657 };
1658 let queryValues = {
1659 minMetricsTime: minMetricsTime,
1660 };
1661 try {
1662 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "cd1502bb-3c73-4e11-80a6-d11308dceae5", routeValues, queryValues);
1663 let url = verData.requestUrl;
1664 let options = this.createRequestOptions('application/json', verData.apiVersion);
1665 let res;
1666 res = yield this.rest.get(url, options);
1667 let ret = this.formatResponse(res.result, null, true);
1668 resolve(ret);
1669 }
1670 catch (err) {
1671 reject(err);
1672 }
1673 }));
1674 });
1675 }
1676 /**
1677 * Gets Org pipeline release settings
1678 *
1679 */
1680 getOrgPipelineReleaseSettings() {
1681 return __awaiter(this, void 0, void 0, function* () {
1682 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1683 let routeValues = {};
1684 try {
1685 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "d156c759-ca4e-492b-90d4-db03971796ea", routeValues);
1686 let url = verData.requestUrl;
1687 let options = this.createRequestOptions('application/json', verData.apiVersion);
1688 let res;
1689 res = yield this.rest.get(url, options);
1690 let ret = this.formatResponse(res.result, null, false);
1691 resolve(ret);
1692 }
1693 catch (err) {
1694 reject(err);
1695 }
1696 }));
1697 });
1698 }
1699 /**
1700 * Updates Org pipeline release settings
1701 *
1702 * @param {ReleaseInterfaces.OrgPipelineReleaseSettingsUpdateParameters} newSettings
1703 */
1704 updateOrgPipelineReleaseSettings(newSettings) {
1705 return __awaiter(this, void 0, void 0, function* () {
1706 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1707 let routeValues = {};
1708 try {
1709 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "d156c759-ca4e-492b-90d4-db03971796ea", routeValues);
1710 let url = verData.requestUrl;
1711 let options = this.createRequestOptions('application/json', verData.apiVersion);
1712 let res;
1713 res = yield this.rest.update(url, newSettings, options);
1714 let ret = this.formatResponse(res.result, null, false);
1715 resolve(ret);
1716 }
1717 catch (err) {
1718 reject(err);
1719 }
1720 }));
1721 });
1722 }
1723 /**
1724 * Gets pipeline release settings
1725 *
1726 * @param {string} project - Project ID or project name
1727 */
1728 getPipelineReleaseSettings(project) {
1729 return __awaiter(this, void 0, void 0, function* () {
1730 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1731 let routeValues = {
1732 project: project
1733 };
1734 try {
1735 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "e816b9f4-f9fe-46ba-bdcc-a9af6abf3144", routeValues);
1736 let url = verData.requestUrl;
1737 let options = this.createRequestOptions('application/json', verData.apiVersion);
1738 let res;
1739 res = yield this.rest.get(url, options);
1740 let ret = this.formatResponse(res.result, null, false);
1741 resolve(ret);
1742 }
1743 catch (err) {
1744 reject(err);
1745 }
1746 }));
1747 });
1748 }
1749 /**
1750 * Updates pipeline release settings
1751 *
1752 * @param {ReleaseInterfaces.ProjectPipelineReleaseSettingsUpdateParameters} newSettings
1753 * @param {string} project - Project ID or project name
1754 */
1755 updatePipelineReleaseSettings(newSettings, project) {
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 };
1761 try {
1762 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "e816b9f4-f9fe-46ba-bdcc-a9af6abf3144", routeValues);
1763 let url = verData.requestUrl;
1764 let options = this.createRequestOptions('application/json', verData.apiVersion);
1765 let res;
1766 res = yield this.rest.update(url, newSettings, options);
1767 let ret = this.formatResponse(res.result, null, false);
1768 resolve(ret);
1769 }
1770 catch (err) {
1771 reject(err);
1772 }
1773 }));
1774 });
1775 }
1776 /**
1777 * @param {string} artifactType
1778 * @param {string} artifactSourceId
1779 */
1780 getReleaseProjects(artifactType, artifactSourceId) {
1781 return __awaiter(this, void 0, void 0, function* () {
1782 if (artifactType == null) {
1783 throw new TypeError('artifactType can not be null or undefined');
1784 }
1785 if (artifactSourceId == null) {
1786 throw new TypeError('artifactSourceId can not be null or undefined');
1787 }
1788 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1789 let routeValues = {};
1790 let queryValues = {
1791 artifactType: artifactType,
1792 artifactSourceId: artifactSourceId,
1793 };
1794 try {
1795 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "917ace4a-79d1-45a7-987c-7be4db4268fa", routeValues, queryValues);
1796 let url = verData.requestUrl;
1797 let options = this.createRequestOptions('application/json', verData.apiVersion);
1798 let res;
1799 res = yield this.rest.get(url, options);
1800 let ret = this.formatResponse(res.result, null, true);
1801 resolve(ret);
1802 }
1803 catch (err) {
1804 reject(err);
1805 }
1806 }));
1807 });
1808 }
1809 /**
1810 * Get a list of releases
1811 *
1812 * @param {string} project - Project ID or project name
1813 * @param {number} definitionId - Releases from this release definition Id.
1814 * @param {number} definitionEnvironmentId
1815 * @param {string} searchText - Releases with names containing searchText.
1816 * @param {string} createdBy - Releases created by this user.
1817 * @param {ReleaseInterfaces.ReleaseStatus} statusFilter - Releases that have this status.
1818 * @param {number} environmentStatusFilter
1819 * @param {Date} minCreatedTime - Releases that were created after this time.
1820 * @param {Date} maxCreatedTime - Releases that were created before this time.
1821 * @param {ReleaseInterfaces.ReleaseQueryOrder} queryOrder - Gets the results in the defined order of created date for releases. Default is descending.
1822 * @param {number} top - Number of releases to get. Default is 50.
1823 * @param {number} continuationToken - Gets the releases after the continuation token provided.
1824 * @param {ReleaseInterfaces.ReleaseExpands} expand - The property that should be expanded in the list of releases.
1825 * @param {string} artifactTypeId - Releases with given artifactTypeId will be returned. Values can be Build, Jenkins, GitHub, Nuget, Team Build (external), ExternalTFSBuild, Git, TFVC, ExternalTfsXamlBuild.
1826 * @param {string} sourceId - Unique identifier of the artifact used. e.g. For build it would be {projectGuid}:{BuildDefinitionId}, for Jenkins it would be {JenkinsConnectionId}:{JenkinsDefinitionId}, for TfsOnPrem it would be {TfsOnPremConnectionId}:{ProjectName}:{TfsOnPremDefinitionId}. For third-party artifacts e.g. TeamCity, BitBucket you may refer 'uniqueSourceIdentifier' inside vss-extension.json https://github.com/Microsoft/vsts-rm-extensions/blob/master/Extensions.
1827 * @param {string} artifactVersionId - Releases with given artifactVersionId will be returned. E.g. in case of Build artifactType, it is buildId.
1828 * @param {string} sourceBranchFilter - Releases with given sourceBranchFilter will be returned.
1829 * @param {boolean} isDeleted - Gets the soft deleted releases, if true.
1830 * @param {string[]} tagFilter - A comma-delimited list of tags. Only releases with these tags will be returned.
1831 * @param {string[]} propertyFilters - A comma-delimited list of extended properties to be retrieved. If set, the returned Releases will contain values for the specified property Ids (if they exist). If not set, properties will not be included. Note that this will not filter out any Release from results irrespective of whether it has property set or not.
1832 * @param {number[]} releaseIdFilter - A comma-delimited list of releases Ids. Only releases with these Ids will be returned.
1833 * @param {string} path - Releases under this folder path will be returned
1834 */
1835 getReleases(project, definitionId, definitionEnvironmentId, searchText, createdBy, statusFilter, environmentStatusFilter, minCreatedTime, maxCreatedTime, queryOrder, top, continuationToken, expand, artifactTypeId, sourceId, artifactVersionId, sourceBranchFilter, isDeleted, tagFilter, propertyFilters, releaseIdFilter, path) {
1836 return __awaiter(this, void 0, void 0, function* () {
1837 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1838 let routeValues = {
1839 project: project
1840 };
1841 let queryValues = {
1842 definitionId: definitionId,
1843 definitionEnvironmentId: definitionEnvironmentId,
1844 searchText: searchText,
1845 createdBy: createdBy,
1846 statusFilter: statusFilter,
1847 environmentStatusFilter: environmentStatusFilter,
1848 minCreatedTime: minCreatedTime,
1849 maxCreatedTime: maxCreatedTime,
1850 queryOrder: queryOrder,
1851 '$top': top,
1852 continuationToken: continuationToken,
1853 '$expand': expand,
1854 artifactTypeId: artifactTypeId,
1855 sourceId: sourceId,
1856 artifactVersionId: artifactVersionId,
1857 sourceBranchFilter: sourceBranchFilter,
1858 isDeleted: isDeleted,
1859 tagFilter: tagFilter && tagFilter.join(","),
1860 propertyFilters: propertyFilters && propertyFilters.join(","),
1861 releaseIdFilter: releaseIdFilter && releaseIdFilter.join(","),
1862 path: path,
1863 };
1864 try {
1865 let verData = yield this.vsoClient.getVersioningData("7.2-preview.8", "Release", "a166fde7-27ad-408e-ba75-703c2cc9d500", routeValues, queryValues);
1866 let url = verData.requestUrl;
1867 let options = this.createRequestOptions('application/json', verData.apiVersion);
1868 let res;
1869 res = yield this.rest.get(url, options);
1870 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.Release, true);
1871 resolve(ret);
1872 }
1873 catch (err) {
1874 reject(err);
1875 }
1876 }));
1877 });
1878 }
1879 /**
1880 * Create a release.
1881 *
1882 * @param {ReleaseInterfaces.ReleaseStartMetadata} releaseStartMetadata - Metadata to create a release.
1883 * @param {string} project - Project ID or project name
1884 */
1885 createRelease(releaseStartMetadata, project) {
1886 return __awaiter(this, void 0, void 0, function* () {
1887 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1888 let routeValues = {
1889 project: project
1890 };
1891 try {
1892 let verData = yield this.vsoClient.getVersioningData("7.2-preview.8", "Release", "a166fde7-27ad-408e-ba75-703c2cc9d500", routeValues);
1893 let url = verData.requestUrl;
1894 let options = this.createRequestOptions('application/json', verData.apiVersion);
1895 let res;
1896 res = yield this.rest.create(url, releaseStartMetadata, options);
1897 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.Release, false);
1898 resolve(ret);
1899 }
1900 catch (err) {
1901 reject(err);
1902 }
1903 }));
1904 });
1905 }
1906 /**
1907 * Soft delete a release
1908 *
1909 * @param {string} project - Project ID or project name
1910 * @param {number} releaseId - Id of the release.
1911 * @param {string} comment - Comment for deleting a release.
1912 */
1913 deleteRelease(project, releaseId, comment) {
1914 return __awaiter(this, void 0, void 0, function* () {
1915 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1916 let routeValues = {
1917 project: project,
1918 releaseId: releaseId
1919 };
1920 let queryValues = {
1921 comment: comment,
1922 };
1923 try {
1924 let verData = yield this.vsoClient.getVersioningData("7.2-preview.8", "Release", "a166fde7-27ad-408e-ba75-703c2cc9d500", routeValues, queryValues);
1925 let url = verData.requestUrl;
1926 let options = this.createRequestOptions('application/json', verData.apiVersion);
1927 let res;
1928 res = yield this.rest.del(url, options);
1929 let ret = this.formatResponse(res.result, null, false);
1930 resolve(ret);
1931 }
1932 catch (err) {
1933 reject(err);
1934 }
1935 }));
1936 });
1937 }
1938 /**
1939 * Get a Release
1940 *
1941 * @param {string} project - Project ID or project name
1942 * @param {number} releaseId - Id of the release.
1943 * @param {ReleaseInterfaces.ApprovalFilters} approvalFilters - A filter which would allow fetching approval steps selectively based on whether it is automated, or manual. This would also decide whether we should fetch pre and post approval snapshots. Assumes All by default
1944 * @param {string[]} propertyFilters - A comma-delimited list of extended properties to be retrieved. If set, the returned Release will contain values for the specified property Ids (if they exist). If not set, properties will not be included.
1945 * @param {ReleaseInterfaces.SingleReleaseExpands} expand - A property that should be expanded in the release.
1946 * @param {number} topGateRecords - Number of release gate records to get. Default is 5.
1947 */
1948 getRelease(project, releaseId, approvalFilters, propertyFilters, expand, topGateRecords) {
1949 return __awaiter(this, void 0, void 0, function* () {
1950 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1951 let routeValues = {
1952 project: project,
1953 releaseId: releaseId
1954 };
1955 let queryValues = {
1956 approvalFilters: approvalFilters,
1957 propertyFilters: propertyFilters && propertyFilters.join(","),
1958 '$expand': expand,
1959 '$topGateRecords': topGateRecords,
1960 };
1961 try {
1962 let verData = yield this.vsoClient.getVersioningData("7.2-preview.8", "Release", "a166fde7-27ad-408e-ba75-703c2cc9d500", routeValues, queryValues);
1963 let url = verData.requestUrl;
1964 let options = this.createRequestOptions('application/json', verData.apiVersion);
1965 let res;
1966 res = yield this.rest.get(url, options);
1967 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.Release, false);
1968 resolve(ret);
1969 }
1970 catch (err) {
1971 reject(err);
1972 }
1973 }));
1974 });
1975 }
1976 /**
1977 * Get release summary of a given definition Id.
1978 *
1979 * @param {string} project - Project ID or project name
1980 * @param {number} definitionId - Id of the definition to get release summary.
1981 * @param {number} releaseCount - Count of releases to be included in summary.
1982 * @param {boolean} includeArtifact - Include artifact details.Default is 'false'.
1983 * @param {number[]} definitionEnvironmentIdsFilter
1984 */
1985 getReleaseDefinitionSummary(project, definitionId, releaseCount, includeArtifact, definitionEnvironmentIdsFilter) {
1986 return __awaiter(this, void 0, void 0, function* () {
1987 if (definitionId == null) {
1988 throw new TypeError('definitionId can not be null or undefined');
1989 }
1990 if (releaseCount == null) {
1991 throw new TypeError('releaseCount can not be null or undefined');
1992 }
1993 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1994 let routeValues = {
1995 project: project
1996 };
1997 let queryValues = {
1998 definitionId: definitionId,
1999 releaseCount: releaseCount,
2000 includeArtifact: includeArtifact,
2001 definitionEnvironmentIdsFilter: definitionEnvironmentIdsFilter && definitionEnvironmentIdsFilter.join(","),
2002 };
2003 try {
2004 let verData = yield this.vsoClient.getVersioningData("7.2-preview.8", "Release", "a166fde7-27ad-408e-ba75-703c2cc9d500", routeValues, queryValues);
2005 let url = verData.requestUrl;
2006 let options = this.createRequestOptions('application/json', verData.apiVersion);
2007 let res;
2008 res = yield this.rest.get(url, options);
2009 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseDefinitionSummary, false);
2010 resolve(ret);
2011 }
2012 catch (err) {
2013 reject(err);
2014 }
2015 }));
2016 });
2017 }
2018 /**
2019 * Get release for a given revision number.
2020 *
2021 * @param {string} project - Project ID or project name
2022 * @param {number} releaseId - Id of the release.
2023 * @param {number} definitionSnapshotRevision - Definition snapshot revision number.
2024 */
2025 getReleaseRevision(project, releaseId, definitionSnapshotRevision) {
2026 return __awaiter(this, void 0, void 0, function* () {
2027 if (definitionSnapshotRevision == null) {
2028 throw new TypeError('definitionSnapshotRevision can not be null or undefined');
2029 }
2030 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2031 let routeValues = {
2032 project: project,
2033 releaseId: releaseId
2034 };
2035 let queryValues = {
2036 definitionSnapshotRevision: definitionSnapshotRevision,
2037 };
2038 try {
2039 let verData = yield this.vsoClient.getVersioningData("7.2-preview.8", "Release", "a166fde7-27ad-408e-ba75-703c2cc9d500", routeValues, queryValues);
2040 let url = verData.requestUrl;
2041 let apiVersion = verData.apiVersion;
2042 let accept = this.createAcceptHeader("text/plain", apiVersion);
2043 resolve((yield this.http.get(url, { "Accept": accept })).message);
2044 }
2045 catch (err) {
2046 reject(err);
2047 }
2048 }));
2049 });
2050 }
2051 /**
2052 * Undelete a soft deleted release.
2053 *
2054 * @param {string} project - Project ID or project name
2055 * @param {number} releaseId - Id of release to be undeleted.
2056 * @param {string} comment - Any comment for undeleting.
2057 */
2058 undeleteRelease(project, releaseId, comment) {
2059 return __awaiter(this, void 0, void 0, function* () {
2060 if (comment == null) {
2061 throw new TypeError('comment can not be null or undefined');
2062 }
2063 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2064 let routeValues = {
2065 project: project,
2066 releaseId: releaseId
2067 };
2068 let queryValues = {
2069 comment: comment,
2070 };
2071 try {
2072 let verData = yield this.vsoClient.getVersioningData("7.2-preview.8", "Release", "a166fde7-27ad-408e-ba75-703c2cc9d500", routeValues, queryValues);
2073 let url = verData.requestUrl;
2074 let options = this.createRequestOptions('application/json', verData.apiVersion);
2075 let res;
2076 res = yield this.rest.replace(url, null, options);
2077 let ret = this.formatResponse(res.result, null, false);
2078 resolve(ret);
2079 }
2080 catch (err) {
2081 reject(err);
2082 }
2083 }));
2084 });
2085 }
2086 /**
2087 * Update a complete release object.
2088 *
2089 * @param {ReleaseInterfaces.Release} release - Release object for update.
2090 * @param {string} project - Project ID or project name
2091 * @param {number} releaseId - Id of the release to update.
2092 */
2093 updateRelease(release, project, releaseId) {
2094 return __awaiter(this, void 0, void 0, function* () {
2095 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2096 let routeValues = {
2097 project: project,
2098 releaseId: releaseId
2099 };
2100 try {
2101 let verData = yield this.vsoClient.getVersioningData("7.2-preview.8", "Release", "a166fde7-27ad-408e-ba75-703c2cc9d500", routeValues);
2102 let url = verData.requestUrl;
2103 let options = this.createRequestOptions('application/json', verData.apiVersion);
2104 let res;
2105 res = yield this.rest.replace(url, release, options);
2106 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.Release, false);
2107 resolve(ret);
2108 }
2109 catch (err) {
2110 reject(err);
2111 }
2112 }));
2113 });
2114 }
2115 /**
2116 * Update few properties of a release.
2117 *
2118 * @param {ReleaseInterfaces.ReleaseUpdateMetadata} releaseUpdateMetadata - Properties of release to update.
2119 * @param {string} project - Project ID or project name
2120 * @param {number} releaseId - Id of the release to update.
2121 */
2122 updateReleaseResource(releaseUpdateMetadata, project, releaseId) {
2123 return __awaiter(this, void 0, void 0, function* () {
2124 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2125 let routeValues = {
2126 project: project,
2127 releaseId: releaseId
2128 };
2129 try {
2130 let verData = yield this.vsoClient.getVersioningData("7.2-preview.8", "Release", "a166fde7-27ad-408e-ba75-703c2cc9d500", routeValues);
2131 let url = verData.requestUrl;
2132 let options = this.createRequestOptions('application/json', verData.apiVersion);
2133 let res;
2134 res = yield this.rest.update(url, releaseUpdateMetadata, options);
2135 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.Release, false);
2136 resolve(ret);
2137 }
2138 catch (err) {
2139 reject(err);
2140 }
2141 }));
2142 });
2143 }
2144 /**
2145 * Gets the release settings
2146 *
2147 * @param {string} project - Project ID or project name
2148 */
2149 getReleaseSettings(project) {
2150 return __awaiter(this, void 0, void 0, function* () {
2151 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2152 let routeValues = {
2153 project: project
2154 };
2155 try {
2156 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "c63c3718-7cfd-41e0-b89b-81c1ca143437", routeValues);
2157 let url = verData.requestUrl;
2158 let options = this.createRequestOptions('application/json', verData.apiVersion);
2159 let res;
2160 res = yield this.rest.get(url, options);
2161 let ret = this.formatResponse(res.result, null, false);
2162 resolve(ret);
2163 }
2164 catch (err) {
2165 reject(err);
2166 }
2167 }));
2168 });
2169 }
2170 /**
2171 * Updates the release settings
2172 *
2173 * @param {ReleaseInterfaces.ReleaseSettings} releaseSettings
2174 * @param {string} project - Project ID or project name
2175 */
2176 updateReleaseSettings(releaseSettings, project) {
2177 return __awaiter(this, void 0, void 0, function* () {
2178 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2179 let routeValues = {
2180 project: project
2181 };
2182 try {
2183 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "c63c3718-7cfd-41e0-b89b-81c1ca143437", routeValues);
2184 let url = verData.requestUrl;
2185 let options = this.createRequestOptions('application/json', verData.apiVersion);
2186 let res;
2187 res = yield this.rest.replace(url, releaseSettings, options);
2188 let ret = this.formatResponse(res.result, null, false);
2189 resolve(ret);
2190 }
2191 catch (err) {
2192 reject(err);
2193 }
2194 }));
2195 });
2196 }
2197 /**
2198 * Get release definition for a given definitionId and revision
2199 *
2200 * @param {string} project - Project ID or project name
2201 * @param {number} definitionId - Id of the definition.
2202 * @param {number} revision - Id of the revision.
2203 */
2204 getDefinitionRevision(project, definitionId, revision) {
2205 return __awaiter(this, void 0, void 0, function* () {
2206 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2207 let routeValues = {
2208 project: project,
2209 definitionId: definitionId,
2210 revision: revision
2211 };
2212 try {
2213 let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Release", "258b82e0-9d41-43f3-86d6-fef14ddd44bc", routeValues);
2214 let url = verData.requestUrl;
2215 let apiVersion = verData.apiVersion;
2216 let accept = this.createAcceptHeader("text/plain", apiVersion);
2217 resolve((yield this.http.get(url, { "Accept": accept })).message);
2218 }
2219 catch (err) {
2220 reject(err);
2221 }
2222 }));
2223 });
2224 }
2225 /**
2226 * Get revision history for a release definition
2227 *
2228 * @param {string} project - Project ID or project name
2229 * @param {number} definitionId - Id of the definition.
2230 */
2231 getReleaseDefinitionHistory(project, definitionId) {
2232 return __awaiter(this, void 0, void 0, function* () {
2233 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2234 let routeValues = {
2235 project: project,
2236 definitionId: definitionId
2237 };
2238 try {
2239 let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Release", "258b82e0-9d41-43f3-86d6-fef14ddd44bc", routeValues);
2240 let url = verData.requestUrl;
2241 let options = this.createRequestOptions('application/json', verData.apiVersion);
2242 let res;
2243 res = yield this.rest.get(url, options);
2244 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseDefinitionRevision, true);
2245 resolve(ret);
2246 }
2247 catch (err) {
2248 reject(err);
2249 }
2250 }));
2251 });
2252 }
2253 /**
2254 * @param {string} project - Project ID or project name
2255 * @param {number} releaseId
2256 */
2257 getSummaryMailSections(project, releaseId) {
2258 return __awaiter(this, void 0, void 0, function* () {
2259 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2260 let routeValues = {
2261 project: project,
2262 releaseId: releaseId
2263 };
2264 try {
2265 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "224e92b2-8d13-4c14-b120-13d877c516f8", routeValues);
2266 let url = verData.requestUrl;
2267 let options = this.createRequestOptions('application/json', verData.apiVersion);
2268 let res;
2269 res = yield this.rest.get(url, options);
2270 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.SummaryMailSection, true);
2271 resolve(ret);
2272 }
2273 catch (err) {
2274 reject(err);
2275 }
2276 }));
2277 });
2278 }
2279 /**
2280 * @param {ReleaseInterfaces.MailMessage} mailMessage
2281 * @param {string} project - Project ID or project name
2282 * @param {number} releaseId
2283 */
2284 sendSummaryMail(mailMessage, project, releaseId) {
2285 return __awaiter(this, void 0, void 0, function* () {
2286 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2287 let routeValues = {
2288 project: project,
2289 releaseId: releaseId
2290 };
2291 try {
2292 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "224e92b2-8d13-4c14-b120-13d877c516f8", routeValues);
2293 let url = verData.requestUrl;
2294 let options = this.createRequestOptions('application/json', verData.apiVersion);
2295 let res;
2296 res = yield this.rest.create(url, mailMessage, options);
2297 let ret = this.formatResponse(res.result, null, false);
2298 resolve(ret);
2299 }
2300 catch (err) {
2301 reject(err);
2302 }
2303 }));
2304 });
2305 }
2306 /**
2307 * @param {string} project - Project ID or project name
2308 * @param {number} definitionId
2309 */
2310 getSourceBranches(project, definitionId) {
2311 return __awaiter(this, void 0, void 0, function* () {
2312 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2313 let routeValues = {
2314 project: project,
2315 definitionId: definitionId
2316 };
2317 try {
2318 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "0e5def23-78b3-461f-8198-1558f25041c8", routeValues);
2319 let url = verData.requestUrl;
2320 let options = this.createRequestOptions('application/json', verData.apiVersion);
2321 let res;
2322 res = yield this.rest.get(url, options);
2323 let ret = this.formatResponse(res.result, null, true);
2324 resolve(ret);
2325 }
2326 catch (err) {
2327 reject(err);
2328 }
2329 }));
2330 });
2331 }
2332 /**
2333 * Adds a tag to a definition
2334 *
2335 * @param {string} project - Project ID or project name
2336 * @param {number} releaseDefinitionId
2337 * @param {string} tag
2338 */
2339 addDefinitionTag(project, releaseDefinitionId, tag) {
2340 return __awaiter(this, void 0, void 0, function* () {
2341 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2342 let routeValues = {
2343 project: project,
2344 releaseDefinitionId: releaseDefinitionId,
2345 tag: tag
2346 };
2347 try {
2348 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "3d21b4c8-c32e-45b2-a7cb-770a369012f4", routeValues);
2349 let url = verData.requestUrl;
2350 let options = this.createRequestOptions('application/json', verData.apiVersion);
2351 let res;
2352 res = yield this.rest.update(url, null, options);
2353 let ret = this.formatResponse(res.result, null, true);
2354 resolve(ret);
2355 }
2356 catch (err) {
2357 reject(err);
2358 }
2359 }));
2360 });
2361 }
2362 /**
2363 * Adds multiple tags to a definition
2364 *
2365 * @param {string[]} tags
2366 * @param {string} project - Project ID or project name
2367 * @param {number} releaseDefinitionId
2368 */
2369 addDefinitionTags(tags, project, releaseDefinitionId) {
2370 return __awaiter(this, void 0, void 0, function* () {
2371 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2372 let routeValues = {
2373 project: project,
2374 releaseDefinitionId: releaseDefinitionId
2375 };
2376 try {
2377 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "3d21b4c8-c32e-45b2-a7cb-770a369012f4", routeValues);
2378 let url = verData.requestUrl;
2379 let options = this.createRequestOptions('application/json', verData.apiVersion);
2380 let res;
2381 res = yield this.rest.create(url, tags, options);
2382 let ret = this.formatResponse(res.result, null, true);
2383 resolve(ret);
2384 }
2385 catch (err) {
2386 reject(err);
2387 }
2388 }));
2389 });
2390 }
2391 /**
2392 * Deletes a tag from a definition
2393 *
2394 * @param {string} project - Project ID or project name
2395 * @param {number} releaseDefinitionId
2396 * @param {string} tag
2397 */
2398 deleteDefinitionTag(project, releaseDefinitionId, tag) {
2399 return __awaiter(this, void 0, void 0, function* () {
2400 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2401 let routeValues = {
2402 project: project,
2403 releaseDefinitionId: releaseDefinitionId,
2404 tag: tag
2405 };
2406 try {
2407 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "3d21b4c8-c32e-45b2-a7cb-770a369012f4", routeValues);
2408 let url = verData.requestUrl;
2409 let options = this.createRequestOptions('application/json', verData.apiVersion);
2410 let res;
2411 res = yield this.rest.del(url, options);
2412 let ret = this.formatResponse(res.result, null, true);
2413 resolve(ret);
2414 }
2415 catch (err) {
2416 reject(err);
2417 }
2418 }));
2419 });
2420 }
2421 /**
2422 * Gets the tags for a definition
2423 *
2424 * @param {string} project - Project ID or project name
2425 * @param {number} releaseDefinitionId
2426 */
2427 getDefinitionTags(project, releaseDefinitionId) {
2428 return __awaiter(this, void 0, void 0, function* () {
2429 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2430 let routeValues = {
2431 project: project,
2432 releaseDefinitionId: releaseDefinitionId
2433 };
2434 try {
2435 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "3d21b4c8-c32e-45b2-a7cb-770a369012f4", routeValues);
2436 let url = verData.requestUrl;
2437 let options = this.createRequestOptions('application/json', verData.apiVersion);
2438 let res;
2439 res = yield this.rest.get(url, options);
2440 let ret = this.formatResponse(res.result, null, true);
2441 resolve(ret);
2442 }
2443 catch (err) {
2444 reject(err);
2445 }
2446 }));
2447 });
2448 }
2449 /**
2450 * Adds a tag to a releaseId
2451 *
2452 * @param {string} project - Project ID or project name
2453 * @param {number} releaseId
2454 * @param {string} tag
2455 */
2456 addReleaseTag(project, releaseId, tag) {
2457 return __awaiter(this, void 0, void 0, function* () {
2458 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2459 let routeValues = {
2460 project: project,
2461 releaseId: releaseId,
2462 tag: tag
2463 };
2464 try {
2465 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "c5b602b6-d1b3-4363-8a51-94384f78068f", routeValues);
2466 let url = verData.requestUrl;
2467 let options = this.createRequestOptions('application/json', verData.apiVersion);
2468 let res;
2469 res = yield this.rest.update(url, null, options);
2470 let ret = this.formatResponse(res.result, null, true);
2471 resolve(ret);
2472 }
2473 catch (err) {
2474 reject(err);
2475 }
2476 }));
2477 });
2478 }
2479 /**
2480 * Adds tag to a release
2481 *
2482 * @param {string[]} tags
2483 * @param {string} project - Project ID or project name
2484 * @param {number} releaseId
2485 */
2486 addReleaseTags(tags, project, releaseId) {
2487 return __awaiter(this, void 0, void 0, function* () {
2488 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2489 let routeValues = {
2490 project: project,
2491 releaseId: releaseId
2492 };
2493 try {
2494 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "c5b602b6-d1b3-4363-8a51-94384f78068f", routeValues);
2495 let url = verData.requestUrl;
2496 let options = this.createRequestOptions('application/json', verData.apiVersion);
2497 let res;
2498 res = yield this.rest.create(url, tags, options);
2499 let ret = this.formatResponse(res.result, null, true);
2500 resolve(ret);
2501 }
2502 catch (err) {
2503 reject(err);
2504 }
2505 }));
2506 });
2507 }
2508 /**
2509 * Deletes a tag from a release
2510 *
2511 * @param {string} project - Project ID or project name
2512 * @param {number} releaseId
2513 * @param {string} tag
2514 */
2515 deleteReleaseTag(project, releaseId, tag) {
2516 return __awaiter(this, void 0, void 0, function* () {
2517 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2518 let routeValues = {
2519 project: project,
2520 releaseId: releaseId,
2521 tag: tag
2522 };
2523 try {
2524 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "c5b602b6-d1b3-4363-8a51-94384f78068f", routeValues);
2525 let url = verData.requestUrl;
2526 let options = this.createRequestOptions('application/json', verData.apiVersion);
2527 let res;
2528 res = yield this.rest.del(url, options);
2529 let ret = this.formatResponse(res.result, null, true);
2530 resolve(ret);
2531 }
2532 catch (err) {
2533 reject(err);
2534 }
2535 }));
2536 });
2537 }
2538 /**
2539 * Gets the tags for a release
2540 *
2541 * @param {string} project - Project ID or project name
2542 * @param {number} releaseId
2543 */
2544 getReleaseTags(project, releaseId) {
2545 return __awaiter(this, void 0, void 0, function* () {
2546 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2547 let routeValues = {
2548 project: project,
2549 releaseId: releaseId
2550 };
2551 try {
2552 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "c5b602b6-d1b3-4363-8a51-94384f78068f", routeValues);
2553 let url = verData.requestUrl;
2554 let options = this.createRequestOptions('application/json', verData.apiVersion);
2555 let res;
2556 res = yield this.rest.get(url, options);
2557 let ret = this.formatResponse(res.result, null, true);
2558 resolve(ret);
2559 }
2560 catch (err) {
2561 reject(err);
2562 }
2563 }));
2564 });
2565 }
2566 /**
2567 * @param {string} project - Project ID or project name
2568 */
2569 getTags(project) {
2570 return __awaiter(this, void 0, void 0, function* () {
2571 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2572 let routeValues = {
2573 project: project
2574 };
2575 try {
2576 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "86cee25a-68ba-4ba3-9171-8ad6ffc6df93", routeValues);
2577 let url = verData.requestUrl;
2578 let options = this.createRequestOptions('application/json', verData.apiVersion);
2579 let res;
2580 res = yield this.rest.get(url, options);
2581 let ret = this.formatResponse(res.result, null, true);
2582 resolve(ret);
2583 }
2584 catch (err) {
2585 reject(err);
2586 }
2587 }));
2588 });
2589 }
2590 /**
2591 * @param {string} project - Project ID or project name
2592 * @param {number} releaseId
2593 * @param {number} environmentId
2594 * @param {number} releaseDeployPhaseId
2595 */
2596 getTasksForTaskGroup(project, releaseId, environmentId, releaseDeployPhaseId) {
2597 return __awaiter(this, void 0, void 0, function* () {
2598 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2599 let routeValues = {
2600 project: project,
2601 releaseId: releaseId,
2602 environmentId: environmentId,
2603 releaseDeployPhaseId: releaseDeployPhaseId
2604 };
2605 try {
2606 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Release", "4259191d-4b0a-4409-9fb3-09f22ab9bc47", routeValues);
2607 let url = verData.requestUrl;
2608 let options = this.createRequestOptions('application/json', verData.apiVersion);
2609 let res;
2610 res = yield this.rest.get(url, options);
2611 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseTask, true);
2612 resolve(ret);
2613 }
2614 catch (err) {
2615 reject(err);
2616 }
2617 }));
2618 });
2619 }
2620 /**
2621 * @param {string} project - Project ID or project name
2622 * @param {number} releaseId
2623 * @param {number} environmentId
2624 * @param {number} attemptId
2625 * @param {string} timelineId
2626 */
2627 getTasks2(project, releaseId, environmentId, attemptId, timelineId) {
2628 return __awaiter(this, void 0, void 0, function* () {
2629 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2630 let routeValues = {
2631 project: project,
2632 releaseId: releaseId,
2633 environmentId: environmentId,
2634 attemptId: attemptId,
2635 timelineId: timelineId
2636 };
2637 try {
2638 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Release", "4259291d-4b0a-4409-9fb3-04f22ab9bc47", routeValues);
2639 let url = verData.requestUrl;
2640 let options = this.createRequestOptions('application/json', verData.apiVersion);
2641 let res;
2642 res = yield this.rest.get(url, options);
2643 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseTask, true);
2644 resolve(ret);
2645 }
2646 catch (err) {
2647 reject(err);
2648 }
2649 }));
2650 });
2651 }
2652 /**
2653 * @param {string} project - Project ID or project name
2654 * @param {number} releaseId
2655 * @param {number} environmentId
2656 * @param {number} attemptId
2657 */
2658 getTasks(project, releaseId, environmentId, attemptId) {
2659 return __awaiter(this, void 0, void 0, function* () {
2660 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2661 let routeValues = {
2662 project: project,
2663 releaseId: releaseId,
2664 environmentId: environmentId
2665 };
2666 let queryValues = {
2667 attemptId: attemptId,
2668 };
2669 try {
2670 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Release", "36b276e0-3c70-4320-a63c-1a2e1466a0d1", 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, ReleaseInterfaces.TypeInfo.ReleaseTask, true);
2676 resolve(ret);
2677 }
2678 catch (err) {
2679 reject(err);
2680 }
2681 }));
2682 });
2683 }
2684 /**
2685 * @param {string} project - Project ID or project name
2686 */
2687 getArtifactTypeDefinitions(project) {
2688 return __awaiter(this, void 0, void 0, function* () {
2689 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2690 let routeValues = {
2691 project: project
2692 };
2693 try {
2694 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "8efc2a3c-1fc8-4f6d-9822-75e98cecb48f", routeValues);
2695 let url = verData.requestUrl;
2696 let options = this.createRequestOptions('application/json', verData.apiVersion);
2697 let res;
2698 res = yield this.rest.get(url, options);
2699 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ArtifactTypeDefinition, true);
2700 resolve(ret);
2701 }
2702 catch (err) {
2703 reject(err);
2704 }
2705 }));
2706 });
2707 }
2708 /**
2709 * @param {string} project - Project ID or project name
2710 * @param {number} releaseDefinitionId
2711 */
2712 getArtifactVersions(project, releaseDefinitionId) {
2713 return __awaiter(this, void 0, void 0, function* () {
2714 if (releaseDefinitionId == null) {
2715 throw new TypeError('releaseDefinitionId can not be null or undefined');
2716 }
2717 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2718 let routeValues = {
2719 project: project
2720 };
2721 let queryValues = {
2722 releaseDefinitionId: releaseDefinitionId,
2723 };
2724 try {
2725 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "30fc787e-a9e0-4a07-9fbc-3e903aa051d2", routeValues, queryValues);
2726 let url = verData.requestUrl;
2727 let options = this.createRequestOptions('application/json', verData.apiVersion);
2728 let res;
2729 res = yield this.rest.get(url, options);
2730 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ArtifactVersionQueryResult, false);
2731 resolve(ret);
2732 }
2733 catch (err) {
2734 reject(err);
2735 }
2736 }));
2737 });
2738 }
2739 /**
2740 * @param {ReleaseInterfaces.Artifact[]} artifacts
2741 * @param {string} project - Project ID or project name
2742 */
2743 getArtifactVersionsForSources(artifacts, project) {
2744 return __awaiter(this, void 0, void 0, function* () {
2745 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2746 let routeValues = {
2747 project: project
2748 };
2749 try {
2750 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "30fc787e-a9e0-4a07-9fbc-3e903aa051d2", routeValues);
2751 let url = verData.requestUrl;
2752 let options = this.createRequestOptions('application/json', verData.apiVersion);
2753 let res;
2754 res = yield this.rest.create(url, artifacts, options);
2755 let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ArtifactVersionQueryResult, false);
2756 resolve(ret);
2757 }
2758 catch (err) {
2759 reject(err);
2760 }
2761 }));
2762 });
2763 }
2764 /**
2765 * @param {string} project - Project ID or project name
2766 * @param {number} releaseId
2767 * @param {number} baseReleaseId
2768 * @param {number} top
2769 * @param {string} artifactAlias
2770 */
2771 getReleaseWorkItemsRefs(project, releaseId, baseReleaseId, top, artifactAlias) {
2772 return __awaiter(this, void 0, void 0, function* () {
2773 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2774 let routeValues = {
2775 project: project,
2776 releaseId: releaseId
2777 };
2778 let queryValues = {
2779 baseReleaseId: baseReleaseId,
2780 '$top': top,
2781 artifactAlias: artifactAlias,
2782 };
2783 try {
2784 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "4f165cc0-875c-4768-b148-f12f78769fab", routeValues, queryValues);
2785 let url = verData.requestUrl;
2786 let options = this.createRequestOptions('application/json', verData.apiVersion);
2787 let res;
2788 res = yield this.rest.get(url, options);
2789 let ret = this.formatResponse(res.result, null, true);
2790 resolve(ret);
2791 }
2792 catch (err) {
2793 reject(err);
2794 }
2795 }));
2796 });
2797 }
2798}
2799exports.ReleaseApi = ReleaseApi;
2800ReleaseApi.RESOURCE_AREA_ID = "efc2f575-36ef-48e9-b672-0c6fb4a48ac5";