vso-node-api
Version:
Node client for Visual Studio Online/TFS REST APIs
1,015 lines • 188 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) {
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) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
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);
}
/**
* 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("4.1-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("4.1-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);
}
}));
});
}
/**
* 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.
*/
getBlob(repositoryId, sha1, project, download, 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,
sha1: sha1
};
let queryValues = {
download: download,
fileName: fileName,
};
try {
let verData = yield this.vsoClient.getVersioningData("4.1-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.
*/
getBlobContent(repositoryId, sha1, project, download, 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,
sha1: sha1
};
let queryValues = {
download: download,
fileName: fileName,
};
try {
let verData = yield this.vsoClient.getVersioningData("4.1-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("4.1-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.
*/
getBlobZip(repositoryId, sha1, project, download, 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,
sha1: sha1
};
let queryValues = {
download: download,
fileName: fileName,
};
try {
let verData = yield this.vsoClient.getVersioningData("4.1-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* () {
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("4.1-preview.1", "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("4.1-preview.1", "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);
}
}));
});
}
/**
* @param {GitInterfaces.GitQueryBranchStatsCriteria} searchCriteria
* @param {string} repositoryId
* @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("4.1-preview.1", "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("4.1-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);
}
}));
});
}
/**
* 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("4.1-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("4.1-preview.1", "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 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("4.1-preview.1", "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 for a specific branch.
*
* @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* () {
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("4.1-preview.1", "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);
}
}));
});
}
/**
* Retrieve 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} changeCount - The number of changes to include in the result.
*/
getCommit(commitId, repositoryId, project, changeCount) {
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 = {
changeCount: changeCount,
};
try {
let verData = yield this.vsoClient.getVersioningData("4.1-preview.1", "git", "c2570c3b-5b3f-41b8-98bf-5407bfde8d58", 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.GitCommit, false);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Retrieve git commits for a project
*
* @param {string} repositoryId - The id or friendly name of the repository. To use the friendly name, projectId must also be specified.
* @param {GitInterfaces.GitQueryCommitsCriteria} searchCriteria
* @param {string} project - Project ID or project name
* @param {number} skip
* @param {number} top
*/
getCommits(repositoryId, searchCriteria, project, skip, 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,
repositoryId: repositoryId
};
let queryValues = {
searchCriteria: searchCriteria,
'$skip': skip,
'$top': top,
};
try {
let verData = yield this.vsoClient.getVersioningData("4.1-preview.1", "git", "c2570c3b-5b3f-41b8-98bf-5407bfde8d58", 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);
}
}));
});
}
/**
* Retrieve a list of commits associated with a particular push.
*
* @param {string} repositoryId - The id or friendly name of the repository. To use the friendly name, projectId must also be specified.
* @param {number} pushId - The id of the push.
* @param {string} project - Project ID or project name
* @param {number} top - The maximum number of commits to return ("get the top x commits").
* @param {number} skip - The number of commits to skip.
* @param {boolean} includeLinks
*/
getPushCommits(repositoryId, pushId, project, top, skip, 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,
repositoryId: repositoryId
};
let queryValues = {
pushId: pushId,
top: top,
skip: skip,
includeLinks: includeLinks,
};
try {
let verData = yield this.vsoClient.getVersioningData("4.1-preview.1", "git", "c2570c3b-5b3f-41b8-98bf-5407bfde8d58", 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);
}
}));
});
}
/**
* Retrieve git commits for a project matching the search criteria
*
* @param {GitInterfaces.GitQueryCommitsCriteria} searchCriteria - Search options
* @param {string} repositoryId - The name or ID of the repository.
* @param {string} project - Project ID or project name
* @param {number} skip - Number of commits to skip.
* @param {number} top - Maximum number of commits to return.
* @param {boolean} includeStatuses - True to include additional commit status information.
*/
getCommitsBatch(searchCriteria, repositoryId, project, skip, top, includeStatuses) {
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 = {
'$skip': skip,
'$top': top,
includeStatuses: includeStatuses,
};
try {
let verData = yield this.vsoClient.getVersioningData("4.1-preview.1", "git", "6400dfb2-0bcb-462b-b992-5a57f8f1416c", routeValues, queryValues);
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.GitCommitRef, true);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Retrieve deleted git repositories.
*
* @param {string} project - Project ID or project name
*/
getDeletedRepositories(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("4.1-preview.1", "git", "2b6869c4-cb25-42b5-b7a3-0d3e6be0a11a", 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.GitDeletedRepository, true);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Retrieve all forks of a repository in the collection.
*
* @param {string} repositoryNameOrId - The name or ID of the repository.
* @param {string} collectionId - Team project collection ID.
* @param {string} project - Project ID or project name
* @param {boolean} includeLinks - True to include links.
*/
getForks(repositoryNameOrId, collectionId, 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,
collectionId: collectionId
};
let queryValues = {
includeLinks: includeLinks,
};
try {
let verData = yield this.vsoClient.getVersioningData("4.1-preview.1", "git", "158c0340-bf6f-489c-9625-d572a1480d57", 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.GitRepositoryRef, true);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Request that another repository's refs be fetched into this one.
*
* @param {GitInterfaces.GitForkSyncRequestParameters} syncParams - Source repository and ref mapping.
* @param {string} repositoryNameOrId - The name or ID of the repository.
* @param {string} project - Project ID or project name
* @param {boolean} includeLinks - True to include links
*/
createForkSyncRequest(syncParams, repositoryNameOrId, 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
};
let queryValues = {
includeLinks: includeLinks,
};
try {
let verData = yield this.vsoClient.getVersioningData("4.1-preview.1", "git", "1703f858-b9d1-46af-ab62-483e9e1055b5", routeValues, queryValues);
let url = verData.requestUrl;
let options = this.createRequestOptions('application/json', verData.apiVersion);
let res;
res = yield this.rest.create(url, syncParams, options);
let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitForkSyncRequest, false);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Get a specific fork sync operation's details.
*
* @param {string} repositoryNameOrId - The name or ID of the repository.
* @param {number} forkSyncOperationId - OperationId of the sync request.
* @param {string} project - Project ID or project name
* @param {boolean} includeLinks - True to include links.
*/
getForkSyncRequest(repositoryNameOrId, forkSyncOperationId, 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,
forkSyncOperationId: forkSyncOperationId
};
let queryValues = {
includeLinks: includeLinks,
};
try {
let verData = yield this.vsoClient.getVersioningData("4.1-preview.1", "git", "1703f858-b9d1-46af-ab62-483e9e1055b5", 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.GitForkSyncRequest, false);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Retrieve all requested fork sync operations on this repository.
*
* @param {string} repositoryNameOrId - The name or ID of the repository.
* @param {string} project - Project ID or project name
* @param {boolean} includeAbandoned - True to include abandoned requests.
* @param {boolean} includeLinks - True to include links.
*/
getForkSyncRequests(repositoryNameOrId, project, includeAbandoned, 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
};
let queryValues = {
includeAbandoned: includeAbandoned,
includeLinks: includeLinks,
};
try {
let verData = yield this.vsoClient.getVersioningData("4.1-preview.1", "git", "1703f858-b9d1-46af-ab62-483e9e1055b5", 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.GitForkSyncRequest, true);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Create an import request.
*
* @param {GitInterfaces.GitImportRequest} importRequest - The import request to create.
* @param {string} project - Project ID or project name
* @param {string} repositoryId - The name or ID of the repository.
*/
createImportRequest(importRequest, 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("4.1-preview.1", "git", "01828ddc-3600-4a41-8633-99b3a73a0eb3", routeValues);
let url = verData.requestUrl;
let options = this.createRequestOptions('application/json', verData.apiVersion);
let res;
res = yield this.rest.create(url, importRequest, options);
let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitImportRequest, false);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Retrieve a particular import request.
*
* @param {string} project - Project ID or project name
* @param {string} repositoryId - The name or ID of the repository.
* @param {number} importRequestId - The unique identifier for the import request.
*/
getImportRequest(project, repositoryId, importRequestId) {
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,
importRequestId: importRequestId
};
try {
let verData = yield this.vsoClient.getVersioningData("4.1-preview.1", "git", "01828ddc-3600-4a41-8633-99b3a73a0eb3", 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.GitImportRequest, false);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Retrieve import requests for a repository.
*
* @param {string} project - Project ID or project name
* @param {string} repositoryId - The name or ID of the repository.
* @param {boolean} includeAbandoned - True to include abandoned import requests in the results.
*/
queryImportRequests(project, repositoryId, includeAbandoned) {
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 = {
includeAbandoned: includeAbandoned,
};
try {
let verData = yield this.vsoClient.getVersioningData("4.1-preview.1", "git", "01828ddc-3600-4a41-8633-99b3a73a0eb3", 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.GitImportRequest, true);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Retry or abandon a failed import request.
*
* @param {GitInterfaces.GitImportRequest} importRequestToUpdate - The updated version of the import request. Currently, the only change allowed is setting the Status to Queued or Abandoned.
* @param {string} project - Project ID or project name
* @param {string} repositoryId - The name or ID of the repository.
* @param {number} importRequestId - The unique identifier for the import request to update.
*/
updateImportRequest(importRequestToUpdate, project, repositoryId, importRequestId) {
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,
importRequestId: importRequestId
};
try {
let verData = yield this.vsoClient.getVersioningData("4.1-preview.1", "git", "01828ddc-3600-4a41-8633-99b3a73a0eb3", routeValues);
let url = verData.requestUrl;
let options = this.createRequestOptions('application/json', verData.apiVersion);
let res;
res = yield this.rest.update(url, importRequestToUpdate, options);
let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitImportRequest, false);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content, which is always returned as a download.
*
* @param {string} repositoryId - The Id of the repository.
* @param {string} path - The item path.
* @param {string} project - Project ID or project name
* @param {string} scopePath - The path scope. The default is null.
* @param {GitInterfaces.VersionControlRecursionType} recursionLevel - The recursion level of this request. The default is 'none', no recursion.
* @param {boolean} includeContentMetadata - Set to true to include content metadata. Default is false.
* @param {boolean} latestProcessedChange - Set to true to include the lastest changes. Default is false.
* @param {boolean} download - Set to true to download the response as a file. Default is false.
* @param {GitInterfaces.GitVersionDescriptor} versionDescriptor - Version descriptor. Default is null.
*/
getItem(repositoryId, path, project, scopePath, recursionLevel, includeContentMetadata, latestProcessedChange, download, versionDescriptor) {
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 = {
path: path,
scopePath: scopePath,
recursionLevel: recursionLevel,
includeContentMetadata: includeContentMetadata,
latestProcessedChange: latestProcessedChange,
download: download,
versionDescriptor: versionDescriptor,
};
try {
let verData = yield this.vsoClient.getVersioningData("4.1-preview.1", "git", "fb93c0db-47ed-4a31-8c20-47552878fb44", 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.GitItem, false);
resolve(ret);
}
catch (err) {
reject(err);
}
}));
});
}
/**
* Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content, which is always returned as a download.
*
* @param {string} repositoryId - The Id of the repository.
* @param {string} path - The item path.
* @param {string} project - Project ID or project name
* @param {string} scopePath - The path scope. The default is null.
* @param {GitInterfaces.VersionControlRecursionType} recursionLevel - The recursion level of this request. The default is 'none', no recursion.
* @param {boolean} includeContentMetadata - Set to true to include content metadata. Default is false.
* @param {boolean} latestProcessedChange - Set to true to include the lastest changes. Default is false.
* @param {boolean} download - Set to true to download the response as a file. Default is false.
* @param {GitInterfaces.GitVersionDescriptor} versionDescriptor - Version descriptor. Default is null.
*/
getItemContent(repositoryId, path, project, scopePath, recursionLevel, includeContentMetadata, latestProcessedChange, download, versionDescriptor) {
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 = {
path: path,
scopePath: scopePath,
recursionLevel: recursionLevel,
includeContentMetadata: includeContentMetadata,
latestProcessedChange: latestProcessedChange,
download: download,
versionDescriptor: versionDescriptor,
};
try {
let verData = yield this.vsoClient.getVersioningData("4.1-preview.1", "git", "fb93c0db-47ed-4a31-8c20-47552878fb44", 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);
}
}));
});
}
/**
* Get Item Metadata and/or Content for a collection of items. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download.
*
* @param {string} repositoryId - The Id of the repository.
* @param {string} project - Project ID or project name
* @param {string} scopePath - The path scope. The default is null.
* @param {GitInterfaces.VersionControlRecursionType} recursionLevel - The recursion level of this request. The default is 'none', no recursion.
* @param {boolean} includeContentMetadata - Set to true to include content metadata. Default is false.
* @param {boolean} latestProcessedChange - Set to true to include the lastest changes. Default is false.
* @param {boolean} download - Set to true to download the response as a file. Default is false.
* @param {boolean} includeLinks - Set to true to include links to items. Default is false.
* @param {GitInterfaces.GitVersionDescriptor} versionDescriptor - Version descriptor. Default is null.
*/
getItems(repositoryId, project, scopePath, recursionLevel, includeContentMetadata, latestProcessedChange, download, includeLinks, versionDescriptor) {
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 = {
scopePath: scopePath,
recursionLevel: recursionLevel,
includeContentMetadata: includeContentMetadata,
latestProcessedChange: latestProcessedChange,
download: download,
includeLinks: includeLinks,
versionDescriptor: vers