vsts

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2019 License: MIT Imports: 11 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Badge

type Badge struct {
	Href string `json:"href"`
}

Badge holds link information

type Branch

type Branch struct {
	Name        string `json:"name"`
	OldObjectID string `json:"oldObjectId"`
	NewObjectID string `json:"newObjectId"`
}

Branch reference for a branch

type BuildReq

type BuildReq struct {
	Definition   Definition `json:"definition"`
	SourceBranch string     `json:"sourceBranch"`
	Parameters   string     `json:"parameters"`
}

BuildReq stores is a request for a build

type Builds

type Builds struct {
	Count int `json:"count"`
	Value []struct {
		ID            int       `json:"id"`
		URL           string    `json:"url"`
		BuildNumber   string    `json:"buildNumber"`
		URI           string    `json:"uri"`
		SourceBranch  string    `json:"sourceBranch"`
		SourceVersion string    `json:"sourceVersion"`
		Status        string    `json:"status"`
		QueueTime     time.Time `json:"queueTime"`
		Priority      string    `json:"priority"`
		StartTime     time.Time `json:"startTime"`
		FinishTime    time.Time `json:"finishTime"`
		Reason        string    `json:"reason"`
		Result        string    `json:"result"`
		Parameters    string    `json:"parameters"`
		KeepForever   bool      `json:"keepForever"`
	} `json:"value"`
}

Builds hold multiple builds

type Client

type Client struct {
	Instance   string
	Project    string
	Repo       string
	APIVersion string
	RestClient *RestClient
	// contains filtered or unexported fields
}

Client implementation for the vsts client

func NewClient

func NewClient(config *Config) (*Client, error)

NewClient creates a new vsts client

func (*Client) AddReviewer

func (c *Client) AddReviewer(pullRequestID int32, reviewer gitclient.IdentityRefWithVote) error

AddReviewer Create a comment on the pull request

func (*Client) AddReviewers

func (c *Client) AddReviewers(pullRequestID int32, reviewers []gitclient.IdentityRef) error

AddReviewers Create a comment on the pull request

func (*Client) AddThread

func (c *Client) AddThread(pullRequestID int32, comment string) error

AddThread Create a comment on the pull request

func (*Client) CommitChanges

func (c *Client) CommitChanges(changes interface{}, branchName, commitID, changePath, commitMessage string) error

CommitChanges commits the staged commits

func (*Client) CompletePullRequest

func (c *Client) CompletePullRequest(pullRequestID int, commitID string, mergeMessage string, bypassPolicy bool, deleteSourceBranch bool) error

CompletePullRequest completes the specified pull request

func (*Client) CreateBranch

func (c *Client) CreateBranch(newBranchName string, commitID string) error

CreateBranch creates a new branch

func (*Client) GetBranch

func (c *Client) GetBranch(branchName string) (*Ref, error)

GetBranch returns the matching branch. If there are multiple matching, returns the first

func (*Client) GetBranches

func (c *Client) GetBranches(branchName string) (*Refs, error)

GetBranches returns branches matching a branch name

func (*Client) GetBuildDefinitions

func (c *Client) GetBuildDefinitions(definitionPath, definitionName string) (*Definitions, error)

GetBuildDefinitions returns the matching build definitions

func (*Client) GetBuilds

func (c *Client) GetBuilds(buildDefinitionID int) (*Builds, error)

GetBuilds returns the builds for a specific build definition

func (*Client) GetCommit

func (c *Client) GetCommit(commitID string) (*Commit, error)

GetCommit returns a specific commit

func (*Client) GetCommits

func (c *Client) GetCommits(branch string, startTime time.Time, endTime time.Time, versionPath string) (*Commits, error)

GetCommits retrieves commits for a branch in a specified time range

func (*Client) GetDiffsBetweenBranches

func (c *Client) GetDiffsBetweenBranches(baseBranch string, targetBranch string) (*Diffs, error)

GetDiffsBetweenBranches returns the diffs of two branches

func (*Client) GetFileFromRepo

func (c *Client) GetFileFromRepo(branchName string, filePath string, target interface{}) error

GetFileFromRepo returns the file at an empty interface

func (*Client) GetPullRequests

func (c *Client) GetPullRequests(localVarOptionals *gitclient.GetPullRequestsOpts) ([]gitclient.GitPullRequest, error)

GetPullRequests returns the pull requests for la specific repository

func (*Client) GetThreads

func (c *Client) GetThreads(pullRequestID int32, localVarOptionals *gitclient.ListPRThreadsOpts) ([]gitclient.GitPullRequestCommentThread, error)

GetThreads lists all the threads on a pull request

func (*Client) PostBuild

func (c *Client) PostBuild(buildDefinitionID int, branch string, parameters interface{}) (*PostBuildResponse, error)

PostBuild queues a new build

func (*Client) SubmitPullRequest

func (c *Client) SubmitPullRequest(targetBranch string, sourceBranch string, title string, description string) error

SubmitPullRequest creates a pull request

type Commit

type Commit struct {
	CommitID     string `json:"commitId"`
	ChangeCounts struct {
		Edit int `json:"Edit"`
	} `json:"changeCounts"`
	Changes []struct {
		Item struct {
			ObjectID         string `json:"objectId"`
			OriginalObjectID string `json:"originalObjectId"`
			GitObjectType    string `json:"gitObjectType"`
			CommitID         string `json:"commitId"`
			Path             string `json:"path"`
			IsFolder         bool   `json:"isFolder"`
			URL              string `json:"url"`
		} `json:"item"`
		ChangeType string `json:"changeType"`
	} `json:"changes"`
}

Commit holds data about a commit

type Commits

type Commits struct {
	Count int `json:"count"`
	Value []struct {
		CommitID     string `json:"commitId"`
		Comment      string `json:"comment"`
		ChangeCounts struct {
			Add int `json:"Add"`
		} `json:"changeCounts"`
		URL       string `json:"url"`
		RemoteURL string `json:"remoteUrl"`
	} `json:"value"`
}

Commits stores multiple commits and metadata

type CompletionOptions

type CompletionOptions struct {
	DeleteSourceBranch string `json:"deleteSourceBranch"`
	MergeCommitMessage string `json:"mergeCommitMessage"`
	SquashMerge        string `json:"squashMerge"`
	BypassPolicy       string `json:"bypassPolicy"`
}

CompletionOptions options for completing a pull request

type Config

type Config struct {
	Token          string
	Username       string
	APIVersion     string
	RepositoryName string
	Project        string
	Instance       string
}

Config stores the configurations for the vsts client

type Definition

type Definition struct {
	Drafts      []interface{} `json:"drafts"`
	ID          int           `json:"id"`
	Name        string        `json:"name"`
	URL         string        `json:"url"`
	URI         string        `json:"uri"`
	Path        string        `json:"path"`
	Type        string        `json:"type"`
	QueueStatus string        `json:"queueStatus"`
	Revision    int64         `json:"revision"`
	Project     Project       `json:"project"`
}

Definition is the build definition

type Definitions

type Definitions struct {
	Count int          `json:"count"`
	Value []Definition `json:"value"`
}

Definitions stores multiple definitions

type Diffs

type Diffs struct {
	AllChangesIncluded bool `json:"allChangesIncluded"`
	ChangeCounts       struct {
		Edit int `json:"Edit"`
	} `json:"changeCounts"`
	Changes []struct {
		Item struct {
			ObjectID         string `json:"objectId"`
			OriginalObjectID string `json:"originalObjectId"`
			GitObjectType    string `json:"gitObjectType"`
			CommitID         string `json:"commitId"`
			Path             string `json:"path"`
			IsFolder         bool   `json:"isFolder"`
			URL              string `json:"url"`
		} `json:"item"`
		ChangeType string `json:"changeType"`
	} `json:"changes"`
	CommonCommit string `json:"commonCommit"`
	BaseCommit   string `json:"baseCommit"`
	TargetCommit string `json:"targetCommit"`
	AheadCount   int    `json:"aheadCount"`
	BehindCount  int    `json:"behindCount"`
}

Diffs stores the diffs of two branches

type LastChangedBy

type LastChangedBy struct {
	DisplayName string `json:"displayName"`
	URL         string `json:"url"`
	Links       struct {
		Avatar Badge `json:"avatar"`
	} `json:"_links"`
	ID         string `json:"id"`
	UniqueName string `json:"uniqueName"`
	ImageURL   string `json:"imageUrl"`
	Descriptor string `json:"descriptor"`
}

LastChangedBy shows the last changed by status

type LastMergeSourceCommit

type LastMergeSourceCommit struct {
	CommitID string `json:"commitId"`
}

LastMergeSourceCommit commit id of the last merged commit

type PostBuildResponse

type PostBuildResponse struct {
	Links             PostBuildResponseLinks `json:"_links"`
	Tags              []interface{}          `json:"tags"`
	ValidationResults []interface{}          `json:"validationResults"`
	ID                int64                  `json:"id"`
	BuildNumber       string                 `json:"buildNumber"`
	Status            string                 `json:"status"`
	QueueTime         string                 `json:"queueTime"`
	URL               string                 `json:"url"`
	Definition        Definition             `json:"definition"`
	Project           Project                `json:"project"`
	URI               string                 `json:"uri"`
	SourceBranch      string                 `json:"sourceBranch"`
	Priority          string                 `json:"priority"`
	Reason            string                 `json:"reason"`
	RequestedFor      LastChangedBy          `json:"requestedFor"`
	RequestedBy       LastChangedBy          `json:"requestedBy"`
	LastChangedDate   string                 `json:"lastChangedDate"`
	LastChangedBy     LastChangedBy          `json:"lastChangedBy"`
	Parameters        string                 `json:"parameters"`
	KeepForever       bool                   `json:"keepForever"`
	RetainedByRelease bool                   `json:"retainedByRelease"`
	TriggeredByBuild  interface{}            `json:"triggeredByBuild"`
}

PostBuildResponse holds the api response from posting a new build

type PostBuildResponseLinks struct {
	Self                    Badge `json:"self"`
	Web                     Badge `json:"web"`
	SourceVersionDisplayURI Badge `json:"sourceVersionDisplayUri"`
	Timeline                Badge `json:"timeline"`
	Badge                   Badge `json:"badge"`
}

PostBuildResponseLinks store all links referenced to a build

type Project

type Project struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	URL         string `json:"url"`
	State       string `json:"state"`
	Revision    int64  `json:"revision"`
	Visibility  string `json:"visibility"`
}

Project holds info about the current project

type PullRequest

type PullRequest struct {
	PullRequestID      int       `json:"pullRequestId"`
	CodeReviewID       int       `json:"codeReviewId"`
	Status             string    `json:"status"`
	CreationDate       time.Time `json:"creationDate"`
	Title              string    `json:"title"`
	Description        string    `json:"description"`
	SourceRefName      string    `json:"sourceRefName"`
	TargetRefName      string    `json:"targetRefName"`
	MergeStatus        string    `json:"mergeStatus"`
	MergeID            string    `json:"mergeId"`
	URL                string    `json:"url"`
	SupportsIterations bool      `json:"supportsIterations"`
}

PullRequest reference to a pull request

type PullRequests

type PullRequests struct {
	Value []PullRequest `json:"value"`
	Count int           `json:"count"`
}

PullRequests holds multiple pull requests

type Ref

type Ref struct {
	Name     string `json:"name"`
	ObjectID string `json:"objectId"`
	URL      string `json:"url"`
}

Ref holds the object references

type Refs

type Refs struct {
	Value []Ref `json:"value"`
	Count int   `json:"count"`
}

Refs object for multiple refs

type RestClient added in v0.0.3

type RestClient struct {
	// contains filtered or unexported fields
}

RestClient client to handle auth when calling the azure devops api

func (*RestClient) Do added in v0.0.3

func (c *RestClient) Do(method, url string, body io.Reader) ([]byte, error)

Do perform an authenticated request to azure devops api

Jump to

Keyboard shortcuts

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