bitbucketserver

package
v0.4.12 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2018 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PullCreatedHeader        = "pr:opened"
	PullMergedHeader         = "pr:merged"
	PullDeclinedHeader       = "pr:declined"
	PullCommentCreatedHeader = "pr:comment:added"
)

Variables

This section is empty.

Functions

func ValidateSignature

func ValidateSignature(payload []byte, signature string, secretKey []byte) error

Types

type Actor

type Actor struct {
	Username *string `json:"name,omitempty" validate:"required"`
}

type Changes

type Changes struct {
	Values []struct {
		Path struct {
			ToString *string `json:"toString,omitempty" validate:"required"`
		} `json:"path,omitempty" validate:"required"`
	} `json:"values,omitempty" validate:"required"`
	NextPageStart *int  `json:"nextPageStart,omitempty"`
	IsLastPage    *bool `json:"isLastPage,omitempty" validate:"required"`
}

type Client

type Client struct {
	HttpClient  *http.Client
	Username    string
	Password    string
	BaseURL     string
	AtlantisURL string
}

func NewClient

func NewClient(httpClient *http.Client, username string, password string, baseURL string, atlantisURL string) (*Client, error)

NewClient builds a bitbucket cloud client. Returns an error if the baseURL is malformed. httpClient is the client to use to make the requests, username and password are used as basic auth in the requests, baseURL is the API's baseURL, ex. https://corp.com:7990. Don't include the API version, ex. '/1.0' since that changes based on the API call. atlantisURL is the URL for Atlantis that will be linked to from the build status icons. This linking is annoying because we don't have anywhere good to link but a URL is required.

func (*Client) CreateComment

func (b *Client) CreateComment(repo models.Repo, pullNum int, comment string) error

CreateComment creates a comment on the merge request.

func (*Client) GetModifiedFiles

func (b *Client) GetModifiedFiles(repo models.Repo, pull models.PullRequest) ([]string, error)

GetModifiedFiles returns the names of files that were modified in the merge request. The names include the path to the file from the repo root, ex. parent/child/file.txt.

func (*Client) GetProjectKey

func (b *Client) GetProjectKey(repoName string, cloneURL string) (string, error)

func (*Client) PullIsApproved

func (b *Client) PullIsApproved(repo models.Repo, pull models.PullRequest) (bool, error)

PullIsApproved returns true if the merge request was approved.

func (*Client) UpdateStatus

func (b *Client) UpdateStatus(repo models.Repo, pull models.PullRequest, status models.CommitStatus, description string) error

UpdateStatus updates the status of a commit.

type Comment

type Comment struct {
	Text *string `json:"text,omitempty" validate:"required"`
}

type CommentEvent

type CommentEvent struct {
	CommonEventData
	Comment *Comment `json:"comment,omitempty" validate:"required"`
}

type CommonEventData

type CommonEventData struct {
	Actor       *Actor       `json:"actor,omitempty" validate:"required"`
	PullRequest *PullRequest `json:"pullRequest,omitempty" validate:"required"`
}

type Project

type Project struct {
	Name *string `json:"name,omitempty" validate:"required"`
	Key  *string `json:"key,omitempty" validate:"required"`
}

type PullRequest

type PullRequest struct {
	ID        *int    `json:"id,omitempty" validate:"required"`
	FromRef   *Ref    `json:"fromRef,omitempty" validate:"required"`
	ToRef     *Ref    `json:"toRef,omitempty" validate:"required"`
	State     *string `json:"state,omitempty" validate:"required"`
	Reviewers []struct {
		Approved *bool `json:"approved,omitempty" validate:"required"`
	} `json:"reviewers,omitempty" validate:"required"`
}

type PullRequestEvent

type PullRequestEvent struct {
	CommonEventData
}

type Ref

type Ref struct {
	Repository   *Repository `json:"repository,omitempty" validate:"required"`
	DisplayID    *string     `json:"displayId,omitempty" validate:"required"`
	LatestCommit *string     `json:"latestCommit,omitempty" validate:"required"`
}

type Repository

type Repository struct {
	Slug    *string  `json:"slug,omitempty" validate:"required"`
	Project *Project `json:"project,omitempty" validate:"required"`
}

Jump to

Keyboard shortcuts

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