UNPKG

azure-devops-node-api

Version:
1,047 lines 244 kB
"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.GitApi = void 0; const basem = require("./ClientApiBases"); const GitInterfaces = require("./interfaces/GitInterfaces"); class GitApi extends basem.ClientApiBase { constructor(baseUrl, handlers, options) { super(baseUrl, handlers, 'node-Git-api', options); } /** * DELETE Deletes Enablement status and BillableCommitters data from DB. Deleting the enablement data will effectively disable it for the repositories affected. * * @param {boolean} allProjects * @param {boolean} includeBillableCommitters * @param {string[]} projectIds */ deleteEnablementStatus(allProjects, includeBillableCommitters, projectIds) { return __awaiter(this, void 0, void 0, function* () { if (allProjects == null) { throw new TypeError('allProjects can not be null or undefined'); } return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = {}; let queryValues = { '$allProjects': allProjects, '$includeBillableCommitters': includeBillableCommitters, projectIds: projectIds, }; try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "b43dd56f-a1b4-47a5-a857-73fc1b6c700c", routeValues, queryValues); 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); } })); }); } /** * GET Enablement status for project's repositories. * * @param {string[]} projectIds - Null defaults to all projects in the host, list of project's repos status to return * @param {Date} billingDate - UTC expected, Null defaults to UtcNow(), can be provided for a point in time status * @param {number} skip - Skip X rows of resultset to simulate paging. * @param {number} take - Return Y rows of resultset to simulate paging. */ getEnablementStatus(projectIds, billingDate, skip, take) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = {}; let queryValues = { projectIds: projectIds, '$billingDate': billingDate, '$skip': skip, '$take': take, }; try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "b43dd56f-a1b4-47a5-a857-73fc1b6c700c", 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, GitInterfaces.TypeInfo.AdvSecEnablementStatus, true); resolve(ret); } catch (err) { reject(err); } })); }); } /** * @param {boolean} enableOnCreateHost */ getEnableOnCreateHost(enableOnCreateHost) { return __awaiter(this, void 0, void 0, function* () { if (enableOnCreateHost == null) { throw new TypeError('enableOnCreateHost can not be null or undefined'); } return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = {}; let queryValues = { '$enableOnCreateHost': enableOnCreateHost, }; try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "b43dd56f-a1b4-47a5-a857-73fc1b6c700c", 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); } })); }); } /** * @param {string} enableOnCreateProjectId */ getEnableOnCreateProject(enableOnCreateProjectId) { return __awaiter(this, void 0, void 0, function* () { if (enableOnCreateProjectId == null) { throw new TypeError('enableOnCreateProjectId can not be null or undefined'); } return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = {}; let queryValues = { '$enableOnCreateProjectId': enableOnCreateProjectId, }; try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "b43dd56f-a1b4-47a5-a857-73fc1b6c700c", 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); } })); }); } /** * @param {boolean} enableOnCreateHost */ setEnableOnCreateHost(enableOnCreateHost) { return __awaiter(this, void 0, void 0, function* () { if (enableOnCreateHost == null) { throw new TypeError('enableOnCreateHost can not be null or undefined'); } return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = {}; let queryValues = { '$enableOnCreateHost': enableOnCreateHost, }; try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "b43dd56f-a1b4-47a5-a857-73fc1b6c700c", routeValues, queryValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.replace(url, null, options); let ret = this.formatResponse(res.result, null, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * @param {string} enableOnCreateProjectId * @param {boolean} enableOnStatus */ setEnableOnCreateProject(enableOnCreateProjectId, enableOnStatus) { return __awaiter(this, void 0, void 0, function* () { if (enableOnCreateProjectId == null) { throw new TypeError('enableOnCreateProjectId can not be null or undefined'); } if (enableOnStatus == null) { throw new TypeError('enableOnStatus can not be null or undefined'); } return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = {}; let queryValues = { '$enableOnCreateProjectId': enableOnCreateProjectId, '$enableOnStatus': enableOnStatus, }; try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "b43dd56f-a1b4-47a5-a857-73fc1b6c700c", routeValues, queryValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.replace(url, null, options); let ret = this.formatResponse(res.result, null, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * POST Enablement status for repositories. * * @param {GitInterfaces.AdvSecEnablementUpdate[]} enablementUpdates */ updateEnablementStatus(enablementUpdates) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = {}; try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "b43dd56f-a1b4-47a5-a857-73fc1b6c700c", routeValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.create(url, enablementUpdates, options); let ret = this.formatResponse(res.result, null, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Get estimated billable pushers for an Organization for last 90 days. * */ getEstimatedBillablePushersOrg() { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = {}; try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "2277ffbe-28d4-40d6-9c26-40baf26d1408", 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); } })); }); } /** * Get estimated billable pushers for a project for last 90 days. * * @param {string} project - Project ID or project name */ getEstimatedBillablePushersProject(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", "git", "1df7833e-1eed-447b-81a3-390c74923900", 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); } })); }); } /** * Get estimated billable committers for a repository for the last 90 days. * * @param {string} project - Project ID or project name * @param {string} repositoryId */ getEstimatedBillableCommittersRepo(project, repositoryId) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, repositoryId: repositoryId }; try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "5dcec07b-a844-4efb-9fc1-968fd1f149db", 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); } })); }); } /** * GET Advanced Security Permission status. * * @param {string} projectName * @param {string} repositoryId - Repository user is trying to access * @param {string} permission - Permission being requestd, must be "viewAlert" "dismissAlert" "manage" "viewEnablement" or "repoRead" */ getPermission(projectName, repositoryId, permission) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = {}; let queryValues = { '$projectName': projectName, '$repositoryId': repositoryId, '$permission': permission, }; try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "61b21a05-a60f-4910-a733-ba5347c2142d", 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); } })); }); } /** * Create an annotated tag. * * @param {GitInterfaces.GitAnnotatedTag} tagObject - Object containing details of tag to be created. * @param {string} project - Project ID or project name * @param {string} repositoryId - ID or name of the repository. */ createAnnotatedTag(tagObject, project, repositoryId) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, repositoryId: repositoryId }; try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "5e8a8081-3851-4626-b677-9891cc04102e", routeValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.create(url, tagObject, options); let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitAnnotatedTag, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Get an annotated tag. * * @param {string} project - Project ID or project name * @param {string} repositoryId - ID or name of the repository. * @param {string} objectId - ObjectId (Sha1Id) of tag to get. */ getAnnotatedTag(project, repositoryId, objectId) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, repositoryId: repositoryId, objectId: objectId }; try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "5e8a8081-3851-4626-b677-9891cc04102e", 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, GitInterfaces.TypeInfo.GitAnnotatedTag, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Retrieve actual billable committers for Advanced Security service for a given date. * * @param {string} project - Project ID or project name * @param {Date} billingDate - UTC expected. If not specified defaults to the previous billing day. * @param {number} skip - Skip X rows of resultset to simulate paging. * @param {number} take - Return Y rows of resultset to simulate paging. */ getBillableCommitters(project, billingDate, skip, take) { 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 = { '$billingDate': billingDate, '$skip': skip, '$take': take, }; try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "5c5e3ebc-37b0-4547-a957-945912d44922", 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); } })); }); } /** * Retrieve detailed actual billable committers for Advanced Security service for a given date. Detailed results intentionally does not filter out soft deleted projects and repositories to help diagnose billing issues. * * @param {string} project - Project ID or project name * @param {string} includeDetails - Return all the details on the billable committers. * @param {Date} billingDate - UTC expected. If not specified defaults to the previous billing day. */ getBillableCommittersDetail(project, includeDetails, billingDate) { return __awaiter(this, void 0, void 0, function* () { if (includeDetails == null) { throw new TypeError('includeDetails can not be null or undefined'); } return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project }; let queryValues = { '$includeDetails': includeDetails, '$billingDate': billingDate, }; try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "5c5e3ebc-37b0-4547-a957-945912d44922", 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, GitInterfaces.TypeInfo.BillableCommitterDetail, true); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Get a single blob. * * @param {string} repositoryId - The name or ID of the repository. * @param {string} sha1 - SHA1 hash of the file. You can get the SHA1 of a file using the "Git/Items/Get Item" endpoint. * @param {string} project - Project ID or project name * @param {boolean} download - If true, prompt for a download rather than rendering in a browser. Note: this value defaults to true if $format is zip * @param {string} fileName - Provide a fileName to use for a download. * @param {boolean} resolveLfs - If true, try to resolve a blob to its LFS contents, if it's an LFS pointer file. Only compatible with octet-stream Accept headers or $format types */ getBlob(repositoryId, sha1, project, download, fileName, resolveLfs) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, repositoryId: repositoryId, sha1: sha1 }; let queryValues = { download: download, fileName: fileName, resolveLfs: resolveLfs, }; try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "7b28e929-2c99-405d-9c5c-6167a06e6816", 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); } })); }); } /** * Get a single blob. * * @param {string} repositoryId - The name or ID of the repository. * @param {string} sha1 - SHA1 hash of the file. You can get the SHA1 of a file using the "Git/Items/Get Item" endpoint. * @param {string} project - Project ID or project name * @param {boolean} download - If true, prompt for a download rather than rendering in a browser. Note: this value defaults to true if $format is zip * @param {string} fileName - Provide a fileName to use for a download. * @param {boolean} resolveLfs - If true, try to resolve a blob to its LFS contents, if it's an LFS pointer file. Only compatible with octet-stream Accept headers or $format types */ getBlobContent(repositoryId, sha1, project, download, fileName, resolveLfs) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, repositoryId: repositoryId, sha1: sha1 }; let queryValues = { download: download, fileName: fileName, resolveLfs: resolveLfs, }; try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "7b28e929-2c99-405d-9c5c-6167a06e6816", 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 one or more blobs in a zip file download. * * @param {string[]} blobIds - Blob IDs (SHA1 hashes) to be returned in the zip file. * @param {string} repositoryId - The name or ID of the repository. * @param {string} project - Project ID or project name * @param {string} filename */ getBlobsZip(blobIds, repositoryId, project, filename) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, repositoryId: repositoryId }; let queryValues = { filename: filename, }; try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "7b28e929-2c99-405d-9c5c-6167a06e6816", 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); } })); }); } /** * Get a single blob. * * @param {string} repositoryId - The name or ID of the repository. * @param {string} sha1 - SHA1 hash of the file. You can get the SHA1 of a file using the "Git/Items/Get Item" endpoint. * @param {string} project - Project ID or project name * @param {boolean} download - If true, prompt for a download rather than rendering in a browser. Note: this value defaults to true if $format is zip * @param {string} fileName - Provide a fileName to use for a download. * @param {boolean} resolveLfs - If true, try to resolve a blob to its LFS contents, if it's an LFS pointer file. Only compatible with octet-stream Accept headers or $format types */ getBlobZip(repositoryId, sha1, project, download, fileName, resolveLfs) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, repositoryId: repositoryId, sha1: sha1 }; let queryValues = { download: download, fileName: fileName, resolveLfs: resolveLfs, }; try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "7b28e929-2c99-405d-9c5c-6167a06e6816", 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); } })); }); } /** * Retrieve statistics about a single branch. * * @param {string} repositoryId - The name or ID of the repository. * @param {string} name - Name of the branch. * @param {string} project - Project ID or project name * @param {GitInterfaces.GitVersionDescriptor} baseVersionDescriptor - Identifies the commit or branch to use as the base. */ getBranch(repositoryId, name, project, baseVersionDescriptor) { return __awaiter(this, void 0, void 0, function* () { if (name == null) { throw new TypeError('name can not be null or undefined'); } return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, repositoryId: repositoryId }; let queryValues = { name: name, baseVersionDescriptor: baseVersionDescriptor, }; try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "d5b216de-d8d5-4d32-ae76-51df755b16d3", 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, GitInterfaces.TypeInfo.GitBranchStats, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Retrieve statistics about all branches within a repository. * * @param {string} repositoryId - The name or ID of the repository. * @param {string} project - Project ID or project name * @param {GitInterfaces.GitVersionDescriptor} baseVersionDescriptor - Identifies the commit or branch to use as the base. */ getBranches(repositoryId, project, baseVersionDescriptor) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, repositoryId: repositoryId }; let queryValues = { baseVersionDescriptor: baseVersionDescriptor, }; try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "d5b216de-d8d5-4d32-ae76-51df755b16d3", 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, GitInterfaces.TypeInfo.GitBranchStats, true); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Retrieve statistics for multiple commits * * @param {GitInterfaces.GitQueryBranchStatsCriteria} searchCriteria - Base Commit and List of Target Commits to compare. * @param {string} repositoryId - The name or ID of the repository. * @param {string} project - Project ID or project name */ getBranchStatsBatch(searchCriteria, repositoryId, 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, repositoryId: repositoryId }; try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "d5b216de-d8d5-4d32-ae76-51df755b16d3", routeValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.create(url, searchCriteria, options); let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitBranchStats, true); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Retrieve changes for a particular commit. * * @param {string} commitId - The id of the commit. * @param {string} repositoryId - The id or friendly name of the repository. To use the friendly name, projectId must also be specified. * @param {string} project - Project ID or project name * @param {number} top - The maximum number of changes to return. * @param {number} skip - The number of changes to skip. */ getChanges(commitId, repositoryId, project, top, skip) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, commitId: commitId, repositoryId: repositoryId }; let queryValues = { top: top, skip: skip, }; try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "5bf884f5-3e07-42e9-afb8-1b872267bf16", 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, GitInterfaces.TypeInfo.GitCommitChanges, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Retrieve one conflict for a cherry pick by ID * * @param {string} repositoryId * @param {number} cherryPickId * @param {number} conflictId * @param {string} project - Project ID or project name */ getCherryPickConflict(repositoryId, cherryPickId, conflictId, 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, repositoryId: repositoryId, cherryPickId: cherryPickId, conflictId: conflictId }; try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "1fe5aab2-d4c0-4b2f-a030-f3831e7aca26", 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, GitInterfaces.TypeInfo.GitConflict, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Retrieve all conflicts for a cherry pick * * @param {string} repositoryId * @param {number} cherryPickId * @param {string} project - Project ID or project name * @param {string} continuationToken * @param {number} top * @param {boolean} excludeResolved * @param {boolean} onlyResolved * @param {boolean} includeObsolete */ getCherryPickConflicts(repositoryId, cherryPickId, project, continuationToken, top, excludeResolved, onlyResolved, includeObsolete) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, repositoryId: repositoryId, cherryPickId: cherryPickId }; let queryValues = { continuationToken: continuationToken, '$top': top, excludeResolved: excludeResolved, onlyResolved: onlyResolved, includeObsolete: includeObsolete, }; try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "1fe5aab2-d4c0-4b2f-a030-f3831e7aca26", 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, GitInterfaces.TypeInfo.GitConflict, true); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Update merge conflict resolution * * @param {GitInterfaces.GitConflict} conflict * @param {string} repositoryId * @param {number} cherryPickId * @param {number} conflictId * @param {string} project - Project ID or project name */ updateCherryPickConflict(conflict, repositoryId, cherryPickId, conflictId, 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, repositoryId: repositoryId, cherryPickId: cherryPickId, conflictId: conflictId }; try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "1fe5aab2-d4c0-4b2f-a030-f3831e7aca26", routeValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.update(url, conflict, options); let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitConflict, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Update multiple merge conflict resolutions * * @param {GitInterfaces.GitConflict[]} conflictUpdates * @param {string} repositoryId * @param {number} cherryPickId * @param {string} project - Project ID or project name */ updateCherryPickConflicts(conflictUpdates, repositoryId, cherryPickId, 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, repositoryId: repositoryId, cherryPickId: cherryPickId }; try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "1fe5aab2-d4c0-4b2f-a030-f3831e7aca26", routeValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.update(url, conflictUpdates, options); let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitConflictUpdateResult, true); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Given a commitId, returns a list of commits that are in the same cherry-pick family. * * @param {string} repositoryNameOrId * @param {string} commitId * @param {string} project - Project ID or project name * @param {boolean} includeLinks */ getCherryPickRelationships(repositoryNameOrId, commitId, project, includeLinks) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, repositoryNameOrId: repositoryNameOrId, commitId: commitId }; let queryValues = { includeLinks: includeLinks, }; try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "8af142a4-27c2-4168-9e82-46b8629aaa0d", 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, GitInterfaces.TypeInfo.GitCommitRef, true); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Cherry pick a specific commit or commits that are associated to a pull request into a new branch. * * @param {GitInterfaces.GitAsyncRefOperationParameters} cherryPickToCreate * @param {string} project - Project ID or project name * @param {string} repositoryId - ID of the repository. */ createCherryPick(cherryPickToCreate, project, repositoryId) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, repositoryId: repositoryId }; try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "033bad68-9a14-43d1-90e0-59cb8856fef6", routeValues); let url = verData.requestUrl; let options = this.createRequestOptions('application/json', verData.apiVersion); let res; res = yield this.rest.create(url, cherryPickToCreate, options); let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitCherryPick, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Retrieve information about a cherry pick operation by cherry pick Id. * * @param {string} project - Project ID or project name * @param {number} cherryPickId - ID of the cherry pick. * @param {string} repositoryId - ID of the repository. */ getCherryPick(project, cherryPickId, repositoryId) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, cherryPickId: cherryPickId, repositoryId: repositoryId }; try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "033bad68-9a14-43d1-90e0-59cb8856fef6", 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, GitInterfaces.TypeInfo.GitCherryPick, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Retrieve information about a cherry pick operation for a specific branch. This operation is expensive due to the underlying object structure, so this API only looks at the 1000 most recent cherry pick operations. * * @param {string} project - Project ID or project name * @param {string} repositoryId - ID of the repository. * @param {string} refName - The GitAsyncRefOperationParameters generatedRefName used for the cherry pick operation. */ getCherryPickForRefName(project, repositoryId, refName) { return __awaiter(this, void 0, void 0, function* () { if (refName == null) { throw new TypeError('refName can not be null or undefined'); } return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, repositoryId: repositoryId }; let queryValues = { refName: refName, }; try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "033bad68-9a14-43d1-90e0-59cb8856fef6", 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, GitInterfaces.TypeInfo.GitCherryPick, false); resolve(ret); } catch (err) { reject(err); } })); }); } /** * Find the closest common commit (the merge base) between base and target commits, and get the diff between either the base and target commits or common and target commits. * * @param {string} repositoryId - The name or ID of the repository. * @param {string} project - Project ID or project name * @param {boolean} diffCommonCommit - If true, diff between common and target commits. If false, diff between base and target commits. * @param {number} top - Maximum number of changes to return. Defaults to 100. * @param {number} skip - Number of changes to skip * @param {GitInterfaces.GitBaseVersionDescriptor} baseVersionDescriptor - Descriptor for base commit. * @param {GitInterfaces.GitTargetVersionDescriptor} targetVersionDescriptor - Descriptor for target commit. */ getCommitDiffs(repositoryId, project, diffCommonCommit, top, skip, baseVersionDescriptor, targetVersionDescriptor) { return __awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { let routeValues = { project: project, repositoryId: repositoryId }; let queryValues = { diffCommonCommit: diffCommonCommit, '$top': top, '$skip': skip, }; if (baseVersionDescriptor) { queryValues.baseVersionType = baseVersionDescriptor.versionType; queryValues.baseVersion = baseVersionDescriptor.version; queryValues.baseVersionOptions = baseVersionDescriptor.versionOptions; } if (targetVersionDescriptor) { queryValues.targetVersionType = targetVersionDescriptor.versionType; queryValues.targetVersion = targetVersionDescriptor.version; queryValues.targetVersionOptions = targetVersionDescriptor.versionOptions; } try { let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "615588d5-c0c7-4b88-88f8-e625306446e8", routeValues, que