git

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package git exposes the Azure DevOps Git service: repositories, refs/branches, commits, file contents, pull requests, PR threads/comments and reviewer votes.

Index

Constants

View Source
const Name = "git"

Name is the toolset name used for enable/disable filtering.

Variables

This section is empty.

Functions

func Register

func Register(s *server.Server, c *ado.Clients)

Register adds the Git toolset to the server.

Types

type AddPRCommentInput

type AddPRCommentInput struct {
	Project       string `json:"project" jsonschema:"project name or ID"`
	Repo          string `json:"repo" jsonschema:"repository name or ID"`
	PullRequestID int    `json:"pullRequestId" jsonschema:"pull request ID"`
	Content       string `json:"content" jsonschema:"comment text"`
}

AddPRCommentInput adds a comment.

type AddReviewerInput

type AddReviewerInput struct {
	Project       string `json:"project" jsonschema:"project name or ID"`
	Repo          string `json:"repo" jsonschema:"repository name or ID"`
	PullRequestID int    `json:"pullRequestId" jsonschema:"pull request ID"`
	ReviewerID    string `json:"reviewerId" jsonschema:"reviewer identity ID"`
	Required      bool   `json:"required,omitempty" jsonschema:"mark the reviewer as required (optional)"`
}

AddReviewerInput adds or updates a reviewer on a pull request.

type AnnotatedTag added in v0.1.2

type AnnotatedTag struct {
	ObjectID     string `json:"objectId,omitempty"`
	Name         string `json:"name,omitempty"`
	Message      string `json:"message,omitempty"`
	TaggedBy     any    `json:"taggedBy,omitempty"`
	TaggedObject any    `json:"taggedObject,omitempty"`
	URL          string `json:"url,omitempty"`
}

AnnotatedTag is a Git annotated tag object.

type AnnotatedTagInput added in v0.1.2

type AnnotatedTagInput struct {
	Project  string `json:"project" jsonschema:"project name or ID"`
	Repo     string `json:"repo" jsonschema:"repository name or ID"`
	ObjectID string `json:"objectId" jsonschema:"annotated tag object ID"`
}

AnnotatedTagInput identifies an annotated tag object.

type Commit

type Commit struct {
	CommitID string `json:"commitId"`
	Comment  string `json:"comment,omitempty"`
	Author   any    `json:"author,omitempty"`
	URL      string `json:"url,omitempty"`
}

Commit is a Git commit.

type CommitStatus

type CommitStatus struct {
	State       string `json:"state,omitempty"`
	Description string `json:"description,omitempty"`
	TargetURL   string `json:"targetUrl,omitempty"`
	Context     any    `json:"context,omitempty"`
	CreatedDate string `json:"createdDate,omitempty"`
}

CommitStatus is a status posted against a commit (e.g. a CI build result).

type CreateAnnotatedTagInput added in v0.1.2

type CreateAnnotatedTagInput struct {
	Project        string `json:"project" jsonschema:"project name or ID"`
	Repo           string `json:"repo" jsonschema:"repository name or ID"`
	Name           string `json:"name" jsonschema:"tag name, e.g. v1.0.0"`
	TargetObjectID string `json:"targetObjectId" jsonschema:"object ID (usually a commit SHA) the tag should point at"`
	Message        string `json:"message,omitempty" jsonschema:"tag message (optional)"`
}

CreateAnnotatedTagInput describes a new annotated tag.

type CreateBranchInput

type CreateBranchInput struct {
	Project string `json:"project" jsonschema:"project name or ID"`
	Repo    string `json:"repo" jsonschema:"repository name or ID"`
	Branch  string `json:"branch" jsonschema:"new branch name, e.g. feature/x or refs/heads/feature/x"`
	SHA     string `json:"sha" jsonschema:"commit SHA the new branch should point at"`
}

CreateBranchInput describes a new branch.

type CreateCommitStatusInput

type CreateCommitStatusInput struct {
	Project      string `json:"project" jsonschema:"project name or ID"`
	Repo         string `json:"repo" jsonschema:"repository name or ID"`
	CommitID     string `json:"commitId" jsonschema:"commit SHA"`
	State        string `json:"state" jsonschema:"status state: succeeded, failed, pending, error, or notApplicable"`
	Description  string `json:"description,omitempty" jsonschema:"status description (optional)"`
	TargetURL    string `json:"targetUrl,omitempty" jsonschema:"URL with more details (optional)"`
	ContextName  string `json:"contextName" jsonschema:"status context name"`
	ContextGenre string `json:"contextGenre,omitempty" jsonschema:"status context genre (optional)"`
}

CreateCommitStatusInput describes a new commit status.

type CreatePullRequestInput

type CreatePullRequestInput struct {
	Project      string `json:"project" jsonschema:"project name or ID"`
	Repo         string `json:"repo" jsonschema:"repository name or ID"`
	SourceBranch string `json:"sourceBranch" jsonschema:"source branch, e.g. refs/heads/feature or feature"`
	TargetBranch string `json:"targetBranch" jsonschema:"target branch, e.g. refs/heads/main or main"`
	Title        string `json:"title" jsonschema:"pull request title"`
	Description  string `json:"description,omitempty" jsonschema:"pull request description (optional)"`
	IsDraft      bool   `json:"isDraft,omitempty" jsonschema:"create as a draft (optional)"`
}

CreatePullRequestInput describes a new pull request.

type CreateRepositoryInput

type CreateRepositoryInput struct {
	Project string `json:"project" jsonschema:"project name or ID"`
	Name    string `json:"name" jsonschema:"new repository name"`
}

CreateRepositoryInput describes a new repository.

type DeleteRepositoryInput

type DeleteRepositoryInput struct {
	RepoID string `json:"repoId" jsonschema:"repository ID to delete"`
}

DeleteRepositoryInput identifies a repository to delete.

type GetCommitDiffsInput added in v0.1.2

type GetCommitDiffsInput struct {
	Project           string `json:"project" jsonschema:"project name or ID"`
	Repo              string `json:"repo" jsonschema:"repository name or ID"`
	Base              string `json:"base" jsonschema:"base branch, tag, or commit SHA"`
	Target            string `json:"target" jsonschema:"target branch, tag, or commit SHA"`
	BaseVersionType   string `json:"baseVersionType,omitempty" jsonschema:"type of base: branch (default), tag, or commit"`
	TargetVersionType string `json:"targetVersionType,omitempty" jsonschema:"type of target: branch (default), tag, or commit"`
}

GetCommitDiffsInput compares two versions in a repository.

type GetFileInput

type GetFileInput struct {
	Project string `json:"project" jsonschema:"project name or ID"`
	Repo    string `json:"repo" jsonschema:"repository name or ID"`
	Path    string `json:"path" jsonschema:"file path, e.g. /src/main.go"`
	Branch  string `json:"branch,omitempty" jsonschema:"branch name (optional, defaults to the default branch)"`
}

GetFileInput identifies a file to read.

type ImportRepositoryInput added in v0.1.2

type ImportRepositoryInput struct {
	Project           string `json:"project" jsonschema:"project name or ID"`
	Repo              string `json:"repo" jsonschema:"destination repository name or ID"`
	SourceURL         string `json:"sourceUrl" jsonschema:"URL of the external Git repository to import"`
	ServiceEndpointID string `` /* 130-byte string literal not displayed */
}

ImportRepositoryInput describes an external repository to import.

type ImportRequest added in v0.1.2

type ImportRequest struct {
	ImportRequestID int    `json:"importRequestId,omitempty"`
	Status          string `json:"status,omitempty"`
	URL             string `json:"url,omitempty"`
	Parameters      any    `json:"parameters,omitempty"`
}

ImportRequest is the status of a repository import operation.

type ImportRequestInput added in v0.1.2

type ImportRequestInput struct {
	Project         string `json:"project" jsonschema:"project name or ID"`
	Repo            string `json:"repo" jsonschema:"repository name or ID"`
	ImportRequestID int    `json:"importRequestId" jsonschema:"import request ID"`
}

ImportRequestInput identifies an import request.

type Item

type Item struct {
	Path     string `json:"path"`
	IsFolder bool   `json:"isFolder,omitempty"`
	ObjectID string `json:"objectId,omitempty"`
	CommitID string `json:"commitId,omitempty"`
	Content  string `json:"content,omitempty"`
	URL      string `json:"url,omitempty"`
}

Item is a file or folder in a repository.

type ListCommitStatusesInput

type ListCommitStatusesInput struct {
	Project  string `json:"project" jsonschema:"project name or ID"`
	Repo     string `json:"repo" jsonschema:"repository name or ID"`
	CommitID string `json:"commitId" jsonschema:"commit SHA"`
}

ListCommitStatusesInput identifies a commit whose statuses to list.

type ListCommitsInput

type ListCommitsInput struct {
	Project  string `json:"project" jsonschema:"project name or ID"`
	Repo     string `json:"repo" jsonschema:"repository name or ID"`
	Branch   string `json:"branch,omitempty" jsonschema:"branch name to list commits from (optional)"`
	Author   string `json:"author,omitempty" jsonschema:"filter to commits by this author (name or email, optional)"`
	FromDate string `json:"fromDate,omitempty" jsonschema:"only include commits made on or after this date, e.g. 2024-01-01 (optional)"`
	ToDate   string `json:"toDate,omitempty" jsonschema:"only include commits made on or before this date, e.g. 2024-01-01 (optional)"`
	ItemPath string `json:"itemPath,omitempty" jsonschema:"restrict to commits touching this file or folder path (optional)"`
	Top      int    `json:"top,omitempty" jsonschema:"maximum number of commits (optional)"`
	Skip     int    `json:"skip,omitempty" jsonschema:"number of commits to skip, for paging (optional)"`
}

ListCommitsInput filters commits.

type ListPullRequestsInput

type ListPullRequestsInput struct {
	Project    string `json:"project" jsonschema:"project name or ID"`
	Repo       string `json:"repo" jsonschema:"repository name or ID"`
	Status     string `json:"status,omitempty" jsonschema:"status filter: active, completed, abandoned, or all"`
	CreatorID  string `` /* 154-byte string literal not displayed */
	ReviewerID string `` /* 164-byte string literal not displayed */
	Top        int    `json:"top,omitempty" jsonschema:"maximum number of pull requests (optional)"`
}

ListPullRequestsInput filters pull requests.

type ListPushesInput added in v0.1.2

type ListPushesInput struct {
	Project  string `json:"project" jsonschema:"project name or ID"`
	Repo     string `json:"repo" jsonschema:"repository name or ID"`
	Top      int    `json:"top,omitempty" jsonschema:"maximum number of pushes (optional)"`
	Skip     int    `json:"skip,omitempty" jsonschema:"number of pushes to skip, for paging (optional)"`
	PusherID string `` /* 143-byte string literal not displayed */
}

ListPushesInput filters push history.

type ListRefsInput

type ListRefsInput struct {
	Project            string `json:"project" jsonschema:"project name or ID"`
	Repo               string `json:"repo" jsonschema:"repository name or ID"`
	Filter             string `json:"filter,omitempty" jsonschema:"ref filter, e.g. heads/ for branches or tags/ for tags"`
	IncludeStatuses    bool   `json:"includeStatuses,omitempty" jsonschema:"include commit statuses for each ref (optional)"`
	LatestStatusesOnly bool   `` /* 136-byte string literal not displayed */
	PeelTags           bool   `json:"peelTags,omitempty" jsonschema:"resolve annotated tag object IDs to the commit they point at (optional)"`
	Top                int    `` /* 140-byte string literal not displayed */
	ContinuationToken  string `json:"continuationToken,omitempty" jsonschema:"token from a previous call's response, to fetch the next page (optional)"`
}

ListRefsInput filters refs.

type PRComment

type PRComment struct {
	ID            int    `json:"id,omitempty"`
	ParentID      int    `json:"parentCommentId,omitempty"`
	Content       string `json:"content,omitempty"`
	Author        any    `json:"author,omitempty"`
	PublishedDate string `json:"publishedDate,omitempty"`
}

PRComment is a single comment within a thread.

type PRIteration added in v0.1.2

type PRIteration struct {
	ID              int    `json:"id"`
	Description     string `json:"description,omitempty"`
	CreatedDate     string `json:"createdDate,omitempty"`
	Author          any    `json:"author,omitempty"`
	SourceRefCommit any    `json:"sourceRefCommit,omitempty"`
	TargetRefCommit any    `json:"targetRefCommit,omitempty"`
}

PRIteration is a single iteration (update) of a pull request.

type PRIterationChangesInput added in v0.1.2

type PRIterationChangesInput struct {
	Project       string `json:"project" jsonschema:"project name or ID"`
	Repo          string `json:"repo" jsonschema:"repository name or ID"`
	PullRequestID int    `json:"pullRequestId" jsonschema:"pull request ID"`
	IterationID   int    `json:"iterationId" jsonschema:"pull request iteration ID"`
	Top           int    `json:"top,omitempty" jsonschema:"maximum number of changes (optional)"`
	Skip          int    `json:"skip,omitempty" jsonschema:"number of changes to skip, for paging (optional)"`
}

PRIterationChangesInput identifies a single pull request iteration.

type PRIterationsInput added in v0.1.2

type PRIterationsInput struct {
	Project       string `json:"project" jsonschema:"project name or ID"`
	Repo          string `json:"repo" jsonschema:"repository name or ID"`
	PullRequestID int    `json:"pullRequestId" jsonschema:"pull request ID"`
}

PRIterationsInput identifies a pull request whose iterations to list.

type ProjectInput

type ProjectInput struct {
	Project string `json:"project" jsonschema:"project name or ID"`
}

ProjectInput identifies a project.

type PullRequest

type PullRequest struct {
	PullRequestID int    `json:"pullRequestId"`
	Title         string `json:"title,omitempty"`
	Description   string `json:"description,omitempty"`
	Status        string `json:"status,omitempty"`
	SourceRefName string `json:"sourceRefName,omitempty"`
	TargetRefName string `json:"targetRefName,omitempty"`
	CreatedBy     any    `json:"createdBy,omitempty"`
	URL           string `json:"url,omitempty"`
	IsDraft       bool   `json:"isDraft,omitempty"`
	MergeStatus   string `json:"mergeStatus,omitempty"`
}

PullRequest is a pull request.

type PullRequestInput

type PullRequestInput struct {
	Project       string `json:"project" jsonschema:"project name or ID"`
	Repo          string `json:"repo" jsonschema:"repository name or ID"`
	PullRequestID int    `json:"pullRequestId" jsonschema:"pull request ID"`
}

PullRequestInput identifies a pull request.

type Push

type Push struct {
	PushID  int    `json:"pushId"`
	Date    string `json:"date,omitempty"`
	URL     string `json:"url,omitempty"`
	Commits []struct {
		CommitID string `json:"commitId"`
		Comment  string `json:"comment,omitempty"`
	} `json:"commits,omitempty"`
}

Push is the result of a git push (a new commit pushed to a branch).

type PushFileInput

type PushFileInput struct {
	Project    string `json:"project" jsonschema:"project name or ID"`
	Repo       string `json:"repo" jsonschema:"repository name or ID"`
	Branch     string `json:"branch" jsonschema:"branch name, e.g. main"`
	Path       string `json:"path" jsonschema:"file path, e.g. /src/main.go"`
	Content    string `json:"content,omitempty" jsonschema:"new file content (omit for delete)"`
	Message    string `json:"message" jsonschema:"commit message"`
	ChangeType string `json:"changeType,omitempty" jsonschema:"add (default), edit, or delete"`
}

PushFileInput commits a single file change to a branch.

type Ref

type Ref struct {
	Name     string `json:"name"`
	ObjectID string `json:"objectId,omitempty"`
	Creator  any    `json:"creator,omitempty"`
}

Ref is a Git reference (branch or tag).

type RemoveReviewerInput

type RemoveReviewerInput struct {
	Project       string `json:"project" jsonschema:"project name or ID"`
	Repo          string `json:"repo" jsonschema:"repository name or ID"`
	PullRequestID int    `json:"pullRequestId" jsonschema:"pull request ID"`
	ReviewerID    string `json:"reviewerId" jsonschema:"reviewer identity ID"`
}

RemoveReviewerInput removes a reviewer from a pull request.

type RepoInput

type RepoInput struct {
	Project string `json:"project" jsonschema:"project name or ID"`
	Repo    string `json:"repo" jsonschema:"repository name or ID"`
}

RepoInput identifies a repository within a project.

type Repository

type Repository struct {
	ID            string `json:"id"`
	Name          string `json:"name"`
	DefaultBranch string `json:"defaultBranch,omitempty"`
	URL           string `json:"url,omitempty"`
	WebURL        string `json:"webUrl,omitempty"`
	Size          int64  `json:"size,omitempty"`
	RemoteURL     string `json:"remoteUrl,omitempty"`
}

Repository is a Git repository.

type Reviewer

type Reviewer struct {
	ID          string `json:"id,omitempty"`
	DisplayName string `json:"displayName,omitempty"`
	UniqueName  string `json:"uniqueName,omitempty"`
	Vote        int    `json:"vote"`
	IsRequired  bool   `json:"isRequired,omitempty"`
	IsFlagged   bool   `json:"isFlagged,omitempty"`
}

Reviewer is a reviewer on a pull request.

type Thread

type Thread struct {
	ID       int         `json:"id"`
	Status   string      `json:"status,omitempty"`
	Comments []PRComment `json:"comments,omitempty"`
}

Thread is a pull request comment thread.

type UpdatePullRequestInput

type UpdatePullRequestInput struct {
	Project       string `json:"project" jsonschema:"project name or ID"`
	Repo          string `json:"repo" jsonschema:"repository name or ID"`
	PullRequestID int    `json:"pullRequestId" jsonschema:"pull request ID"`
	Status        string `json:"status,omitempty" jsonschema:"new status: completed, abandoned, or active (optional)"`
	Title         string `json:"title,omitempty" jsonschema:"new title (optional)"`
	Description   string `json:"description,omitempty" jsonschema:"new description (optional)"`
}

UpdatePullRequestInput patches a pull request.

type UpdateRefResult

type UpdateRefResult struct {
	Name        string `json:"name,omitempty"`
	Success     bool   `json:"success,omitempty"`
	NewObjectID string `json:"newObjectId,omitempty"`
}

UpdateRefResult is the result of creating or updating a ref.

type VoteInput

type VoteInput struct {
	Project       string `json:"project" jsonschema:"project name or ID"`
	Repo          string `json:"repo" jsonschema:"repository name or ID"`
	PullRequestID int    `json:"pullRequestId" jsonschema:"pull request ID"`
	ReviewerID    string `json:"reviewerId" jsonschema:"reviewer identity ID"`
	Vote          int    `json:"vote" jsonschema:"vote: 10 approve, 5 approve with suggestions, 0 reset, -5 waiting, -10 reject"`
}

VoteInput sets a reviewer vote.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL