GitRestClient class

Base class that should be used (derived from) to make requests to VSS REST apis

Extends

Constructors

GitRestClient(IVssRestClientOptions)

Properties

RESOURCE_AREA_ID

Methods

createAnnotatedTag(GitAnnotatedTag, string, string)

Create an annotated tag.

createAttachment(any, string, string, number, string)

Attach a new file to a pull request.

createCherryPick(GitAsyncRefOperationParameters, string, string)

Cherry pick a specific commit or commits that are associated to a pull request into a new branch.

createComment(Comment, string, number, number, string)

Create a comment on a specific thread in a pull request (up to 500 comments can be created per thread).

createCommitStatus(GitStatus, string, string, string)

Create Git commit status.

createFavorite(GitRefFavorite, string)

Creates a ref favorite

createForkSyncRequest(GitForkSyncRequestParameters, string, string, boolean)

Request that another repository's refs be fetched into this one. It syncs two existing forks. To create a fork, please see the <a href="https://docs.microsoft.com/en-us/rest/api/vsts/git/repositories/create?view=azure-devops-rest-5.1"> repositories endpoint</a>

createImportRequest(GitImportRequest, string, string)

Create an import request.

createLike(string, number, number, number, string)

Add a like on a comment.

createMergeRequest(GitMergeParameters, string, string, boolean)

Request a git merge operation. Currently we support merging only 2 commits.

createPullRequest(GitPullRequest, string, string, boolean)

Create a pull request.

createPullRequestIterationStatus(GitPullRequestStatus, string, number, number, string)

Create a pull request status on the iteration. This operation will have the same result as Create status on pull request with specified iteration ID in the request body.

createPullRequestLabel(WebApiCreateTagRequestData, string, number, string, string)

Create a tag (if that does not exists yet) and add that as a label (tag) for a specified pull request. The only required field is the name of the new label (tag).

createPullRequestReviewer(IdentityRefWithVote, string, number, string, string)

Add a reviewer to a pull request or cast a vote.

createPullRequestReviewers(IdentityRef[], string, number, string)

Add reviewers to a pull request.

createPullRequestStatus(GitPullRequestStatus, string, number, string)

Create a pull request status.

createPush(GitPush, string, string)

Push changes to the repository.

createRepository(GitRepositoryCreateOptions, string, string)

Create a git repository in a team project.

createRevert(GitAsyncRefOperationParameters, string, string)

Starts the operation to create a new branch which reverts changes introduced by either a specific commit or commits that are associated to a pull request.

createThread(GitPullRequestCommentThread, string, number, string)

Create a thread in a pull request.

createUnmaterializedPullRequestReviewer(IdentityRefWithVote, string, number, string)

Add an unmaterialized identity to the reviewers of a pull request.

deleteAttachment(string, string, number, string)

Delete a pull request attachment.

deleteComment(string, number, number, number, string)

Delete a comment associated with a specific thread in a pull request.

deleteEnablementStatus(boolean, boolean, string[])

DELETE Deletes Enablement status and BillableCommitters data from DB. Deleting the enablement data will effectively disable it for the repositories affected.

deleteLike(string, number, number, number, string)

Delete a like on a comment.

deletePullRequestIterationStatus(string, number, number, number, string)

Delete pull request iteration status.

deletePullRequestLabels(string, number, string, string, string)

Removes a label (tag) from the set of those assigned to the pull request. The tag itself will not be deleted.

deletePullRequestReviewer(string, number, string, string)

Remove a reviewer from a pull request.

deletePullRequestStatus(string, number, number, string)

Delete pull request status.

deleteRefFavorite(string, number)

Deletes the refs favorite specified

deleteRepository(string, string)

Delete a git repository

deleteRepositoryFromRecycleBin(string, string)

Destroy (hard delete) a soft-deleted Git repository.

getAnnotatedTag(string, string, string)

Get an annotated tag.

getAttachmentContent(string, string, number, string)

Get the file content of a pull request attachment.

getAttachments(string, number, string)

Get a list of files attached to a given pull request.

getAttachmentZip(string, string, number, string)

Get the file content of a pull request attachment.

getBillableCommitters(string, Date, number, number)

Retrieve actual billable committers for Advanced Security service for a given date.

getBillableCommittersDetail(string, string, Date)

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.

getBlob(string, string, string, boolean, string, boolean)

Get a single blob.

getBlobContent(string, string, string, boolean, string, boolean)

Get a single blob.

getBlobsZip(string[], string, string, string)

Gets one or more blobs in a zip file download.

getBlobZip(string, string, string, boolean, string, boolean)

Get a single blob.

getBranch(string, string, string, GitVersionDescriptor)

Retrieve statistics about a single branch.

getBranches(string, string, GitVersionDescriptor)

Retrieve statistics about all branches within a repository.

getBranchStatsBatch(GitQueryBranchStatsCriteria, string, string)

Retrieve statistics for multiple commits

getChanges(string, string, string, number, number)

Retrieve changes for a particular commit.

getCherryPick(string, number, string)

Retrieve information about a cherry pick operation by cherry pick Id.

getCherryPickConflict(string, number, number, string)

Retrieve one conflict for a cherry pick by ID

getCherryPickConflicts(string, number, string, string, number, boolean, boolean, boolean)

Retrieve all conflicts for a cherry pick

getCherryPickForRefName(string, string, string)

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.

getCherryPickRelationships(string, string, string, boolean)

Given a commitId, returns a list of commits that are in the same cherry-pick family.

getComment(string, number, number, number, string)

Retrieve a comment associated with a specific thread in a pull request.

getComments(string, number, number, string)

Retrieve all comments associated with a specific thread in a pull request.

getCommit(string, string, string, number)

Retrieve a particular commit.

getCommitDiffs(string, string, boolean, number, number, GitBaseVersionDescriptor, GitTargetVersionDescriptor)

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.

getCommits(string, GitQueryCommitsCriteria, string)

Retrieve git commits for a project

getCommitsBatch(GitQueryCommitsCriteria, string, string, number, number, boolean)

Retrieve git commits for a project matching the search criteria

getDeletedRepositories(string)

Retrieve deleted git repositories.

getEnablementStatus(string[], Date, number, number)

GET Enablement status for project's repositories.

getEnableOnCreateHost(boolean)
getEnableOnCreateProject(string)
getEstimatedBillableCommittersRepo(string, string)

Get estimated billable committers for a repository for the last 90 days.

getEstimatedBillablePushersOrg()

Get estimated billable pushers for an Organization for last 90 days.

getEstimatedBillablePushersProject(string)

Get estimated billable pushers for a project for last 90 days.

getFileDiffs(FileDiffsCriteria, string, string)

Get the file diffs for each of the specified files

getForks(string, string, string, boolean)

Retrieve all forks of a repository in the collection.

getForkSyncRequest(string, number, string, boolean)

Get a specific fork sync operation's details.

getForkSyncRequests(string, string, boolean, boolean)

Retrieve all requested fork sync operations on this repository.

getImportRequest(string, string, number)

Retrieve a particular import request.

getItem(string, string, string, string, VersionControlRecursionType, boolean, boolean, boolean, GitVersionDescriptor, boolean, boolean, boolean)

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.

getItemContent(string, string, string, string, VersionControlRecursionType, boolean, boolean, boolean, GitVersionDescriptor, boolean, boolean, boolean)

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.

getItems(string, string, string, VersionControlRecursionType, boolean, boolean, boolean, boolean, GitVersionDescriptor, boolean)

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.

getItemsBatch(GitItemRequestData, string, string)

Post for retrieving a creating a batch out of a set of items in a repo / project given a list of paths or a long path

getItemText(string, string, string, string, VersionControlRecursionType, boolean, boolean, boolean, GitVersionDescriptor, boolean, boolean, boolean)

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.

getItemZip(string, string, string, string, VersionControlRecursionType, boolean, boolean, boolean, GitVersionDescriptor, boolean, boolean, boolean)

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.

getLikes(string, number, number, number, string)

Get likes for a comment.

getMergeBases(string, string, string, string, string, string)

Find the merge bases of two commits, optionally across forks. If otherRepositoryId is not specified, the merge bases will only be calculated within the context of the local repositoryNameOrId.

getMergeRequest(string, string, number, boolean)

Get a specific merge operation's details.

getPermission(string, string, string)

GET Advanced Security Permission status.

getPullRequest(string, number, string, number, number, number, boolean, boolean)

Retrieve a pull request.

getPullRequestById(number, string)

Retrieve a pull request.

getPullRequestCommits(string, number, string)

Get the commits for the specified pull request.

getPullRequestConflict(string, number, number, string)

Retrieve one conflict for a pull request by ID

getPullRequestConflicts(string, number, string, number, number, boolean, boolean, boolean)

Retrieve all conflicts for a pull request

getPullRequestIteration(string, number, number, string)

Get the specified iteration for a pull request.

getPullRequestIterationChanges(string, number, number, string, number, number, number)

Retrieve the changes made in a pull request between two iterations.

getPullRequestIterationCommits(string, number, number, string, number, number)

Get the commits for the specified iteration of a pull request.

getPullRequestIterations(string, number, string, boolean)

Get the list of iterations for the specified pull request.

getPullRequestIterationStatus(string, number, number, number, string)

Get the specific pull request iteration status by ID. The status ID is unique within the pull request across all iterations.

getPullRequestIterationStatuses(string, number, number, string)

Get all the statuses associated with a pull request iteration.

getPullRequestLabel(string, number, string, string, string)

Retrieves a single label (tag) that has been assigned to a pull request.

getPullRequestLabels(string, number, string, string)

Get all the labels (tags) assigned to a pull request.

getPullRequestProperties(string, number, string)

Get external properties of the pull request.

getPullRequestQuery(GitPullRequestQuery, string, string)

This API is used to find what pull requests are related to a given commit. It can be used to either find the pull request that created a particular merge commit or it can be used to find all pull requests that have ever merged a particular commit. The input is a list of queries which each contain a list of commits. For each commit that you search against, you will get back a dictionary of commit -> pull requests.

getPullRequestReviewer(string, number, string, string)

Retrieve information about a particular reviewer on a pull request

getPullRequestReviewers(string, number, string)

Retrieve the reviewers for a pull request

getPullRequests(string, GitPullRequestSearchCriteria, string, number, number, number)

Retrieve all pull requests matching a specified criteria.

getPullRequestsByProject(string, GitPullRequestSearchCriteria, number, number, number)

Retrieve all pull requests matching a specified criteria.

getPullRequestStatus(string, number, number, string)

Get the specific pull request status by ID. The status ID is unique within the pull request across all iterations.

getPullRequestStatuses(string, number, string)

Get all the statuses associated with a pull request.

getPullRequestThread(string, number, number, string, number, number)

Retrieve a thread in a pull request.

getPullRequestWorkItemRefs(string, number, string)

Retrieve a list of work items associated with a pull request.

getPush(string, number, string, number, boolean)

Retrieves a particular push.

getPushCommits(string, number, string, number, number, boolean)

Retrieve a list of commits associated with a particular push.

getPushes(string, string, number, number, GitPushSearchCriteria)

Retrieves pushes associated with the specified repository.

getRecycleBinRepositories(string)

Retrieve soft-deleted git repositories from the recycle bin.

getRefFavorite(string, number)

Gets the refs favorite for a favorite Id.

getRefFavorites(string, string, string)

Gets the refs favorites for a repo and an identity.

getRefFavoritesForProject(string, string)
getRefs(string, string, string, boolean, boolean, boolean, boolean, boolean, string)

Queries the provided repository for its refs and returns them.

getRepositories(string, boolean, boolean, boolean)

Retrieve git repositories.

getRepository(string, string)

Retrieve a git repository.

getRepositoryWithParent(string, boolean, string)

Retrieve a git repository.

getRevert(string, number, string)

Retrieve information about a revert operation by revert Id.

getRevertConflict(string, number, number, string)

Retrieve one conflict for a revert by ID

getRevertConflicts(string, number, string, string, number, boolean, boolean, boolean)

Retrieve all conflicts for a revert

getRevertForRefName(string, string, string)

Retrieve information about a revert operation for a specific branch.

getStatuses(string, string, string, number, number, boolean)

Get statuses associated with the Git commit.

getSuggestions(string, string, boolean)

Retrieve a pull request suggestion for a particular repository or team project.

getThreads(string, number, string, number, number)

Retrieve all threads in a pull request.

getTree(string, string, string, string, boolean, string)

The Tree endpoint returns the collection of objects underneath the specified tree. Trees are folders in a Git repository.

getTreeZip(string, string, string, string, boolean, string)

The Tree endpoint returns the collection of objects underneath the specified tree. Trees are folders in a Git repository.

queryImportRequests(string, string, boolean)

Retrieve import requests for a repository.

restoreRepositoryFromRecycleBin(GitRecycleBinRepositoryDetails, string, string)

Recover a soft-deleted Git repository. Recently deleted repositories go into a soft-delete state for a period of time before they are hard deleted and become unrecoverable.

setEnableOnCreateHost(boolean)
setEnableOnCreateProject(string, boolean)
sharePullRequest(ShareNotificationContext, string, number, string)

Sends an e-mail notification about a specific pull request to a set of recipients

updateCherryPickConflict(GitConflict, string, number, number, string)

Update merge conflict resolution

updateCherryPickConflicts(GitConflict[], string, number, string)

Update multiple merge conflict resolutions

updateComment(Comment, string, number, number, number, string)

Update a comment associated with a specific thread in a pull request.

updateEnablementStatus(AdvSecEnablementUpdate[])

POST Enablement status for repositories.

updateImportRequest(GitImportRequest, string, string, number)

Retry or abandon a failed import request.

updatePullRequest(GitPullRequest, string, number, string)

Update a pull request

updatePullRequestConflict(GitConflict, string, number, number, string)

Update merge conflict resolution

updatePullRequestConflicts(GitConflict[], string, number, string)

Update multiple merge conflict resolutions

updatePullRequestIterationStatuses(JsonPatchDocument, string, number, number, string)

Update pull request iteration statuses collection. The only supported operation type is remove.

updatePullRequestProperties(JsonPatchDocument, string, number, string)

Create or update pull request external properties. The patch operation can be add, replace or remove. For add operation, the path can be empty. If the path is empty, the value must be a list of key value pairs. For replace operation, the path cannot be empty. If the path does not exist, the property will be added to the collection. For remove operation, the path cannot be empty. If the path does not exist, no action will be performed.

updatePullRequestReviewer(IdentityRefWithVote, string, number, string, string)

Edit a reviewer entry. These fields are patchable: isFlagged, hasDeclined

updatePullRequestReviewers(IdentityRefWithVote[], string, number, string)

Reset the votes of multiple reviewers on a pull request. NOTE: This endpoint only supports updating votes, but does not support updating required reviewers (use policy) or display names.

updatePullRequestStatuses(JsonPatchDocument, string, number, string)

Update pull request statuses collection. The only supported operation type is remove.

updateRef(GitRefUpdate, string, string, string, string)

Lock or Unlock a branch.

updateRefs(GitRefUpdate[], string, string, string)

Creating, updating, or deleting refs(branches).

updateRepository(GitRepository, string, string)

Updates the Git repository with either a new repo name or a new default branch.

updateRevertConflict(GitConflict, string, number, number, string)

Update merge conflict resolution

updateRevertConflicts(GitConflict[], string, number, string)

Update multiple merge conflict resolutions

updateThread(GitPullRequestCommentThread, string, number, number, string)

Update a thread in a pull request.

Constructor Details

GitRestClient(IVssRestClientOptions)

new GitRestClient(options: IVssRestClientOptions)

Parameters

Property Details

RESOURCE_AREA_ID

static RESOURCE_AREA_ID: string

Property Value

string

Method Details

createAnnotatedTag(GitAnnotatedTag, string, string)

Create an annotated tag.

function createAnnotatedTag(tagObject: GitAnnotatedTag, project: string, repositoryId: string): Promise<GitAnnotatedTag>

Parameters

tagObject
GitAnnotatedTag

Object containing details of tag to be created.

project

string

Project ID or project name

repositoryId

string

ID or name of the repository.

Returns

Promise<GitAnnotatedTag>

createAttachment(any, string, string, number, string)

Attach a new file to a pull request.

function createAttachment(content: any, fileName: string, repositoryId: string, pullRequestId: number, project?: string): Promise<Attachment>

Parameters

content

any

Content to upload

fileName

string

The name of the file.

repositoryId

string

The repository ID of the pull request’s target branch.

pullRequestId

number

ID of the pull request.

project

string

Project ID or project name

Returns

Promise<Attachment>

createCherryPick(GitAsyncRefOperationParameters, string, string)

Cherry pick a specific commit or commits that are associated to a pull request into a new branch.

function createCherryPick(cherryPickToCreate: GitAsyncRefOperationParameters, project: string, repositoryId: string): Promise<GitCherryPick>

Parameters

cherryPickToCreate
GitAsyncRefOperationParameters
project

string

Project ID or project name

repositoryId

string

ID of the repository.

Returns

Promise<GitCherryPick>

createComment(Comment, string, number, number, string)

Create a comment on a specific thread in a pull request (up to 500 comments can be created per thread).

function createComment(comment: Comment, repositoryId: string, pullRequestId: number, threadId: number, project?: string): Promise<Comment>

Parameters

comment
Comment

The comment to create. Comments can be up to 150,000 characters.

repositoryId

string

The repository ID of the pull request's target branch.

pullRequestId

number

ID of the pull request.

threadId

number

ID of the thread that the desired comment is in.

project

string

Project ID or project name

Returns

Promise<Comment>

createCommitStatus(GitStatus, string, string, string)

Create Git commit status.

function createCommitStatus(gitCommitStatusToCreate: GitStatus, commitId: string, repositoryId: string, project?: string): Promise<GitStatus>

Parameters

gitCommitStatusToCreate
GitStatus

Git commit status object to create.

commitId

string

ID of the Git commit.

repositoryId

string

ID of the repository.

project

string

Project ID or project name

Returns

Promise<GitStatus>

createFavorite(GitRefFavorite, string)

Creates a ref favorite

function createFavorite(favorite: GitRefFavorite, project: string): Promise<GitRefFavorite>

Parameters

favorite
GitRefFavorite

The ref favorite to create.

project

string

Project ID or project name

Returns

Promise<GitRefFavorite>

createForkSyncRequest(GitForkSyncRequestParameters, string, string, boolean)

Request that another repository's refs be fetched into this one. It syncs two existing forks. To create a fork, please see the <a href="https://docs.microsoft.com/en-us/rest/api/vsts/git/repositories/create?view=azure-devops-rest-5.1"> repositories endpoint</a>

function createForkSyncRequest(syncParams: GitForkSyncRequestParameters, repositoryNameOrId: string, project?: string, includeLinks?: boolean): Promise<GitForkSyncRequest>

Parameters

syncParams
GitForkSyncRequestParameters

Source repository and ref mapping.

repositoryNameOrId

string

The name or ID of the repository.

project

string

Project ID or project name

includeLinks

boolean

True to include links

Returns

createImportRequest(GitImportRequest, string, string)

Create an import request.

function createImportRequest(importRequest: GitImportRequest, project: string, repositoryId: string): Promise<GitImportRequest>

Parameters

importRequest
GitImportRequest

The import request to create.

project

string

Project ID or project name

repositoryId

string

The name or ID of the repository.

Returns

Promise<GitImportRequest>

createLike(string, number, number, number, string)

Add a like on a comment.

function createLike(repositoryId: string, pullRequestId: number, threadId: number, commentId: number, project?: string): Promise<void>

Parameters

repositoryId

string

The repository ID of the pull request's target branch.

pullRequestId

number

ID of the pull request.

threadId

number

The ID of the thread that contains the comment.

commentId

number

The ID of the comment.

project

string

Project ID or project name

Returns

Promise<void>

createMergeRequest(GitMergeParameters, string, string, boolean)

Request a git merge operation. Currently we support merging only 2 commits.

function createMergeRequest(mergeParameters: GitMergeParameters, project: string, repositoryNameOrId: string, includeLinks?: boolean): Promise<GitMerge>

Parameters

mergeParameters
GitMergeParameters

Parents commitIds and merge commit messsage.

project

string

Project ID or project name

repositoryNameOrId

string

The name or ID of the repository.

includeLinks

boolean

True to include links

Returns

Promise<GitMerge>

createPullRequest(GitPullRequest, string, string, boolean)

Create a pull request.

function createPullRequest(gitPullRequestToCreate: GitPullRequest, repositoryId: string, project?: string, supportsIterations?: boolean): Promise<GitPullRequest>

Parameters

gitPullRequestToCreate
GitPullRequest

The pull request to create.

repositoryId

string

The repository ID of the pull request's target branch.

project

string

Project ID or project name

supportsIterations

boolean

If true, subsequent pushes to the pull request will be individually reviewable. Set this to false for large pull requests for performance reasons if this functionality is not needed.

Returns

Promise<GitPullRequest>

createPullRequestIterationStatus(GitPullRequestStatus, string, number, number, string)

Create a pull request status on the iteration. This operation will have the same result as Create status on pull request with specified iteration ID in the request body.

function createPullRequestIterationStatus(status: GitPullRequestStatus, repositoryId: string, pullRequestId: number, iterationId: number, project?: string): Promise<GitPullRequestStatus>

Parameters

status
GitPullRequestStatus

Pull request status to create.

repositoryId

string

The repository ID of the pull request’s target branch.

pullRequestId

number

ID of the pull request.

iterationId

number

ID of the pull request iteration.

project

string

Project ID or project name

Returns

createPullRequestLabel(WebApiCreateTagRequestData, string, number, string, string)

Create a tag (if that does not exists yet) and add that as a label (tag) for a specified pull request. The only required field is the name of the new label (tag).

function createPullRequestLabel(label: WebApiCreateTagRequestData, repositoryId: string, pullRequestId: number, project?: string, projectId?: string): Promise<WebApiTagDefinition>

Parameters

label
WebApiCreateTagRequestData

Label to assign to the pull request.

repositoryId

string

The repository ID of the pull request’s target branch.

pullRequestId

number

ID of the pull request.

project

string

Project ID or project name

projectId

string

Project ID or project name.

Returns

createPullRequestReviewer(IdentityRefWithVote, string, number, string, string)

Add a reviewer to a pull request or cast a vote.

function createPullRequestReviewer(reviewer: IdentityRefWithVote, repositoryId: string, pullRequestId: number, reviewerId: string, project?: string): Promise<IdentityRefWithVote>

Parameters

reviewer
IdentityRefWithVote

Reviewer's vote.<br />If the reviewer's ID is included here, it must match the reviewerID parameter.<br />Reviewers can set their own vote with this method. When adding other reviewers, vote must be set to zero.

repositoryId

string

The repository ID of the pull request's target branch.

pullRequestId

number

ID of the pull request.

reviewerId

string

ID of the reviewer.

project

string

Project ID or project name

Returns

createPullRequestReviewers(IdentityRef[], string, number, string)

Add reviewers to a pull request.

function createPullRequestReviewers(reviewers: IdentityRef[], repositoryId: string, pullRequestId: number, project?: string): Promise<IdentityRefWithVote[]>

Parameters

reviewers

IdentityRef[]

Reviewers to add to the pull request.

repositoryId

string

The repository ID of the pull request's target branch.

pullRequestId

number

ID of the pull request.

project

string

Project ID or project name

Returns

Promise<IdentityRefWithVote[]>

createPullRequestStatus(GitPullRequestStatus, string, number, string)

Create a pull request status.

function createPullRequestStatus(status: GitPullRequestStatus, repositoryId: string, pullRequestId: number, project?: string): Promise<GitPullRequestStatus>

Parameters

status
GitPullRequestStatus

Pull request status to create.

repositoryId

string

The repository ID of the pull request’s target branch.

pullRequestId

number

ID of the pull request.

project

string

Project ID or project name

Returns

createPush(GitPush, string, string)

Push changes to the repository.

function createPush(push: GitPush, repositoryId: string, project?: string): Promise<GitPush>

Parameters

push
GitPush
repositoryId

string

The name or ID of the repository.

project

string

Project ID or project name

Returns

Promise<GitPush>

createRepository(GitRepositoryCreateOptions, string, string)

Create a git repository in a team project.

function createRepository(gitRepositoryToCreate: GitRepositoryCreateOptions, project?: string, sourceRef?: string): Promise<GitRepository>

Parameters

gitRepositoryToCreate
GitRepositoryCreateOptions

Specify the repo name, team project and/or parent repository. Team project information can be omitted from gitRepositoryToCreate if the request is project-scoped (i.e., includes project Id).

project

string

Project ID or project name

sourceRef

string

[optional] Specify the source refs to use while creating a fork repo

Returns

Promise<GitRepository>

createRevert(GitAsyncRefOperationParameters, string, string)

Starts the operation to create a new branch which reverts changes introduced by either a specific commit or commits that are associated to a pull request.

function createRevert(revertToCreate: GitAsyncRefOperationParameters, project: string, repositoryId: string): Promise<GitRevert>

Parameters

project

string

Project ID or project name

repositoryId

string

ID of the repository.

Returns

Promise<GitRevert>

createThread(GitPullRequestCommentThread, string, number, string)

Create a thread in a pull request.

function createThread(commentThread: GitPullRequestCommentThread, repositoryId: string, pullRequestId: number, project?: string): Promise<GitPullRequestCommentThread>

Parameters

commentThread
GitPullRequestCommentThread

The thread to create. Thread must contain at least one comment.

repositoryId

string

Repository ID of the pull request's target branch.

pullRequestId

number

ID of the pull request.

project

string

Project ID or project name

Returns

createUnmaterializedPullRequestReviewer(IdentityRefWithVote, string, number, string)

Add an unmaterialized identity to the reviewers of a pull request.

function createUnmaterializedPullRequestReviewer(reviewer: IdentityRefWithVote, repositoryId: string, pullRequestId: number, project?: string): Promise<IdentityRefWithVote>

Parameters

reviewer
IdentityRefWithVote

Reviewer to add to the pull request.

repositoryId

string

The repository ID of the pull request's target branch.

pullRequestId

number

ID of the pull request.

project

string

Project ID or project name

Returns

deleteAttachment(string, string, number, string)

Delete a pull request attachment.

function deleteAttachment(fileName: string, repositoryId: string, pullRequestId: number, project?: string): Promise<void>

Parameters

fileName

string

The name of the attachment to delete.

repositoryId

string

The repository ID of the pull request’s target branch.

pullRequestId

number

ID of the pull request.

project

string

Project ID or project name

Returns

Promise<void>

deleteComment(string, number, number, number, string)

Delete a comment associated with a specific thread in a pull request.

function deleteComment(repositoryId: string, pullRequestId: number, threadId: number, commentId: number, project?: string): Promise<void>

Parameters

repositoryId

string

The repository ID of the pull request's target branch.

pullRequestId

number

ID of the pull request.

threadId

number

ID of the thread that the desired comment is in.

commentId

number

ID of the comment.

project

string

Project ID or project name

Returns

Promise<void>

deleteEnablementStatus(boolean, boolean, string[])

DELETE Deletes Enablement status and BillableCommitters data from DB. Deleting the enablement data will effectively disable it for the repositories affected.

function deleteEnablementStatus(allProjects: boolean, includeBillableCommitters?: boolean, projectIds?: string[]): Promise<void>

Parameters

allProjects

boolean

includeBillableCommitters

boolean

projectIds

string[]

Returns

Promise<void>

deleteLike(string, number, number, number, string)

Delete a like on a comment.

function deleteLike(repositoryId: string, pullRequestId: number, threadId: number, commentId: number, project?: string): Promise<void>

Parameters

repositoryId

string

The repository ID of the pull request's target branch.

pullRequestId

number

ID of the pull request.

threadId

number

The ID of the thread that contains the comment.

commentId

number

The ID of the comment.

project

string

Project ID or project name

Returns

Promise<void>

deletePullRequestIterationStatus(string, number, number, number, string)

Delete pull request iteration status.

function deletePullRequestIterationStatus(repositoryId: string, pullRequestId: number, iterationId: number, statusId: number, project?: string): Promise<void>

Parameters

repositoryId

string

The repository ID of the pull request’s target branch.

pullRequestId

number

ID of the pull request.

iterationId

number

ID of the pull request iteration.

statusId

number

ID of the pull request status.

project

string

Project ID or project name

Returns

Promise<void>

deletePullRequestLabels(string, number, string, string, string)

Removes a label (tag) from the set of those assigned to the pull request. The tag itself will not be deleted.

function deletePullRequestLabels(repositoryId: string, pullRequestId: number, labelIdOrName: string, project?: string, projectId?: string): Promise<void>

Parameters

repositoryId

string

The repository ID of the pull request’s target branch.

pullRequestId

number

ID of the pull request.

labelIdOrName

string

The name or ID of the label requested.

project

string

Project ID or project name

projectId

string

Project ID or project name.

Returns

Promise<void>

deletePullRequestReviewer(string, number, string, string)

Remove a reviewer from a pull request.

function deletePullRequestReviewer(repositoryId: string, pullRequestId: number, reviewerId: string, project?: string): Promise<void>

Parameters

repositoryId

string

The repository ID of the pull request's target branch.

pullRequestId

number

ID of the pull request.

reviewerId

string

ID of the reviewer to remove.

project

string

Project ID or project name

Returns

Promise<void>

deletePullRequestStatus(string, number, number, string)

Delete pull request status.

function deletePullRequestStatus(repositoryId: string, pullRequestId: number, statusId: number, project?: string): Promise<void>

Parameters

repositoryId

string

The repository ID of the pull request’s target branch.

pullRequestId

number

ID of the pull request.

statusId

number

ID of the pull request status.

project

string

Project ID or project name

Returns

Promise<void>

deleteRefFavorite(string, number)

Deletes the refs favorite specified

function deleteRefFavorite(project: string, favoriteId: number): Promise<void>

Parameters

project

string

Project ID or project name

favoriteId

number

The Id of the ref favorite to delete.

Returns

Promise<void>

deleteRepository(string, string)

Delete a git repository

function deleteRepository(repositoryId: string, project?: string): Promise<void>

Parameters

repositoryId

string

The ID of the repository.

project

string

Project ID or project name

Returns

Promise<void>

deleteRepositoryFromRecycleBin(string, string)

Destroy (hard delete) a soft-deleted Git repository.

function deleteRepositoryFromRecycleBin(project: string, repositoryId: string): Promise<void>

Parameters

project

string

Project ID or project name

repositoryId

string

The ID of the repository.

Returns

Promise<void>

getAnnotatedTag(string, string, string)

Get an annotated tag.

function getAnnotatedTag(project: string, repositoryId: string, objectId: string): Promise<GitAnnotatedTag>

Parameters

project

string

Project ID or project name

repositoryId

string

ID or name of the repository.

objectId

string

ObjectId (Sha1Id) of tag to get.

Returns

Promise<GitAnnotatedTag>

getAttachmentContent(string, string, number, string)

Get the file content of a pull request attachment.

function getAttachmentContent(fileName: string, repositoryId: string, pullRequestId: number, project?: string): Promise<ArrayBuffer>

Parameters

fileName

string

The name of the attachment.

repositoryId

string

The repository ID of the pull request’s target branch.

pullRequestId

number

ID of the pull request.

project

string

Project ID or project name

Returns

Promise<ArrayBuffer>

getAttachments(string, number, string)

Get a list of files attached to a given pull request.

function getAttachments(repositoryId: string, pullRequestId: number, project?: string): Promise<Attachment[]>

Parameters

repositoryId

string

The repository ID of the pull request’s target branch.

pullRequestId

number

ID of the pull request.

project

string

Project ID or project name

Returns

Promise<Attachment[]>

getAttachmentZip(string, string, number, string)

Get the file content of a pull request attachment.

function getAttachmentZip(fileName: string, repositoryId: string, pullRequestId: number, project?: string): Promise<ArrayBuffer>

Parameters

fileName

string

The name of the attachment.

repositoryId

string

The repository ID of the pull request’s target branch.

pullRequestId

number

ID of the pull request.

project

string

Project ID or project name

Returns

Promise<ArrayBuffer>

getBillableCommitters(string, Date, number, number)

Retrieve actual billable committers for Advanced Security service for a given date.

function getBillableCommitters(project: string, billingDate?: Date, skip?: number, take?: number): Promise<BillableCommitter[]>

Parameters

project

string

Project ID or project name

billingDate

Date

UTC expected. If not specified defaults to the previous billing day.

skip

number

Skip X rows of resultset to simulate paging.

take

number

Return Y rows of resultset to simulate paging.

Returns

Promise<BillableCommitter[]>

getBillableCommittersDetail(string, string, Date)

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.

function getBillableCommittersDetail(project: string, includeDetails: string, billingDate?: Date): Promise<BillableCommitterDetail[]>

Parameters

project

string

Project ID or project name

includeDetails

string

Return all the details on the billable committers.

billingDate

Date

UTC expected. If not specified defaults to the previous billing day.

Returns

getBlob(string, string, string, boolean, string, boolean)

Get a single blob.

function getBlob(repositoryId: string, sha1: string, project?: string, download?: boolean, fileName?: string, resolveLfs?: boolean): Promise<GitBlobRef>

Parameters

repositoryId

string

The name or ID of the repository.

sha1

string

SHA1 hash of the file. You can get the SHA1 of a file using the "Git/Items/Get Item" endpoint.

project

string

Project ID or project name

download

boolean

If true, prompt for a download rather than rendering in a browser. Note: this value defaults to true if $format is zip

fileName

string

Provide a fileName to use for a download.

resolveLfs

boolean

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

Returns

Promise<GitBlobRef>

getBlobContent(string, string, string, boolean, string, boolean)

Get a single blob.

function getBlobContent(repositoryId: string, sha1: string, project?: string, download?: boolean, fileName?: string, resolveLfs?: boolean): Promise<ArrayBuffer>

Parameters

repositoryId

string

The name or ID of the repository.

sha1

string

SHA1 hash of the file. You can get the SHA1 of a file using the "Git/Items/Get Item" endpoint.

project

string

Project ID or project name

download

boolean

If true, prompt for a download rather than rendering in a browser. Note: this value defaults to true if $format is zip

fileName

string

Provide a fileName to use for a download.

resolveLfs

boolean

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

Returns

Promise<ArrayBuffer>

getBlobsZip(string[], string, string, string)

Gets one or more blobs in a zip file download.

function getBlobsZip(blobIds: string[], repositoryId: string, project?: string, filename?: string): Promise<ArrayBuffer>

Parameters

blobIds

string[]

Blob IDs (SHA1 hashes) to be returned in the zip file.

repositoryId

string

The name or ID of the repository.

project

string

Project ID or project name

filename

string

Returns

Promise<ArrayBuffer>

getBlobZip(string, string, string, boolean, string, boolean)

Get a single blob.

function getBlobZip(repositoryId: string, sha1: string, project?: string, download?: boolean, fileName?: string, resolveLfs?: boolean): Promise<ArrayBuffer>

Parameters

repositoryId

string

The name or ID of the repository.

sha1

string

SHA1 hash of the file. You can get the SHA1 of a file using the "Git/Items/Get Item" endpoint.

project

string

Project ID or project name

download

boolean

If true, prompt for a download rather than rendering in a browser. Note: this value defaults to true if $format is zip

fileName

string

Provide a fileName to use for a download.

resolveLfs

boolean

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

Returns

Promise<ArrayBuffer>

getBranch(string, string, string, GitVersionDescriptor)

Retrieve statistics about a single branch.

function getBranch(repositoryId: string, name: string, project?: string, baseVersionDescriptor?: GitVersionDescriptor): Promise<GitBranchStats>

Parameters

repositoryId

string

The name or ID of the repository.

name

string

Name of the branch.

project

string

Project ID or project name

baseVersionDescriptor
GitVersionDescriptor

Identifies the commit or branch to use as the base.

Returns

Promise<GitBranchStats>

getBranches(string, string, GitVersionDescriptor)

Retrieve statistics about all branches within a repository.

function getBranches(repositoryId: string, project?: string, baseVersionDescriptor?: GitVersionDescriptor): Promise<GitBranchStats[]>

Parameters

repositoryId

string

The name or ID of the repository.

project

string

Project ID or project name

baseVersionDescriptor
GitVersionDescriptor

Identifies the commit or branch to use as the base.

Returns

Promise<GitBranchStats[]>

getBranchStatsBatch(GitQueryBranchStatsCriteria, string, string)

Retrieve statistics for multiple commits

function getBranchStatsBatch(searchCriteria: GitQueryBranchStatsCriteria, repositoryId: string, project?: string): Promise<GitBranchStats[]>

Parameters

searchCriteria
GitQueryBranchStatsCriteria

Base Commit and List of Target Commits to compare.

repositoryId

string

The name or ID of the repository.

project

string

Project ID or project name

Returns

Promise<GitBranchStats[]>

getChanges(string, string, string, number, number)

Retrieve changes for a particular commit.

function getChanges(commitId: string, repositoryId: string, project?: string, top?: number, skip?: number): Promise<GitCommitChanges>

Parameters

commitId

string

The id of the commit.

repositoryId

string

The id or friendly name of the repository. To use the friendly name, projectId must also be specified.

project

string

Project ID or project name

top

number

The maximum number of changes to return.

skip

number

The number of changes to skip.

Returns

Promise<GitCommitChanges>

getCherryPick(string, number, string)

Retrieve information about a cherry pick operation by cherry pick Id.

function getCherryPick(project: string, cherryPickId: number, repositoryId: string): Promise<GitCherryPick>

Parameters

project

string

Project ID or project name

cherryPickId

number

ID of the cherry pick.

repositoryId

string

ID of the repository.

Returns

Promise<GitCherryPick>

getCherryPickConflict(string, number, number, string)

Retrieve one conflict for a cherry pick by ID

function getCherryPickConflict(repositoryId: string, cherryPickId: number, conflictId: number, project?: string): Promise<GitConflict>

Parameters

repositoryId

string

cherryPickId

number

conflictId

number

project

string

Project ID or project name

Returns

Promise<GitConflict>

getCherryPickConflicts(string, number, string, string, number, boolean, boolean, boolean)

Retrieve all conflicts for a cherry pick

function getCherryPickConflicts(repositoryId: string, cherryPickId: number, project?: string, continuationToken?: string, top?: number, excludeResolved?: boolean, onlyResolved?: boolean, includeObsolete?: boolean): Promise<PagedList<GitConflict>>

Parameters

repositoryId

string

cherryPickId

number

project

string

Project ID or project name

continuationToken

string

top

number

excludeResolved

boolean

onlyResolved

boolean

includeObsolete

boolean

Returns

getCherryPickForRefName(string, string, string)

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.

function getCherryPickForRefName(project: string, repositoryId: string, refName: string): Promise<GitCherryPick>

Parameters

project

string

Project ID or project name

repositoryId

string

ID of the repository.

refName

string

The GitAsyncRefOperationParameters generatedRefName used for the cherry pick operation.

Returns

Promise<GitCherryPick>

getCherryPickRelationships(string, string, string, boolean)

Given a commitId, returns a list of commits that are in the same cherry-pick family.

function getCherryPickRelationships(repositoryNameOrId: string, commitId: string, project?: string, includeLinks?: boolean): Promise<GitCommitRef[]>

Parameters

repositoryNameOrId

string

commitId

string

project

string

Project ID or project name

includeLinks

boolean

Returns

Promise<GitCommitRef[]>

getComment(string, number, number, number, string)

Retrieve a comment associated with a specific thread in a pull request.

function getComment(repositoryId: string, pullRequestId: number, threadId: number, commentId: number, project?: string): Promise<Comment>

Parameters

repositoryId

string

The repository ID of the pull request's target branch.

pullRequestId

number

ID of the pull request.

threadId

number

ID of the thread that the desired comment is in.

commentId

number

ID of the comment.

project

string

Project ID or project name

Returns

Promise<Comment>

getComments(string, number, number, string)

Retrieve all comments associated with a specific thread in a pull request.

function getComments(repositoryId: string, pullRequestId: number, threadId: number, project?: string): Promise<Comment[]>

Parameters

repositoryId

string

The repository ID of the pull request's target branch.

pullRequestId

number

ID of the pull request.

threadId

number

ID of the thread.

project

string

Project ID or project name

Returns

Promise<Comment[]>

getCommit(string, string, string, number)

Retrieve a particular commit.

function getCommit(commitId: string, repositoryId: string, project?: string, changeCount?: number): Promise<GitCommit>

Parameters

commitId

string

The id of the commit.

repositoryId

string

The id or friendly name of the repository. To use the friendly name, projectId must also be specified.

project

string

Project ID or project name

changeCount

number

The number of changes to include in the result.

Returns

Promise<GitCommit>

getCommitDiffs(string, string, boolean, number, number, GitBaseVersionDescriptor, GitTargetVersionDescriptor)

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.

function getCommitDiffs(repositoryId: string, project?: string, diffCommonCommit?: boolean, top?: number, skip?: number, baseVersionDescriptor?: GitBaseVersionDescriptor, targetVersionDescriptor?: GitTargetVersionDescriptor): Promise<GitCommitDiffs>

Parameters

repositoryId

string

The name or ID of the repository.

project

string

Project ID or project name

diffCommonCommit

boolean

If true, diff between common and target commits. If false, diff between base and target commits.

top

number

Maximum number of changes to return. Defaults to 100.

skip

number

Number of changes to skip

baseVersionDescriptor
GitBaseVersionDescriptor

Descriptor for base commit.

targetVersionDescriptor
GitTargetVersionDescriptor

Descriptor for target commit.

Returns

Promise<GitCommitDiffs>

getCommits(string, GitQueryCommitsCriteria, string)

Retrieve git commits for a project

function getCommits(repositoryId: string, searchCriteria: GitQueryCommitsCriteria, project?: string): Promise<GitCommitRef[]>

Parameters

repositoryId

string

The id or friendly name of the repository. To use the friendly name, projectId must also be specified.

searchCriteria
GitQueryCommitsCriteria
project

string

Project ID or project name

Returns

Promise<GitCommitRef[]>

getCommitsBatch(GitQueryCommitsCriteria, string, string, number, number, boolean)

Retrieve git commits for a project matching the search criteria

function getCommitsBatch(searchCriteria: GitQueryCommitsCriteria, repositoryId: string, project?: string, skip?: number, top?: number, includeStatuses?: boolean): Promise<GitCommitRef[]>

Parameters

searchCriteria
GitQueryCommitsCriteria

Search options

repositoryId

string

The name or ID of the repository.

project

string

Project ID or project name

skip

number

Number of commits to skip. The value cannot exceed 3,000,000.

top

number

Maximum number of commits to return. The value cannot exceed 50,000.

includeStatuses

boolean

True to include additional commit status information.

Returns

Promise<GitCommitRef[]>

getDeletedRepositories(string)

Retrieve deleted git repositories.

function getDeletedRepositories(project: string): Promise<GitDeletedRepository[]>

Parameters

project

string

Project ID or project name

Returns

getEnablementStatus(string[], Date, number, number)

GET Enablement status for project's repositories.

function getEnablementStatus(projectIds?: string[], billingDate?: Date, skip?: number, take?: number): Promise<AdvSecEnablementStatus[]>

Parameters

projectIds

string[]

Null defaults to all projects in the host, list of project's repos status to return

billingDate

Date

UTC expected, Null defaults to UtcNow(), can be provided for a point in time status

skip

number

Skip X rows of resultset to simulate paging.

take

number

Return Y rows of resultset to simulate paging.

Returns

getEnableOnCreateHost(boolean)

function getEnableOnCreateHost(enableOnCreateHost: boolean): Promise<boolean>

Parameters

enableOnCreateHost

boolean

Returns

Promise<boolean>

getEnableOnCreateProject(string)

function getEnableOnCreateProject(enableOnCreateProjectId: string): Promise<boolean>

Parameters

enableOnCreateProjectId

string

Returns

Promise<boolean>

getEstimatedBillableCommittersRepo(string, string)

Get estimated billable committers for a repository for the last 90 days.

function getEstimatedBillableCommittersRepo(project: string, repositoryId: string): Promise<BillableCommitter[]>

Parameters

project

string

Project ID or project name

repositoryId

string

Returns

Promise<BillableCommitter[]>

getEstimatedBillablePushersOrg()

Get estimated billable pushers for an Organization for last 90 days.

function getEstimatedBillablePushersOrg(): Promise<BillablePusher[]>

Returns

Promise<BillablePusher[]>

getEstimatedBillablePushersProject(string)

Get estimated billable pushers for a project for last 90 days.

function getEstimatedBillablePushersProject(project: string): Promise<BillablePusher[]>

Parameters

project

string

Project ID or project name

Returns

Promise<BillablePusher[]>

getFileDiffs(FileDiffsCriteria, string, string)

Get the file diffs for each of the specified files

function getFileDiffs(fileDiffsCriteria: FileDiffsCriteria, project: string, repositoryId: string): Promise<FileDiff[]>

Parameters

fileDiffsCriteria
FileDiffsCriteria

List of file parameters objects

project

string

Project ID or project name

repositoryId

string

The name or ID of the repository

Returns

Promise<FileDiff[]>

getForks(string, string, string, boolean)

Retrieve all forks of a repository in the collection.

function getForks(repositoryNameOrId: string, collectionId: string, project?: string, includeLinks?: boolean): Promise<GitRepositoryRef[]>

Parameters

repositoryNameOrId

string

The name or ID of the repository.

collectionId

string

Team project collection ID.

project

string

Project ID or project name

includeLinks

boolean

True to include links.

Returns

Promise<GitRepositoryRef[]>

getForkSyncRequest(string, number, string, boolean)

Get a specific fork sync operation's details.

function getForkSyncRequest(repositoryNameOrId: string, forkSyncOperationId: number, project?: string, includeLinks?: boolean): Promise<GitForkSyncRequest>

Parameters

repositoryNameOrId

string

The name or ID of the repository.

forkSyncOperationId

number

OperationId of the sync request.

project

string

Project ID or project name

includeLinks

boolean

True to include links.

Returns

getForkSyncRequests(string, string, boolean, boolean)

Retrieve all requested fork sync operations on this repository.

function getForkSyncRequests(repositoryNameOrId: string, project?: string, includeAbandoned?: boolean, includeLinks?: boolean): Promise<GitForkSyncRequest[]>

Parameters

repositoryNameOrId

string

The name or ID of the repository.

project

string

Project ID or project name

includeAbandoned

boolean

True to include abandoned requests.

includeLinks

boolean

True to include links.

Returns

Promise<GitForkSyncRequest[]>

getImportRequest(string, string, number)

Retrieve a particular import request.

function getImportRequest(project: string, repositoryId: string, importRequestId: number): Promise<GitImportRequest>

Parameters

project

string

Project ID or project name

repositoryId

string

The name or ID of the repository.

importRequestId

number

The unique identifier for the import request.

Returns

Promise<GitImportRequest>

getItem(string, string, string, string, VersionControlRecursionType, boolean, boolean, boolean, GitVersionDescriptor, boolean, boolean, boolean)

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.

function getItem(repositoryId: string, path: string, project?: string, scopePath?: string, recursionLevel?: VersionControlRecursionType, includeContentMetadata?: boolean, latestProcessedChange?: boolean, download?: boolean, versionDescriptor?: GitVersionDescriptor, includeContent?: boolean, resolveLfs?: boolean, sanitize?: boolean): Promise<GitItem>

Parameters

repositoryId

string

The name or ID of the repository.

path

string

The item path.

project

string

Project ID or project name

scopePath

string

The path scope. The default is null.

recursionLevel
VersionControlRecursionType

The recursion level of this request. The default is 'none', no recursion.

includeContentMetadata

boolean

Set to true to include content metadata. Default is false.

latestProcessedChange

boolean

Set to true to include the latest changes. Default is false.

download

boolean

Set to true to download the response as a file. Default is false.

versionDescriptor
GitVersionDescriptor

Version descriptor. Default is the default branch for the repository.

includeContent

boolean

Set to true to include item content when requesting json. Default is false.

resolveLfs

boolean

Set to true to resolve Git LFS pointer files to return actual content from Git LFS. Default is false.

sanitize

boolean

Set to true to sanitize an svg file and return it as image. Useful only if requested for svg file. Default is false.

Returns

Promise<GitItem>

getItemContent(string, string, string, string, VersionControlRecursionType, boolean, boolean, boolean, GitVersionDescriptor, boolean, boolean, boolean)

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.

function getItemContent(repositoryId: string, path: string, project?: string, scopePath?: string, recursionLevel?: VersionControlRecursionType, includeContentMetadata?: boolean, latestProcessedChange?: boolean, download?: boolean, versionDescriptor?: GitVersionDescriptor, includeContent?: boolean, resolveLfs?: boolean, sanitize?: boolean): Promise<ArrayBuffer>

Parameters

repositoryId

string

The name or ID of the repository.

path

string

The item path.

project

string

Project ID or project name

scopePath

string

The path scope. The default is null.

recursionLevel
VersionControlRecursionType

The recursion level of this request. The default is 'none', no recursion.

includeContentMetadata

boolean

Set to true to include content metadata. Default is false.

latestProcessedChange

boolean

Set to true to include the latest changes. Default is false.

download

boolean

Set to true to download the response as a file. Default is false.

versionDescriptor
GitVersionDescriptor

Version descriptor. Default is the default branch for the repository.

includeContent

boolean

Set to true to include item content when requesting json. Default is false.

resolveLfs

boolean

Set to true to resolve Git LFS pointer files to return actual content from Git LFS. Default is false.

sanitize

boolean

Set to true to sanitize an svg file and return it as image. Useful only if requested for svg file. Default is false.

Returns

Promise<ArrayBuffer>

getItems(string, string, string, VersionControlRecursionType, boolean, boolean, boolean, boolean, GitVersionDescriptor, boolean)

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.

function getItems(repositoryId: string, project?: string, scopePath?: string, recursionLevel?: VersionControlRecursionType, includeContentMetadata?: boolean, latestProcessedChange?: boolean, download?: boolean, includeLinks?: boolean, versionDescriptor?: GitVersionDescriptor, zipForUnix?: boolean): Promise<GitItem[]>

Parameters

repositoryId

string

The name or ID of the repository.

project

string

Project ID or project name

scopePath

string

The path scope. The default is null.

recursionLevel
VersionControlRecursionType

The recursion level of this request. The default is 'none', no recursion.

includeContentMetadata

boolean

Set to true to include content metadata. Default is false.

latestProcessedChange

boolean

Set to true to include the latest changes. Default is false.

download

boolean

Set to true to download the response as a file. Default is false.

includeLinks

boolean

Set to true to include links to items. Default is false.

versionDescriptor
GitVersionDescriptor

Version descriptor. Default is the default branch for the repository.

zipForUnix

boolean

Set to true to keep the file permissions for unix (and POSIX) systems like executables and symlinks

Returns

Promise<GitItem[]>

getItemsBatch(GitItemRequestData, string, string)

Post for retrieving a creating a batch out of a set of items in a repo / project given a list of paths or a long path

function getItemsBatch(requestData: GitItemRequestData, repositoryId: string, project?: string): Promise<GitItem[][]>

Parameters

requestData
GitItemRequestData

Request data attributes: ItemDescriptors, IncludeContentMetadata, LatestProcessedChange, IncludeLinks. ItemDescriptors: Collection of items to fetch, including path, version, and recursion level. IncludeContentMetadata: Whether to include metadata for all items LatestProcessedChange: Whether to include shallow ref to commit that last changed each item. IncludeLinks: Whether to include the _links field on the shallow references.

repositoryId

string

The name or ID of the repository

project

string

Project ID or project name

Returns

Promise<GitItem[][]>

getItemText(string, string, string, string, VersionControlRecursionType, boolean, boolean, boolean, GitVersionDescriptor, boolean, boolean, boolean)

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.

function getItemText(repositoryId: string, path: string, project?: string, scopePath?: string, recursionLevel?: VersionControlRecursionType, includeContentMetadata?: boolean, latestProcessedChange?: boolean, download?: boolean, versionDescriptor?: GitVersionDescriptor, includeContent?: boolean, resolveLfs?: boolean, sanitize?: boolean): Promise<string>

Parameters

repositoryId

string

The name or ID of the repository.

path

string

The item path.

project

string

Project ID or project name

scopePath

string

The path scope. The default is null.

recursionLevel
VersionControlRecursionType

The recursion level of this request. The default is 'none', no recursion.

includeContentMetadata

boolean

Set to true to include content metadata. Default is false.

latestProcessedChange

boolean

Set to true to include the latest changes. Default is false.

download

boolean

Set to true to download the response as a file. Default is false.

versionDescriptor
GitVersionDescriptor

Version descriptor. Default is the default branch for the repository.

includeContent

boolean

Set to true to include item content when requesting json. Default is false.

resolveLfs

boolean

Set to true to resolve Git LFS pointer files to return actual content from Git LFS. Default is false.

sanitize

boolean

Set to true to sanitize an svg file and return it as image. Useful only if requested for svg file. Default is false.

Returns

Promise<string>

getItemZip(string, string, string, string, VersionControlRecursionType, boolean, boolean, boolean, GitVersionDescriptor, boolean, boolean, boolean)

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.

function getItemZip(repositoryId: string, path: string, project?: string, scopePath?: string, recursionLevel?: VersionControlRecursionType, includeContentMetadata?: boolean, latestProcessedChange?: boolean, download?: boolean, versionDescriptor?: GitVersionDescriptor, includeContent?: boolean, resolveLfs?: boolean, sanitize?: boolean): Promise<ArrayBuffer>

Parameters

repositoryId

string

The name or ID of the repository.

path

string

The item path.

project

string

Project ID or project name

scopePath

string

The path scope. The default is null.

recursionLevel
VersionControlRecursionType

The recursion level of this request. The default is 'none', no recursion.

includeContentMetadata

boolean

Set to true to include content metadata. Default is false.

latestProcessedChange

boolean

Set to true to include the latest changes. Default is false.

download

boolean

Set to true to download the response as a file. Default is false.

versionDescriptor
GitVersionDescriptor

Version descriptor. Default is the default branch for the repository.

includeContent

boolean

Set to true to include item content when requesting json. Default is false.

resolveLfs

boolean

Set to true to resolve Git LFS pointer files to return actual content from Git LFS. Default is false.

sanitize

boolean

Set to true to sanitize an svg file and return it as image. Useful only if requested for svg file. Default is false.

Returns

Promise<ArrayBuffer>

getLikes(string, number, number, number, string)

Get likes for a comment.

function getLikes(repositoryId: string, pullRequestId: number, threadId: number, commentId: number, project?: string): Promise<IdentityRef[]>

Parameters

repositoryId

string

The repository ID of the pull request's target branch.

pullRequestId

number

ID of the pull request.

threadId

number

The ID of the thread that contains the comment.

commentId

number

The ID of the comment.

project

string

Project ID or project name

Returns

Promise<IdentityRef[]>

getMergeBases(string, string, string, string, string, string)

Find the merge bases of two commits, optionally across forks. If otherRepositoryId is not specified, the merge bases will only be calculated within the context of the local repositoryNameOrId.

function getMergeBases(repositoryNameOrId: string, commitId: string, otherCommitId: string, project?: string, otherCollectionId?: string, otherRepositoryId?: string): Promise<GitCommitRef[]>

Parameters

repositoryNameOrId

string

ID or name of the local repository.

commitId

string

First commit, usually the tip of the target branch of the potential merge.

otherCommitId

string

Other commit, usually the tip of the source branch of the potential merge.

project

string

Project ID or project name

otherCollectionId

string

The collection ID where otherCommitId lives.

otherRepositoryId

string

The repository ID where otherCommitId lives.

Returns

Promise<GitCommitRef[]>

getMergeRequest(string, string, number, boolean)

Get a specific merge operation's details.

function getMergeRequest(project: string, repositoryNameOrId: string, mergeOperationId: number, includeLinks?: boolean): Promise<GitMerge>

Parameters

project

string

Project ID or project name

repositoryNameOrId

string

The name or ID of the repository.

mergeOperationId

number

OperationId of the merge request.

includeLinks

boolean

True to include links

Returns

Promise<GitMerge>

getPermission(string, string, string)

GET Advanced Security Permission status.

function getPermission(projectName?: string, repositoryId?: string, permission?: string): Promise<boolean>

Parameters

projectName

string

repositoryId

string

Repository user is trying to access

permission

string

Permission being requestd, must be "viewAlert" "dismissAlert" "manage" "viewEnablement" or "repoRead"

Returns

Promise<boolean>

getPullRequest(string, number, string, number, number, number, boolean, boolean)

Retrieve a pull request.

function getPullRequest(repositoryId: string, pullRequestId: number, project?: string, maxCommentLength?: number, skip?: number, top?: number, includeCommits?: boolean, includeWorkItemRefs?: boolean): Promise<GitPullRequest>

Parameters

repositoryId

string

The repository ID of the pull request's target branch.

pullRequestId

number

The ID of the pull request to retrieve.

project

string

Project ID or project name

maxCommentLength

number

Not used.

skip

number

Not used.

top

number

Not used.

includeCommits

boolean

If true, the pull request will be returned with the associated commits.

includeWorkItemRefs

boolean

If true, the pull request will be returned with the associated work item references.

Returns

Promise<GitPullRequest>

getPullRequestById(number, string)

Retrieve a pull request.

function getPullRequestById(pullRequestId: number, project?: string): Promise<GitPullRequest>

Parameters

pullRequestId

number

The ID of the pull request to retrieve.

project

string

Project ID or project name

Returns

Promise<GitPullRequest>

getPullRequestCommits(string, number, string)

Get the commits for the specified pull request.

function getPullRequestCommits(repositoryId: string, pullRequestId: number, project?: string): Promise<PagedList<GitCommitRef>>

Parameters

repositoryId

string

ID or name of the repository.

pullRequestId

number

ID of the pull request.

project

string

Project ID or project name

Returns

getPullRequestConflict(string, number, number, string)

Retrieve one conflict for a pull request by ID

function getPullRequestConflict(repositoryId: string, pullRequestId: number, conflictId: number, project?: string): Promise<GitConflict>

Parameters

repositoryId

string

pullRequestId

number

conflictId

number

project

string

Project ID or project name

Returns

Promise<GitConflict>

getPullRequestConflicts(string, number, string, number, number, boolean, boolean, boolean)

Retrieve all conflicts for a pull request

function getPullRequestConflicts(repositoryId: string, pullRequestId: number, project?: string, skip?: number, top?: number, includeObsolete?: boolean, excludeResolved?: boolean, onlyResolved?: boolean): Promise<GitConflict[]>

Parameters

repositoryId

string

The repository of the Pull Request.

pullRequestId

number

The pull request ID.

project

string

Project ID or project name

skip

number

Conflicts to skip.

top

number

Conflicts to return after skip.

includeObsolete

boolean

Includes obsolete conflicts.

excludeResolved

boolean

Excludes conflicts already resolved.

onlyResolved

boolean

Returns only the conflicts that are resolved.

Returns

Promise<GitConflict[]>

getPullRequestIteration(string, number, number, string)

Get the specified iteration for a pull request.

function getPullRequestIteration(repositoryId: string, pullRequestId: number, iterationId: number, project?: string): Promise<GitPullRequestIteration>

Parameters

repositoryId

string

ID or name of the repository.

pullRequestId

number

ID of the pull request.

iterationId

number

ID of the pull request iteration to return.

project

string

Project ID or project name

Returns

getPullRequestIterationChanges(string, number, number, string, number, number, number)

Retrieve the changes made in a pull request between two iterations.

function getPullRequestIterationChanges(repositoryId: string, pullRequestId: number, iterationId: number, project?: string, top?: number, skip?: number, compareTo?: number): Promise<GitPullRequestIterationChanges>

Parameters

repositoryId

string

The repository ID of the pull request's target branch.

pullRequestId

number

ID of the pull request.

iterationId

number

ID of the pull request iteration. <br /> Iteration one is the head of the source branch at the time the pull request is created and subsequent iterations are created when there are pushes to the source branch. Allowed values are between 1 and the maximum iteration on this pull request.

project

string

Project ID or project name

top

number

Optional. The number of changes to retrieve. The default value is 100 and the maximum value is 2000.

skip

number

Optional. The number of changes to ignore. For example, to retrieve changes 101-150, set top 50 and skip to 100.

compareTo

number

ID of the pull request iteration to compare against. The default value is zero which indicates the comparison is made against the common commit between the source and target branches

Returns

getPullRequestIterationCommits(string, number, number, string, number, number)

Get the commits for the specified iteration of a pull request.

function getPullRequestIterationCommits(repositoryId: string, pullRequestId: number, iterationId: number, project?: string, top?: number, skip?: number): Promise<GitCommitRef[]>

Parameters

repositoryId

string

ID or name of the repository.

pullRequestId

number

ID of the pull request.

iterationId

number

ID of the iteration from which to get the commits.

project

string

Project ID or project name

top

number

Maximum number of commits to return. The maximum number of commits that can be returned per batch is 500.

skip

number

Number of commits to skip.

Returns

Promise<GitCommitRef[]>

getPullRequestIterations(string, number, string, boolean)

Get the list of iterations for the specified pull request.

function getPullRequestIterations(repositoryId: string, pullRequestId: number, project?: string, includeCommits?: boolean): Promise<GitPullRequestIteration[]>

Parameters

repositoryId

string

ID or name of the repository.

pullRequestId

number

ID of the pull request.

project

string

Project ID or project name

includeCommits

boolean

If true, include the commits associated with each iteration in the response.

Returns

getPullRequestIterationStatus(string, number, number, number, string)

Get the specific pull request iteration status by ID. The status ID is unique within the pull request across all iterations.

function getPullRequestIterationStatus(repositoryId: string, pullRequestId: number, iterationId: number, statusId: number, project?: string): Promise<GitPullRequestStatus>

Parameters

repositoryId

string

The repository ID of the pull request’s target branch.

pullRequestId

number

ID of the pull request.

iterationId

number

ID of the pull request iteration.

statusId

number

ID of the pull request status.

project

string

Project ID or project name

Returns

getPullRequestIterationStatuses(string, number, number, string)

Get all the statuses associated with a pull request iteration.

function getPullRequestIterationStatuses(repositoryId: string, pullRequestId: number, iterationId: number, project?: string): Promise<GitPullRequestStatus[]>

Parameters

repositoryId

string

The repository ID of the pull request’s target branch.

pullRequestId

number

ID of the pull request.

iterationId

number

ID of the pull request iteration.

project

string

Project ID or project name

Returns

getPullRequestLabel(string, number, string, string, string)

Retrieves a single label (tag) that has been assigned to a pull request.

function getPullRequestLabel(repositoryId: string, pullRequestId: number, labelIdOrName: string, project?: string, projectId?: string): Promise<WebApiTagDefinition>

Parameters

repositoryId

string

The repository ID of the pull request’s target branch.

pullRequestId

number

ID of the pull request.

labelIdOrName

string

The name or ID of the label requested.

project

string

Project ID or project name

projectId

string

Project ID or project name.

Returns

getPullRequestLabels(string, number, string, string)

Get all the labels (tags) assigned to a pull request.

function getPullRequestLabels(repositoryId: string, pullRequestId: number, project?: string, projectId?: string): Promise<WebApiTagDefinition[]>

Parameters

repositoryId

string

The repository ID of the pull request’s target branch.

pullRequestId

number

ID of the pull request.

project

string

Project ID or project name

projectId

string

Project ID or project name.

Returns

Promise<WebApiTagDefinition[]>

getPullRequestProperties(string, number, string)

Get external properties of the pull request.

function getPullRequestProperties(repositoryId: string, pullRequestId: number, project?: string): Promise<any>

Parameters

repositoryId

string

The repository ID of the pull request’s target branch.

pullRequestId

number

ID of the pull request.

project

string

Project ID or project name

Returns

Promise<any>

getPullRequestQuery(GitPullRequestQuery, string, string)

This API is used to find what pull requests are related to a given commit. It can be used to either find the pull request that created a particular merge commit or it can be used to find all pull requests that have ever merged a particular commit. The input is a list of queries which each contain a list of commits. For each commit that you search against, you will get back a dictionary of commit -> pull requests.

function getPullRequestQuery(queries: GitPullRequestQuery, repositoryId: string, project?: string): Promise<GitPullRequestQuery>

Parameters

queries
GitPullRequestQuery

The list of queries to perform.

repositoryId

string

ID of the repository.

project

string

Project ID or project name

Returns

getPullRequestReviewer(string, number, string, string)

Retrieve information about a particular reviewer on a pull request

function getPullRequestReviewer(repositoryId: string, pullRequestId: number, reviewerId: string, project?: string): Promise<IdentityRefWithVote>

Parameters

repositoryId

string

The repository ID of the pull request's target branch.

pullRequestId

number

ID of the pull request.

reviewerId

string

ID of the reviewer.

project

string

Project ID or project name

Returns

getPullRequestReviewers(string, number, string)

Retrieve the reviewers for a pull request

function getPullRequestReviewers(repositoryId: string, pullRequestId: number, project?: string): Promise<IdentityRefWithVote[]>

Parameters

repositoryId

string

The repository ID of the pull request's target branch.

pullRequestId

number

ID of the pull request.

project

string

Project ID or project name

Returns

Promise<IdentityRefWithVote[]>

getPullRequests(string, GitPullRequestSearchCriteria, string, number, number, number)

Retrieve all pull requests matching a specified criteria.

function getPullRequests(repositoryId: string, searchCriteria: GitPullRequestSearchCriteria, project?: string, maxCommentLength?: number, skip?: number, top?: number): Promise<GitPullRequest[]>

Parameters

repositoryId

string

The repository ID of the pull request's target branch.

searchCriteria
GitPullRequestSearchCriteria

Pull requests will be returned that match this search criteria.

project

string

Project ID or project name

maxCommentLength

number

Not used.

skip

number

The number of pull requests to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100.

top

number

The number of pull requests to retrieve.

Returns

Promise<GitPullRequest[]>

getPullRequestsByProject(string, GitPullRequestSearchCriteria, number, number, number)

Retrieve all pull requests matching a specified criteria.

function getPullRequestsByProject(project: string, searchCriteria: GitPullRequestSearchCriteria, maxCommentLength?: number, skip?: number, top?: number): Promise<GitPullRequest[]>

Parameters

project

string

Project ID or project name

searchCriteria
GitPullRequestSearchCriteria

Pull requests will be returned that match this search criteria.

maxCommentLength

number

Not used.

skip

number

The number of pull requests to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100.

top

number

The number of pull requests to retrieve.

Returns

Promise<GitPullRequest[]>

getPullRequestStatus(string, number, number, string)

Get the specific pull request status by ID. The status ID is unique within the pull request across all iterations.

function getPullRequestStatus(repositoryId: string, pullRequestId: number, statusId: number, project?: string): Promise<GitPullRequestStatus>

Parameters

repositoryId

string

The repository ID of the pull request’s target branch.

pullRequestId

number

ID of the pull request.

statusId

number

ID of the pull request status.

project

string

Project ID or project name

Returns

getPullRequestStatuses(string, number, string)

Get all the statuses associated with a pull request.

function getPullRequestStatuses(repositoryId: string, pullRequestId: number, project?: string): Promise<GitPullRequestStatus[]>

Parameters

repositoryId

string

The repository ID of the pull request’s target branch.

pullRequestId

number

ID of the pull request.

project

string

Project ID or project name

Returns

getPullRequestThread(string, number, number, string, number, number)

Retrieve a thread in a pull request.

function getPullRequestThread(repositoryId: string, pullRequestId: number, threadId: number, project?: string, iteration?: number, baseIteration?: number): Promise<GitPullRequestCommentThread>

Parameters

repositoryId

string

The repository ID of the pull request's target branch.

pullRequestId

number

ID of the pull request.

threadId

number

ID of the thread.

project

string

Project ID or project name

iteration

number

If specified, thread position will be tracked using this iteration as the right side of the diff.

baseIteration

number

If specified, thread position will be tracked using this iteration as the left side of the diff.

Returns

getPullRequestWorkItemRefs(string, number, string)

Retrieve a list of work items associated with a pull request.

function getPullRequestWorkItemRefs(repositoryId: string, pullRequestId: number, project?: string): Promise<ResourceRef[]>

Parameters

repositoryId

string

ID or name of the repository.

pullRequestId

number

ID of the pull request.

project

string

Project ID or project name

Returns

Promise<ResourceRef[]>

getPush(string, number, string, number, boolean)

Retrieves a particular push.

function getPush(repositoryId: string, pushId: number, project?: string, includeCommits?: number, includeRefUpdates?: boolean): Promise<GitPush>

Parameters

repositoryId

string

The name or ID of the repository.

pushId

number

ID of the push.

project

string

Project ID or project name

includeCommits

number

The number of commits to include in the result.

includeRefUpdates

boolean

If true, include the list of refs that were updated by the push.

Returns

Promise<GitPush>

getPushCommits(string, number, string, number, number, boolean)

Retrieve a list of commits associated with a particular push.

function getPushCommits(repositoryId: string, pushId: number, project?: string, top?: number, skip?: number, includeLinks?: boolean): Promise<GitCommitRef[]>

Parameters

repositoryId

string

The id or friendly name of the repository. To use the friendly name, projectId must also be specified.

pushId

number

The id of the push.

project

string

Project ID or project name

top

number

The maximum number of commits to return ("get the top x commits").

skip

number

The number of commits to skip.

includeLinks

boolean

Set to false to avoid including REST Url links for resources. Defaults to true.

Returns

Promise<GitCommitRef[]>

getPushes(string, string, number, number, GitPushSearchCriteria)

Retrieves pushes associated with the specified repository.

function getPushes(repositoryId: string, project?: string, skip?: number, top?: number, searchCriteria?: GitPushSearchCriteria): Promise<GitPush[]>

Parameters

repositoryId

string

The name or ID of the repository.

project

string

Project ID or project name

skip

number

Number of pushes to skip.

top

number

Number of pushes to return.

searchCriteria
GitPushSearchCriteria

Search criteria attributes: fromDate, toDate, pusherId, refName, includeRefUpdates or includeLinks. fromDate: Start date to search from. toDate: End date to search to. pusherId: Identity of the person who submitted the push. refName: Branch name to consider. includeRefUpdates: If true, include the list of refs that were updated by the push. includeLinks: Whether to include the _links field on the shallow references.

Returns

Promise<GitPush[]>

getRecycleBinRepositories(string)

Retrieve soft-deleted git repositories from the recycle bin.

function getRecycleBinRepositories(project: string): Promise<GitDeletedRepository[]>

Parameters

project

string

Project ID or project name

Returns

getRefFavorite(string, number)

Gets the refs favorite for a favorite Id.

function getRefFavorite(project: string, favoriteId: number): Promise<GitRefFavorite>

Parameters

project

string

Project ID or project name

favoriteId

number

The Id of the requested ref favorite.

Returns

Promise<GitRefFavorite>

getRefFavorites(string, string, string)

Gets the refs favorites for a repo and an identity.

function getRefFavorites(project: string, repositoryId?: string, identityId?: string): Promise<GitRefFavorite[]>

Parameters

project

string

Project ID or project name

repositoryId

string

The id of the repository.

identityId

string

The id of the identity whose favorites are to be retrieved. If null, the requesting identity is used.

Returns

Promise<GitRefFavorite[]>

getRefFavoritesForProject(string, string)

function getRefFavoritesForProject(project: string, identityId?: string): Promise<GitRefFavorite[]>

Parameters

project

string

Project ID or project name

identityId

string

Returns

Promise<GitRefFavorite[]>

getRefs(string, string, string, boolean, boolean, boolean, boolean, boolean, string)

Queries the provided repository for its refs and returns them.

function getRefs(repositoryId: string, project?: string, filter?: string, includeLinks?: boolean, includeStatuses?: boolean, includeMyBranches?: boolean, latestStatusesOnly?: boolean, peelTags?: boolean, filterContains?: string): Promise<PagedList<GitRef>>

Parameters

repositoryId

string

The name or ID of the repository.

project

string

Project ID or project name

filter

string

[optional] A filter to apply to the refs (starts with).

includeLinks

boolean

[optional] Specifies if referenceLinks should be included in the result. default is false.

includeStatuses

boolean

[optional] Includes up to the first 1000 commit statuses for each ref. The default value is false.

includeMyBranches

boolean

[optional] Includes only branches that the user owns, the branches the user favorites, and the default branch. The default value is false. Cannot be combined with the filter parameter.

latestStatusesOnly

boolean

[optional] True to include only the tip commit status for each ref. This option requires includeStatuses to be true. The default value is false.

peelTags

boolean

[optional] Annotated tags will populate the PeeledObjectId property. default is false.

filterContains

string

[optional] A filter to apply to the refs (contains).

Returns

Promise<PagedList<GitRef>>

getRepositories(string, boolean, boolean, boolean)

Retrieve git repositories.

function getRepositories(project?: string, includeLinks?: boolean, includeAllUrls?: boolean, includeHidden?: boolean): Promise<GitRepository[]>

Parameters

project

string

Project ID or project name

includeLinks

boolean

[optional] True to include reference links. The default value is false.

includeAllUrls

boolean

[optional] True to include all remote URLs. The default value is false.

includeHidden

boolean

[optional] True to include hidden repositories. The default value is false.

Returns

Promise<GitRepository[]>

getRepository(string, string)

Retrieve a git repository.

function getRepository(repositoryId: string, project?: string): Promise<GitRepository>

Parameters

repositoryId

string

The name or ID of the repository.

project

string

Project ID or project name

Returns

Promise<GitRepository>

getRepositoryWithParent(string, boolean, string)

Retrieve a git repository.

function getRepositoryWithParent(repositoryId: string, includeParent: boolean, project?: string): Promise<GitRepository>

Parameters

repositoryId

string

The name or ID of the repository.

includeParent

boolean

True to include parent repository. Only available in authenticated calls.

project

string

Project ID or project name

Returns

Promise<GitRepository>

getRevert(string, number, string)

Retrieve information about a revert operation by revert Id.

function getRevert(project: string, revertId: number, repositoryId: string): Promise<GitRevert>

Parameters

project

string

Project ID or project name

revertId

number

ID of the revert operation.

repositoryId

string

ID of the repository.

Returns

Promise<GitRevert>

getRevertConflict(string, number, number, string)

Retrieve one conflict for a revert by ID

function getRevertConflict(repositoryId: string, revertId: number, conflictId: number, project?: string): Promise<GitConflict>

Parameters

repositoryId

string

revertId

number

conflictId

number

project

string

Project ID or project name

Returns

Promise<GitConflict>

getRevertConflicts(string, number, string, string, number, boolean, boolean, boolean)

Retrieve all conflicts for a revert

function getRevertConflicts(repositoryId: string, revertId: number, project?: string, continuationToken?: string, top?: number, excludeResolved?: boolean, onlyResolved?: boolean, includeObsolete?: boolean): Promise<PagedList<GitConflict>>

Parameters

repositoryId

string

revertId

number

project

string

Project ID or project name

continuationToken

string

top

number

excludeResolved

boolean

onlyResolved

boolean

includeObsolete

boolean

Returns

getRevertForRefName(string, string, string)

Retrieve information about a revert operation for a specific branch.

function getRevertForRefName(project: string, repositoryId: string, refName: string): Promise<GitRevert>

Parameters

project

string

Project ID or project name

repositoryId

string

ID of the repository.

refName

string

The GitAsyncRefOperationParameters generatedRefName used for the revert operation.

Returns

Promise<GitRevert>

getStatuses(string, string, string, number, number, boolean)

Get statuses associated with the Git commit.

function getStatuses(commitId: string, repositoryId: string, project?: string, top?: number, skip?: number, latestOnly?: boolean): Promise<GitStatus[]>

Parameters

commitId

string

ID of the Git commit.

repositoryId

string

ID of the repository.

project

string

Project ID or project name

top

number

Optional. The number of statuses to retrieve. Default is 1000.

skip

number

Optional. The number of statuses to ignore. Default is 0. For example, to retrieve results 101-150, set top to 50 and skip to 100.

latestOnly

boolean

The flag indicates whether to get only latest statuses grouped by Context.Name and Context.Genre.

Returns

Promise<GitStatus[]>

getSuggestions(string, string, boolean)

Retrieve a pull request suggestion for a particular repository or team project.

function getSuggestions(repositoryId: string, project?: string, preferCompareBranch?: boolean): Promise<GitSuggestion[]>

Parameters

repositoryId

string

ID of the git repository.

project

string

Project ID or project name

preferCompareBranch

boolean

If true, prefer the compare branch over the default branch as target branch for pull requests.

Returns

Promise<GitSuggestion[]>

getThreads(string, number, string, number, number)

Retrieve all threads in a pull request.

function getThreads(repositoryId: string, pullRequestId: number, project?: string, iteration?: number, baseIteration?: number): Promise<GitPullRequestCommentThread[]>

Parameters

repositoryId

string

The repository ID of the pull request's target branch.

pullRequestId

number

ID of the pull request.

project

string

Project ID or project name

iteration

number

If specified, thread positions will be tracked using this iteration as the right side of the diff.

baseIteration

number

If specified, thread positions will be tracked using this iteration as the left side of the diff.

Returns

getTree(string, string, string, string, boolean, string)

The Tree endpoint returns the collection of objects underneath the specified tree. Trees are folders in a Git repository.

function getTree(repositoryId: string, sha1: string, project?: string, projectId?: string, recursive?: boolean, fileName?: string): Promise<GitTreeRef>

Parameters

repositoryId

string

Repository Id.

sha1

string

SHA1 hash of the tree object.

project

string

Project ID or project name

projectId

string

Project Id.

recursive

boolean

Search recursively. Include trees underneath this tree. Default is false.

fileName

string

Name to use if a .zip file is returned. Default is the object ID.

Returns

Promise<GitTreeRef>

getTreeZip(string, string, string, string, boolean, string)

The Tree endpoint returns the collection of objects underneath the specified tree. Trees are folders in a Git repository.

function getTreeZip(repositoryId: string, sha1: string, project?: string, projectId?: string, recursive?: boolean, fileName?: string): Promise<ArrayBuffer>

Parameters

repositoryId

string

Repository Id.

sha1

string

SHA1 hash of the tree object.

project

string

Project ID or project name

projectId

string

Project Id.

recursive

boolean

Search recursively. Include trees underneath this tree. Default is false.

fileName

string

Name to use if a .zip file is returned. Default is the object ID.

Returns

Promise<ArrayBuffer>

queryImportRequests(string, string, boolean)

Retrieve import requests for a repository.

function queryImportRequests(project: string, repositoryId: string, includeAbandoned?: boolean): Promise<GitImportRequest[]>

Parameters

project

string

Project ID or project name

repositoryId

string

The name or ID of the repository.

includeAbandoned

boolean

True to include abandoned import requests in the results.

Returns

Promise<GitImportRequest[]>

restoreRepositoryFromRecycleBin(GitRecycleBinRepositoryDetails, string, string)

Recover a soft-deleted Git repository. Recently deleted repositories go into a soft-delete state for a period of time before they are hard deleted and become unrecoverable.

function restoreRepositoryFromRecycleBin(repositoryDetails: GitRecycleBinRepositoryDetails, project: string, repositoryId: string): Promise<GitRepository>

Parameters

repositoryDetails
GitRecycleBinRepositoryDetails
project

string

Project ID or project name

repositoryId

string

The ID of the repository.

Returns

Promise<GitRepository>

setEnableOnCreateHost(boolean)

function setEnableOnCreateHost(enableOnCreateHost: boolean): Promise<void>

Parameters

enableOnCreateHost

boolean

Returns

Promise<void>

setEnableOnCreateProject(string, boolean)

function setEnableOnCreateProject(enableOnCreateProjectId: string, enableOnStatus: boolean): Promise<void>

Parameters

enableOnCreateProjectId

string

enableOnStatus

boolean

Returns

Promise<void>

sharePullRequest(ShareNotificationContext, string, number, string)

Sends an e-mail notification about a specific pull request to a set of recipients

function sharePullRequest(userMessage: ShareNotificationContext, repositoryId: string, pullRequestId: number, project?: string): Promise<void>

Parameters

repositoryId

string

ID of the git repository.

pullRequestId

number

ID of the pull request.

project

string

Project ID or project name

Returns

Promise<void>

updateCherryPickConflict(GitConflict, string, number, number, string)

Update merge conflict resolution

function updateCherryPickConflict(conflict: GitConflict, repositoryId: string, cherryPickId: number, conflictId: number, project?: string): Promise<GitConflict>

Parameters

conflict
GitConflict
repositoryId

string

cherryPickId

number

conflictId

number

project

string

Project ID or project name

Returns

Promise<GitConflict>

updateCherryPickConflicts(GitConflict[], string, number, string)

Update multiple merge conflict resolutions

function updateCherryPickConflicts(conflictUpdates: GitConflict[], repositoryId: string, cherryPickId: number, project?: string): Promise<GitConflictUpdateResult[]>

Parameters

conflictUpdates

GitConflict[]

repositoryId

string

cherryPickId

number

project

string

Project ID or project name

Returns

updateComment(Comment, string, number, number, number, string)

Update a comment associated with a specific thread in a pull request.

function updateComment(comment: Comment, repositoryId: string, pullRequestId: number, threadId: number, commentId: number, project?: string): Promise<Comment>

Parameters

comment
Comment

The comment content that should be updated. Comments can be up to 150,000 characters.

repositoryId

string

The repository ID of the pull request's target branch.

pullRequestId

number

ID of the pull request.

threadId

number

ID of the thread that the desired comment is in.

commentId

number

ID of the comment to update.

project

string

Project ID or project name

Returns

Promise<Comment>

updateEnablementStatus(AdvSecEnablementUpdate[])

POST Enablement status for repositories.

function updateEnablementStatus(enablementUpdates: AdvSecEnablementUpdate[]): Promise<void>

Parameters

enablementUpdates

AdvSecEnablementUpdate[]

Returns

Promise<void>

updateImportRequest(GitImportRequest, string, string, number)

Retry or abandon a failed import request.

function updateImportRequest(importRequestToUpdate: GitImportRequest, project: string, repositoryId: string, importRequestId: number): Promise<GitImportRequest>

Parameters

importRequestToUpdate
GitImportRequest

The updated version of the import request. Currently, the only change allowed is setting the Status to Queued or Abandoned.

project

string

Project ID or project name

repositoryId

string

The name or ID of the repository.

importRequestId

number

The unique identifier for the import request to update.

Returns

Promise<GitImportRequest>

updatePullRequest(GitPullRequest, string, number, string)

Update a pull request

function updatePullRequest(gitPullRequestToUpdate: GitPullRequest, repositoryId: string, pullRequestId: number, project?: string): Promise<GitPullRequest>

Parameters

gitPullRequestToUpdate
GitPullRequest

The pull request content that should be updated.

repositoryId

string

The repository ID of the pull request's target branch.

pullRequestId

number

ID of the pull request to update.

project

string

Project ID or project name

Returns

Promise<GitPullRequest>

updatePullRequestConflict(GitConflict, string, number, number, string)

Update merge conflict resolution

function updatePullRequestConflict(conflict: GitConflict, repositoryId: string, pullRequestId: number, conflictId: number, project?: string): Promise<GitConflict>

Parameters

conflict
GitConflict
repositoryId

string

pullRequestId

number

conflictId

number

project

string

Project ID or project name

Returns

Promise<GitConflict>

updatePullRequestConflicts(GitConflict[], string, number, string)

Update multiple merge conflict resolutions

function updatePullRequestConflicts(conflictUpdates: GitConflict[], repositoryId: string, pullRequestId: number, project?: string): Promise<GitConflictUpdateResult[]>

Parameters

conflictUpdates

GitConflict[]

repositoryId

string

pullRequestId

number

project

string

Project ID or project name

Returns

updatePullRequestIterationStatuses(JsonPatchDocument, string, number, number, string)

Update pull request iteration statuses collection. The only supported operation type is remove.

function updatePullRequestIterationStatuses(patchDocument: JsonPatchDocument, repositoryId: string, pullRequestId: number, iterationId: number, project?: string): Promise<void>

Parameters

patchDocument
JsonPatchDocument

Operations to apply to the pull request statuses in JSON Patch format.

repositoryId

string

The repository ID of the pull request’s target branch.

pullRequestId

number

ID of the pull request.

iterationId

number

ID of the pull request iteration.

project

string

Project ID or project name

Returns

Promise<void>

updatePullRequestProperties(JsonPatchDocument, string, number, string)

Create or update pull request external properties. The patch operation can be add, replace or remove. For add operation, the path can be empty. If the path is empty, the value must be a list of key value pairs. For replace operation, the path cannot be empty. If the path does not exist, the property will be added to the collection. For remove operation, the path cannot be empty. If the path does not exist, no action will be performed.

function updatePullRequestProperties(patchDocument: JsonPatchDocument, repositoryId: string, pullRequestId: number, project?: string): Promise<any>

Parameters

patchDocument
JsonPatchDocument

Properties to add, replace or remove in JSON Patch format.

repositoryId

string

The repository ID of the pull request’s target branch.

pullRequestId

number

ID of the pull request.

project

string

Project ID or project name

Returns

Promise<any>

updatePullRequestReviewer(IdentityRefWithVote, string, number, string, string)

Edit a reviewer entry. These fields are patchable: isFlagged, hasDeclined

function updatePullRequestReviewer(reviewer: IdentityRefWithVote, repositoryId: string, pullRequestId: number, reviewerId: string, project?: string): Promise<IdentityRefWithVote>

Parameters

reviewer
IdentityRefWithVote

Reviewer data.<br />If the reviewer's ID is included here, it must match the reviewerID parameter.

repositoryId

string

The repository ID of the pull request's target branch.

pullRequestId

number

ID of the pull request.

reviewerId

string

ID of the reviewer.

project

string

Project ID or project name

Returns

updatePullRequestReviewers(IdentityRefWithVote[], string, number, string)

Reset the votes of multiple reviewers on a pull request. NOTE: This endpoint only supports updating votes, but does not support updating required reviewers (use policy) or display names.

function updatePullRequestReviewers(patchVotes: IdentityRefWithVote[], repositoryId: string, pullRequestId: number, project?: string): Promise<void>

Parameters

patchVotes

IdentityRefWithVote[]

IDs of the reviewers whose votes will be reset to zero

repositoryId

string

The repository ID of the pull request's target branch.

pullRequestId

number

ID of the pull request

project

string

Project ID or project name

Returns

Promise<void>

updatePullRequestStatuses(JsonPatchDocument, string, number, string)

Update pull request statuses collection. The only supported operation type is remove.

function updatePullRequestStatuses(patchDocument: JsonPatchDocument, repositoryId: string, pullRequestId: number, project?: string): Promise<void>

Parameters

patchDocument
JsonPatchDocument

Operations to apply to the pull request statuses in JSON Patch format.

repositoryId

string

The repository ID of the pull request’s target branch.

pullRequestId

number

ID of the pull request.

project

string

Project ID or project name

Returns

Promise<void>

updateRef(GitRefUpdate, string, string, string, string)

Lock or Unlock a branch.

function updateRef(newRefInfo: GitRefUpdate, repositoryId: string, filter: string, project?: string, projectId?: string): Promise<GitRef>

Parameters

newRefInfo
GitRefUpdate

The ref update action (lock/unlock) to perform

repositoryId

string

The name or ID of the repository.

filter

string

The name of the branch to lock/unlock

project

string

Project ID or project name

projectId

string

ID or name of the team project. Optional if specifying an ID for repository.

Returns

Promise<GitRef>

updateRefs(GitRefUpdate[], string, string, string)

Creating, updating, or deleting refs(branches).

function updateRefs(refUpdates: GitRefUpdate[], repositoryId: string, project?: string, projectId?: string): Promise<GitRefUpdateResult[]>

Parameters

refUpdates

GitRefUpdate[]

List of ref updates to attempt to perform

repositoryId

string

The name or ID of the repository.

project

string

Project ID or project name

projectId

string

ID or name of the team project. Optional if specifying an ID for repository.

Returns

Promise<GitRefUpdateResult[]>

updateRepository(GitRepository, string, string)

Updates the Git repository with either a new repo name or a new default branch.

function updateRepository(newRepositoryInfo: GitRepository, repositoryId: string, project?: string): Promise<GitRepository>

Parameters

newRepositoryInfo
GitRepository

Specify a new repo name or a new default branch of the repository

repositoryId

string

The ID of the repository.

project

string

Project ID or project name

Returns

Promise<GitRepository>

updateRevertConflict(GitConflict, string, number, number, string)

Update merge conflict resolution

function updateRevertConflict(conflict: GitConflict, repositoryId: string, revertId: number, conflictId: number, project?: string): Promise<GitConflict>

Parameters

conflict
GitConflict
repositoryId

string

revertId

number

conflictId

number

project

string

Project ID or project name

Returns

Promise<GitConflict>

updateRevertConflicts(GitConflict[], string, number, string)

Update multiple merge conflict resolutions

function updateRevertConflicts(conflictUpdates: GitConflict[], repositoryId: string, revertId: number, project?: string): Promise<GitConflictUpdateResult[]>

Parameters

conflictUpdates

GitConflict[]

repositoryId

string

revertId

number

project

string

Project ID or project name

Returns

updateThread(GitPullRequestCommentThread, string, number, number, string)

Update a thread in a pull request.

function updateThread(commentThread: GitPullRequestCommentThread, repositoryId: string, pullRequestId: number, threadId: number, project?: string): Promise<GitPullRequestCommentThread>

Parameters

commentThread
GitPullRequestCommentThread

The thread content that should be updated.

repositoryId

string

The repository ID of the pull request's target branch.

pullRequestId

number

ID of the pull request.

threadId

number

ID of the thread to update.

project

string

Project ID or project name

Returns