bitbucketcloud

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: 9 Imported by: 0

Documentation

Overview

Package bitbucketcloud holds code for Bitbucket Cloud aka (bitbucket.org). It is separate from bitbucketserver because Bitbucket Server has different APIs.

Index

Constants

View Source
const (
	PullCreatedHeader        = "pullrequest:created"
	PullUpdatedHeader        = "pullrequest:updated"
	PullFulfilledHeader      = "pullrequest:fulfilled"
	PullRejectedHeader       = "pullrequest:rejected"
	PullCommentCreatedHeader = "pullrequest:comment_created"
)
View Source
const BaseURL = "https://api.bitbucket.org"

Variables

This section is empty.

Functions

This section is empty.

Types

type Actor

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

type Branch

type Branch struct {
	Name *string `json:"name,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, atlantisURL string) *Client

NewClient builds a bitbucket cloud client. 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) 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 {
	Content *CommentContent `json:"content,omitempty" validate:"required"`
}

type CommentContent

type CommentContent struct {
	Raw *string `json:"raw,omitempty" validate:"required"`
}

type CommentEvent

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

type Commit

type Commit struct {
	Hash *string `json:"hash,omitempty" validate:"required"`
}

type CommonEventData

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

type DiffStat

type DiffStat struct {
	Values []DiffStatValue `json:"values,omitempty" validate:"required"`
	Next   *string         `json:"next,omitempty"`
}

type DiffStatFile

type DiffStatFile struct {
	Path *string `json:"path,omitempty" validate:"required"`
}

type DiffStatValue

type DiffStatValue struct {
	// Old is the old file, this can be null.
	Old *DiffStatFile `json:"old,omitempty"`
	// New is the new file, this can be null.
	New *DiffStatFile `json:"new,omitempty"`
}
type Link struct {
	HREF *string `json:"href,omitempty" validate:"required"`
}
type Links struct {
	HTML *Link `json:"html,omitempty" validate:"required"`
}

type Participant

type Participant struct {
	Approved *bool `json:"approved,omitempty" validate:"required"`
	User     *struct {
		Username *string `json:"username,omitempty" validate:"required"`
	} `json:"user,omitempty" validate:"required"`
}

type PullRequest

type PullRequest struct {
	ID           *int          `json:"id,omitempty" validate:"required"`
	Source       *Source       `json:"source,omitempty" validate:"required"`
	Participants []Participant `json:"participants,omitempty" validate:"required"`
	Links        *Links        `json:"links,omitempty" validate:"required"`
	State        *string       `json:"state,omitempty" validate:"required"`
}

type PullRequestEvent

type PullRequestEvent struct {
	CommonEventData
}

type Repository

type Repository struct {
	FullName *string `json:"full_name,omitempty" validate:"required"`
	Links    Links   `json:"links,omitempty" validate:"required"`
}

type Source

type Source struct {
	Repository *Repository `json:"repository,omitempty" validate:"required"`
	Commit     *Commit     `json:"commit,omitempty" validate:"required"`
	Branch     *Branch     `json:"branch,omitempty" validate:"required"`
}

Jump to

Keyboard shortcuts

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