azure-devops-node-api
Version:
Node client for Azure DevOps and TFS REST APIs
1,034 lines • 147 kB
JavaScript
"use strict";
/*
* ---------------------------------------------------------
* Copyright(C) Microsoft Corporation. All rights reserved.
* ---------------------------------------------------------
*
* ---------------------------------------------------------
* Generated file, DO NOT EDIT
* ---------------------------------------------------------
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BuildApi = void 0;
const basem = require("./ClientApiBases");
const BuildInterfaces = require("./interfaces/BuildInterfaces");
class BuildApi extends basem.ClientApiBase {
constructor(baseUrl, handlers, options) {
super(baseUrl, handlers, 'node-Build-api', options);
}
/**
* Associates an artifact with a build.
*
* @param {BuildInterfaces.BuildArtifact} artifact - The artifact.
* @param {string} project - Project ID or project name
* @param {number} buildId - The ID of the build.
*/
createArtifact(artifact, project, buildId) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let routeValues = {
project: project,
buildId: buildId
};
try {
let verData = yield this.vsoClient.getVersioningData("7.2-preview.5", "build", "1db06c96-014e-44e1-ac91-90b2d4b3e984", routeValues);
let url = verData.requestUrl;
let options = this.createRequestOptions('application/json', verData.apiVersion);
let res;
res = yield this.rest.create(url, artifact, options);
let ret = this.formatResponse(res.result, null, false);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Gets a specific artifact for a build.
*
* @param {string} project - Project ID or project name
* @param {number} buildId - The ID of the build.
* @param {string} artifactName - The name of the artifact.
*/
getArtifact(project, buildId, artifactName) {
return __awaiter(this, void 0, void 0, function* () {
if (artifactName == null) {
throw new TypeError('artifactName can not be null or undefined');
}
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let routeValues = {
project: project,
buildId: buildId
};
let queryValues = {
artifactName: artifactName,
};
try {
let verData = yield this.vsoClient.getVersioningData("7.2-preview.5", "build", "1db06c96-014e-44e1-ac91-90b2d4b3e984", routeValues, queryValues);
let url = verData.requestUrl;
let options = this.createRequestOptions('application/json', verData.apiVersion);
let res;
res = yield this.rest.get(url, options);
let ret = this.formatResponse(res.result, null, false);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Gets a specific artifact for a build.
*
* @param {string} project - Project ID or project name
* @param {number} buildId - The ID of the build.
* @param {string} artifactName - The name of the artifact.
*/
getArtifactContentZip(project, buildId, artifactName) {
return __awaiter(this, void 0, void 0, function* () {
if (artifactName == null) {
throw new TypeError('artifactName can not be null or undefined');
}
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let routeValues = {
project: project,
buildId: buildId
};
let queryValues = {
artifactName: artifactName,
};
try {
let verData = yield this.vsoClient.getVersioningData("7.2-preview.5", "build", "1db06c96-014e-44e1-ac91-90b2d4b3e984", routeValues, queryValues);
let url = verData.requestUrl;
let apiVersion = verData.apiVersion;
let accept = this.createAcceptHeader("application/zip", apiVersion);
resolve((yield this.http.get(url, { "Accept": accept })).message);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Gets all artifacts for a build.
*
* @param {string} project - Project ID or project name
* @param {number} buildId - The ID of the build.
*/
getArtifacts(project, buildId) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let routeValues = {
project: project,
buildId: buildId
};
try {
let verData = yield this.vsoClient.getVersioningData("7.2-preview.5", "build", "1db06c96-014e-44e1-ac91-90b2d4b3e984", routeValues);
let url = verData.requestUrl;
let options = this.createRequestOptions('application/json', verData.apiVersion);
let res;
res = yield this.rest.get(url, options);
let ret = this.formatResponse(res.result, null, true);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Gets a file from the build.
*
* @param {string} project - Project ID or project name
* @param {number} buildId - The ID of the build.
* @param {string} artifactName - The name of the artifact.
* @param {string} fileId - The primary key for the file.
* @param {string} fileName - The name that the file will be set to.
*/
getFile(project, buildId, artifactName, fileId, fileName) {
return __awaiter(this, void 0, void 0, function* () {
if (artifactName == null) {
throw new TypeError('artifactName can not be null or undefined');
}
if (fileId == null) {
throw new TypeError('fileId can not be null or undefined');
}
if (fileName == null) {
throw new TypeError('fileName can not be null or undefined');
}
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let routeValues = {
project: project,
buildId: buildId
};
let queryValues = {
artifactName: artifactName,
fileId: fileId,
fileName: fileName,
};
try {
let verData = yield this.vsoClient.getVersioningData("7.2-preview.5", "build", "1db06c96-014e-44e1-ac91-90b2d4b3e984", routeValues, queryValues);
let url = verData.requestUrl;
let apiVersion = verData.apiVersion;
let accept = this.createAcceptHeader("application/octet-stream", apiVersion);
resolve((yield this.http.get(url, { "Accept": accept })).message);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Gets the list of attachments of a specific type that are associated with a build.
*
* @param {string} project - Project ID or project name
* @param {number} buildId - The ID of the build.
* @param {string} type - The type of attachment.
*/
getAttachments(project, buildId, type) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let routeValues = {
project: project,
buildId: buildId,
type: type
};
try {
let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "f2192269-89fa-4f94-baf6-8fb128c55159", routeValues);
let url = verData.requestUrl;
let options = this.createRequestOptions('application/json', verData.apiVersion);
let res;
res = yield this.rest.get(url, options);
let ret = this.formatResponse(res.result, null, true);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Gets a specific attachment.
*
* @param {string} project - Project ID or project name
* @param {number} buildId - The ID of the build.
* @param {string} timelineId - The ID of the timeline.
* @param {string} recordId - The ID of the timeline record.
* @param {string} type - The type of the attachment.
* @param {string} name - The name of the attachment.
*/
getAttachment(project, buildId, timelineId, recordId, type, name) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let routeValues = {
project: project,
buildId: buildId,
timelineId: timelineId,
recordId: recordId,
type: type,
name: name
};
try {
let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "af5122d3-3438-485e-a25a-2dbbfde84ee6", routeValues);
let url = verData.requestUrl;
let apiVersion = verData.apiVersion;
let accept = this.createAcceptHeader("application/octet-stream", apiVersion);
resolve((yield this.http.get(url, { "Accept": accept })).message);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* @param {BuildInterfaces.DefinitionResourceReference[]} resources
* @param {string} project - Project ID or project name
*/
authorizeProjectResources(resources, project) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let routeValues = {
project: project
};
try {
let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "398c85bc-81aa-4822-947c-a194a05f0fef", routeValues);
let url = verData.requestUrl;
let options = this.createRequestOptions('application/json', verData.apiVersion);
let res;
res = yield this.rest.update(url, resources, options);
let ret = this.formatResponse(res.result, null, true);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* @param {string} project - Project ID or project name
* @param {string} type
* @param {string} id
*/
getProjectResources(project, type, id) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let routeValues = {
project: project
};
let queryValues = {
type: type,
id: id,
};
try {
let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "398c85bc-81aa-4822-947c-a194a05f0fef", routeValues, queryValues);
let url = verData.requestUrl;
let options = this.createRequestOptions('application/json', verData.apiVersion);
let res;
res = yield this.rest.get(url, options);
let ret = this.formatResponse(res.result, null, true);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Gets a badge that indicates the status of the most recent build for a definition. Note that this API is deprecated. Prefer StatusBadgeController.GetStatusBadge.
*
* @param {string} project - The project ID or name.
* @param {number} definitionId - The ID of the definition.
* @param {string} branchName - The name of the branch.
*/
getBadge(project, definitionId, branchName) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let routeValues = {
project: project,
definitionId: definitionId
};
let queryValues = {
branchName: branchName,
};
try {
let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "de6a4df8-22cd-44ee-af2d-39f6aa7a4261", routeValues, queryValues);
let url = verData.requestUrl;
let options = this.createRequestOptions('application/json', verData.apiVersion);
let res;
res = yield this.rest.get(url, options);
let ret = this.formatResponse(res.result, null, false);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Gets a list of branches for the given source code repository.
*
* @param {string} project - Project ID or project name
* @param {string} providerName - The name of the source provider.
* @param {string} serviceEndpointId - If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit.
* @param {string} repository - The vendor-specific identifier or the name of the repository to get branches. Can only be omitted for providers that do not support multiple repositories.
* @param {string} branchName - If supplied, the name of the branch to check for specifically.
*/
listBranches(project, providerName, serviceEndpointId, repository, branchName) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let routeValues = {
project: project,
providerName: providerName
};
let queryValues = {
serviceEndpointId: serviceEndpointId,
repository: repository,
branchName: branchName,
};
try {
let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "e05d4403-9b81-4244-8763-20fde28d1976", routeValues, queryValues);
let url = verData.requestUrl;
let options = this.createRequestOptions('application/json', verData.apiVersion);
let res;
res = yield this.rest.get(url, options);
let ret = this.formatResponse(res.result, null, true);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Gets a badge that indicates the status of the most recent build for the specified branch.
*
* @param {string} project - Project ID or project name
* @param {string} repoType - The repository type.
* @param {string} repoId - The repository ID.
* @param {string} branchName - The branch name.
*/
getBuildBadge(project, repoType, repoId, branchName) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let routeValues = {
project: project,
repoType: repoType
};
let queryValues = {
repoId: repoId,
branchName: branchName,
};
try {
let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "21b3b9ce-fad5-4567-9ad0-80679794e003", routeValues, queryValues);
let url = verData.requestUrl;
let options = this.createRequestOptions('application/json', verData.apiVersion);
let res;
res = yield this.rest.get(url, options);
let ret = this.formatResponse(res.result, null, false);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Gets a badge that indicates the status of the most recent build for the specified branch.
*
* @param {string} project - Project ID or project name
* @param {string} repoType - The repository type.
* @param {string} repoId - The repository ID.
* @param {string} branchName - The branch name.
*/
getBuildBadgeData(project, repoType, repoId, branchName) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let routeValues = {
project: project,
repoType: repoType
};
let queryValues = {
repoId: repoId,
branchName: branchName,
};
try {
let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "21b3b9ce-fad5-4567-9ad0-80679794e003", routeValues, queryValues);
let url = verData.requestUrl;
let options = this.createRequestOptions('application/json', verData.apiVersion);
let res;
res = yield this.rest.get(url, options);
let ret = this.formatResponse(res.result, null, false);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Gets all retention leases that apply to a specific build.
*
* @param {string} project - Project ID or project name
* @param {number} buildId - The ID of the build.
*/
getRetentionLeasesForBuild(project, buildId) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let routeValues = {
project: project,
buildId: buildId
};
try {
let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "3da19a6a-f088-45c4-83ce-2ad3a87be6c4", routeValues);
let url = verData.requestUrl;
let options = this.createRequestOptions('application/json', verData.apiVersion);
let res;
res = yield this.rest.get(url, options);
let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.RetentionLease, true);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Deletes a build.
*
* @param {string} project - Project ID or project name
* @param {number} buildId - The ID of the build.
*/
deleteBuild(project, buildId) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let routeValues = {
project: project,
buildId: buildId
};
try {
let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "0cd358e1-9217-4d94-8269-1c1ee6f93dcf", routeValues);
let url = verData.requestUrl;
let options = this.createRequestOptions('application/json', verData.apiVersion);
let res;
res = yield this.rest.del(url, options);
let ret = this.formatResponse(res.result, null, false);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Gets a build
*
* @param {string} project - Project ID or project name
* @param {number} buildId
* @param {string} propertyFilters
*/
getBuild(project, buildId, propertyFilters) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let routeValues = {
project: project,
buildId: buildId
};
let queryValues = {
propertyFilters: propertyFilters,
};
try {
let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "0cd358e1-9217-4d94-8269-1c1ee6f93dcf", routeValues, queryValues);
let url = verData.requestUrl;
let options = this.createRequestOptions('application/json', verData.apiVersion);
let res;
res = yield this.rest.get(url, options);
let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Build, false);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Gets a list of builds.
*
* @param {string} project - Project ID or project name
* @param {number[]} definitions - A comma-delimited list of definition IDs. If specified, filters to builds for these definitions.
* @param {number[]} queues - A comma-delimited list of queue IDs. If specified, filters to builds that ran against these queues.
* @param {string} buildNumber - If specified, filters to builds that match this build number. Append * to do a prefix search.
* @param {Date} minTime - If specified, filters to builds that finished/started/queued after this date based on the queryOrder specified.
* @param {Date} maxTime - If specified, filters to builds that finished/started/queued before this date based on the queryOrder specified.
* @param {string} requestedFor - If specified, filters to builds requested for the specified user.
* @param {BuildInterfaces.BuildReason} reasonFilter - If specified, filters to builds that match this reason.
* @param {BuildInterfaces.BuildStatus} statusFilter - If specified, filters to builds that match this status.
* @param {BuildInterfaces.BuildResult} resultFilter - If specified, filters to builds that match this result.
* @param {string[]} tagFilters - A comma-delimited list of tags. If specified, filters to builds that have the specified tags.
* @param {string[]} properties - A comma-delimited list of properties to retrieve.
* @param {number} top - The maximum number of builds to return.
* @param {string} continuationToken - A continuation token, returned by a previous call to this method, that can be used to return the next set of builds.
* @param {number} maxBuildsPerDefinition - The maximum number of builds to return per definition.
* @param {BuildInterfaces.QueryDeletedOption} deletedFilter - Indicates whether to exclude, include, or only return deleted builds.
* @param {BuildInterfaces.BuildQueryOrder} queryOrder - The order in which builds should be returned.
* @param {string} branchName - If specified, filters to builds that built branches that built this branch.
* @param {number[]} buildIds - A comma-delimited list that specifies the IDs of builds to retrieve.
* @param {string} repositoryId - If specified, filters to builds that built from this repository.
* @param {string} repositoryType - If specified, filters to builds that built from repositories of this type.
*/
getBuilds(project, definitions, queues, buildNumber, minTime, maxTime, requestedFor, reasonFilter, statusFilter, resultFilter, tagFilters, properties, top, continuationToken, maxBuildsPerDefinition, deletedFilter, queryOrder, branchName, buildIds, repositoryId, repositoryType) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let routeValues = {
project: project
};
let queryValues = {
definitions: definitions && definitions.join(","),
queues: queues && queues.join(","),
buildNumber: buildNumber,
minTime: minTime,
maxTime: maxTime,
requestedFor: requestedFor,
reasonFilter: reasonFilter,
statusFilter: statusFilter,
resultFilter: resultFilter,
tagFilters: tagFilters && tagFilters.join(","),
properties: properties && properties.join(","),
'$top': top,
continuationToken: continuationToken,
maxBuildsPerDefinition: maxBuildsPerDefinition,
deletedFilter: deletedFilter,
queryOrder: queryOrder,
branchName: branchName,
buildIds: buildIds && buildIds.join(","),
repositoryId: repositoryId,
repositoryType: repositoryType,
};
try {
let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "0cd358e1-9217-4d94-8269-1c1ee6f93dcf", routeValues, queryValues);
let url = verData.requestUrl;
let options = this.createRequestOptions('application/json', verData.apiVersion);
let res;
res = yield this.rest.get(url, options);
let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Build, true);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Queues a build
*
* @param {BuildInterfaces.Build} build
* @param {string} project - Project ID or project name
* @param {boolean} ignoreWarnings
* @param {string} checkInTicket
* @param {number} sourceBuildId
* @param {number} definitionId - Optional definition id to queue a build without a body. Ignored if there's a valid body
*/
queueBuild(build, project, ignoreWarnings, checkInTicket, sourceBuildId, definitionId) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let routeValues = {
project: project
};
let queryValues = {
ignoreWarnings: ignoreWarnings,
checkInTicket: checkInTicket,
sourceBuildId: sourceBuildId,
definitionId: definitionId,
};
try {
let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "0cd358e1-9217-4d94-8269-1c1ee6f93dcf", routeValues, queryValues);
let url = verData.requestUrl;
let options = this.createRequestOptions('application/json', verData.apiVersion);
let res;
res = yield this.rest.create(url, build, options);
let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Build, false);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Updates a build.
*
* @param {BuildInterfaces.Build} build - The build.
* @param {string} project - Project ID or project name
* @param {number} buildId - The ID of the build.
* @param {boolean} retry
*/
updateBuild(build, project, buildId, retry) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let routeValues = {
project: project,
buildId: buildId
};
let queryValues = {
retry: retry,
};
try {
let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "0cd358e1-9217-4d94-8269-1c1ee6f93dcf", routeValues, queryValues);
let url = verData.requestUrl;
let options = this.createRequestOptions('application/json', verData.apiVersion);
let res;
res = yield this.rest.update(url, build, options);
let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Build, false);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Updates multiple builds.
*
* @param {BuildInterfaces.Build[]} builds - The builds to update.
* @param {string} project - Project ID or project name
*/
updateBuilds(builds, project) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let routeValues = {
project: project
};
try {
let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "0cd358e1-9217-4d94-8269-1c1ee6f93dcf", routeValues);
let url = verData.requestUrl;
let options = this.createRequestOptions('application/json', verData.apiVersion);
let res;
res = yield this.rest.update(url, builds, options);
let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Build, true);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Gets the changes associated with a build
*
* @param {string} project - Project ID or project name
* @param {number} buildId
* @param {string} continuationToken
* @param {number} top - The maximum number of changes to return
* @param {boolean} includeSourceChange
*/
getBuildChanges(project, buildId, continuationToken, top, includeSourceChange) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let routeValues = {
project: project,
buildId: buildId
};
let queryValues = {
continuationToken: continuationToken,
'$top': top,
includeSourceChange: includeSourceChange,
};
try {
let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "54572c7b-bbd3-45d4-80dc-28be08941620", routeValues, queryValues);
let url = verData.requestUrl;
let options = this.createRequestOptions('application/json', verData.apiVersion);
let res;
res = yield this.rest.get(url, options);
let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Change, true);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Gets the changes made to the repository between two given builds.
*
* @param {string} project - Project ID or project name
* @param {number} fromBuildId - The ID of the first build.
* @param {number} toBuildId - The ID of the last build.
* @param {number} top - The maximum number of changes to return.
*/
getChangesBetweenBuilds(project, fromBuildId, toBuildId, top) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let routeValues = {
project: project
};
let queryValues = {
fromBuildId: fromBuildId,
toBuildId: toBuildId,
'$top': top,
};
try {
let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "f10f0ea5-18a1-43ec-a8fb-2042c7be9b43", routeValues, queryValues);
let url = verData.requestUrl;
let options = this.createRequestOptions('application/json', verData.apiVersion);
let res;
res = yield this.rest.get(url, options);
let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Change, true);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Gets a controller
*
* @param {number} controllerId
*/
getBuildController(controllerId) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let routeValues = {
controllerId: controllerId
};
try {
let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "fcac1932-2ee1-437f-9b6f-7f696be858f6", routeValues);
let url = verData.requestUrl;
let options = this.createRequestOptions('application/json', verData.apiVersion);
let res;
res = yield this.rest.get(url, options);
let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildController, false);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Gets controller, optionally filtered by name
*
* @param {string} name
*/
getBuildControllers(name) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let routeValues = {};
let queryValues = {
name: name,
};
try {
let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "fcac1932-2ee1-437f-9b6f-7f696be858f6", routeValues, queryValues);
let url = verData.requestUrl;
let options = this.createRequestOptions('application/json', verData.apiVersion);
let res;
res = yield this.rest.get(url, options);
let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildController, true);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Creates a new definition.
*
* @param {BuildInterfaces.BuildDefinition} definition - The definition.
* @param {string} project - Project ID or project name
* @param {number} definitionToCloneId
* @param {number} definitionToCloneRevision
*/
createDefinition(definition, project, definitionToCloneId, definitionToCloneRevision) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let routeValues = {
project: project
};
let queryValues = {
definitionToCloneId: definitionToCloneId,
definitionToCloneRevision: definitionToCloneRevision,
};
try {
let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "dbeaf647-6167-421a-bda9-c9327b25e2e6", routeValues, queryValues);
let url = verData.requestUrl;
let options = this.createRequestOptions('application/json', verData.apiVersion);
let res;
res = yield this.rest.create(url, definition, options);
let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildDefinition, false);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Deletes a definition and all associated builds.
*
* @param {string} project - Project ID or project name
* @param {number} definitionId - The ID of the definition.
*/
deleteDefinition(project, definitionId) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let routeValues = {
project: project,
definitionId: definitionId
};
try {
let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "dbeaf647-6167-421a-bda9-c9327b25e2e6", routeValues);
let url = verData.requestUrl;
let options = this.createRequestOptions('application/json', verData.apiVersion);
let res;
res = yield this.rest.del(url, options);
let ret = this.formatResponse(res.result, null, false);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Gets a definition, optionally at a specific revision.
*
* @param {string} project - Project ID or project name
* @param {number} definitionId - The ID of the definition.
* @param {number} revision - The revision number to retrieve. If this is not specified, the latest version will be returned.
* @param {Date} minMetricsTime - If specified, indicates the date from which metrics should be included.
* @param {string[]} propertyFilters - A comma-delimited list of properties to include in the results.
* @param {boolean} includeLatestBuilds
*/
getDefinition(project, definitionId, revision, minMetricsTime, propertyFilters, includeLatestBuilds) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let routeValues = {
project: project,
definitionId: definitionId
};
let queryValues = {
revision: revision,
minMetricsTime: minMetricsTime,
propertyFilters: propertyFilters && propertyFilters.join(","),
includeLatestBuilds: includeLatestBuilds,
};
try {
let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "dbeaf647-6167-421a-bda9-c9327b25e2e6", routeValues, queryValues);
let url = verData.requestUrl;
let options = this.createRequestOptions('application/json', verData.apiVersion);
let res;
res = yield this.rest.get(url, options);
let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildDefinition, false);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Gets a list of definitions.
*
* @param {string} project - Project ID or project name
* @param {string} name - If specified, filters to definitions whose names match this pattern.
* @param {string} repositoryId - A repository ID. If specified, filters to definitions that use this repository.
* @param {string} repositoryType - If specified, filters to definitions that have a repository of this type.
* @param {BuildInterfaces.DefinitionQueryOrder} queryOrder - Indicates the order in which definitions should be returned.
* @param {number} top - The maximum number of definitions to return.
* @param {string} continuationToken - A continuation token, returned by a previous call to this method, that can be used to return the next set of definitions.
* @param {Date} minMetricsTime - If specified, indicates the date from which metrics should be included.
* @param {number[]} definitionIds - A comma-delimited list that specifies the IDs of definitions to retrieve.
* @param {string} path - If specified, filters to definitions under this folder.
* @param {Date} builtAfter - If specified, filters to definitions that have builds after this date.
* @param {Date} notBuiltAfter - If specified, filters to definitions that do not have builds after this date.
* @param {boolean} includeAllProperties - Indicates whether the full definitions should be returned. By default, shallow representations of the definitions are returned.
* @param {boolean} includeLatestBuilds - Indicates whether to return the latest and latest completed builds for this definition.
* @param {string} taskIdFilter - If specified, filters to definitions that use the specified task.
* @param {number} processType - If specified, filters to definitions with the given process type.
* @param {string} yamlFilename - If specified, filters to YAML definitions that match the given filename. To use this filter includeAllProperties should be set to true
*/
getDefinitions(project, name, repositoryId, repositoryType, queryOrder, top, continuationToken, minMetricsTime, definitionIds, path, builtAfter, notBuiltAfter, includeAllProperties, includeLatestBuilds, taskIdFilter, processType, yamlFilename) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let routeValues = {
project: project
};
let queryValues = {
name: name,
repositoryId: repositoryId,
repositoryType: repositoryType,
queryOrder: queryOrder,
'$top': top,
continuationToken: continuationToken,
minMetricsTime: minMetricsTime,
definitionIds: definitionIds && definitionIds.join(","),
path: path,
builtAfter: builtAfter,
notBuiltAfter: notBuiltAfter,
includeAllProperties: includeAllProperties,
includeLatestBuilds: includeLatestBuilds,
taskIdFilter: taskIdFilter,
processType: processType,
yamlFilename: yamlFilename,
};
try {
let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "dbeaf647-6167-421a-bda9-c9327b25e2e6", routeValues, queryValues);
let url = verData.requestUrl;
let options = this.createRequestOptions('application/json', verData.apiVersion);
let res;
res = yield this.rest.get(url, options);
let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildDefinitionReference, true);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Restores a deleted definition
*
* @param {string} project - Project ID or project name
* @param {number} definitionId - The identifier of the definition to restore.
* @param {boolean} deleted - When false, restores a deleted definition.
*/
restoreDefinition(project, definitionId, deleted) {
return __awaiter(this, void 0, void 0, function* () {
if (deleted == null) {
throw new TypeError('deleted can not be null or undefined');
}
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let routeValues = {
project: project,
definitionId: definitionId
};
let queryValues = {
deleted: deleted,
};
try {
let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "dbeaf647-6167-421a-bda9-c9327b25e2e6", routeValues, queryValues);
let url = verData.requestUrl;
let options = this.createRequestOptions('application/json', verData.apiVersion);
let res;
res = yield this.rest.update(url, null, options);
let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildDefinition, false);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Updates an existing build definition. In order for this operation to succeed, the value of the "Revision" property of the request body must match the existing build definition's. It is recommended that you obtain the existing build definition by using GET, modify the build definition as necessary, and then submit the modified definition with PUT.
*
* @param {BuildInterfaces.BuildDefinition} definition - The new version of the definition. Its "Revision" property must match the existing definition for the update to be accepted.
* @param {string} project - Project ID or project name
* @param {number} definitionId - The ID of the definition.
* @param {number} secretsSourceDefinitionId
* @param {number} secretsSourceDefinitionRevision
*/
updateDefinition(definition, project, definitionId, secretsSourceDefinitionId, secretsSourceDefinitionRevision) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let routeValues = {
project