Documentation ¶
Index ¶
- Constants
- func ValidateSignature(payload []byte, signature string, secretKey []byte) error
- type Actor
- type Changes
- type Client
- func (b *Client) CreateComment(repo models.Repo, pullNum int, comment string, command string) error
- func (b *Client) DiscardReviews(repo models.Repo, pull models.PullRequest) error
- func (b *Client) GetCloneURL(VCSHostType models.VCSHostType, repo string) (string, error)
- func (b *Client) GetFileContent(pull models.PullRequest, fileName string) (bool, []byte, error)
- func (b *Client) GetModifiedFiles(repo models.Repo, pull models.PullRequest) ([]string, error)
- func (b *Client) GetProjectKey(repoName string, cloneURL string) (string, error)
- func (b *Client) GetTeamNamesForUser(repo models.Repo, user models.User) ([]string, error)
- func (b *Client) HidePrevCommandComments(repo models.Repo, pullNum int, command string) error
- func (b *Client) MarkdownPullLink(pull models.PullRequest) (string, error)
- func (b *Client) MergePull(pull models.PullRequest, pullOptions models.PullRequestOptions) error
- func (b *Client) PullIsApproved(repo models.Repo, pull models.PullRequest) (approvalStatus models.ApprovalStatus, err error)
- func (b *Client) PullIsMergeable(repo models.Repo, pull models.PullRequest, vcsstatusname string) (bool, error)
- func (b *Client) ReactToComment(repo models.Repo, pullNum int, commentID int64, reaction string) error
- func (b *Client) SupportsSingleFileDownload(repo models.Repo) bool
- func (b *Client) UpdateStatus(repo models.Repo, pull models.PullRequest, status models.CommitStatus, ...) error
- type Comment
- type CommentEvent
- type CommonEventData
- type DeleteSourceBranch
- type MergeStatus
- type Project
- type PullRequest
- type PullRequestEvent
- type Ref
- type Repository
Constants ¶
const ( DiagnosticsPingHeader = "diagnostics:ping" PullCreatedHeader = "pr:opened" PullFromRefUpdatedHeader = "pr:from_ref_updated" PullMergedHeader = "pr:merged" PullDeclinedHeader = "pr:declined" PullDeletedHeader = "pr:deleted" PullCommentCreatedHeader = "pr:comment:added" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Changes ¶
type Changes struct { Values []struct { Path struct { ToString *string `json:"toString,omitempty" validate:"required"` } `json:"path,omitempty" validate:"required"` SrcPath *struct { ToString *string `json:"toString,omitempty"` } `json:"srcPath,omitempty"` } `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 ¶
CreateComment creates a comment on the merge request. It will write multiple comments if a single comment is too long.
func (*Client) DiscardReviews ¶ added in v0.22.0
func (*Client) GetCloneURL ¶ added in v0.19.8
func (*Client) GetFileContent ¶ added in v0.22.0
GetFileContent a repository file content from VCS (which support fetch a single file from repository) The first return value indicates whether the repo contains a file or not if BaseRepo had a file, its content will placed on the second return value
func (*Client) GetModifiedFiles ¶
GetModifiedFiles returns the names of files that were modified in the merge request relative to the repo root, e.g. parent/child/file.txt.
func (*Client) GetProjectKey ¶
func (*Client) GetTeamNamesForUser ¶ added in v0.18.0
GetTeamNamesForUser returns the names of the teams or groups that the user belongs to (in the organization the repository belongs to).
func (*Client) HidePrevCommandComments ¶ added in v0.17.1
func (*Client) MarkdownPullLink ¶ added in v0.13.0
func (b *Client) MarkdownPullLink(pull models.PullRequest) (string, error)
MarkdownPullLink specifies the character used in a pull request comment.
func (*Client) MergePull ¶ added in v0.4.14
func (b *Client) MergePull(pull models.PullRequest, pullOptions models.PullRequestOptions) error
MergePull merges the pull request.
func (*Client) PullIsApproved ¶
func (b *Client) PullIsApproved(repo models.Repo, pull models.PullRequest) (approvalStatus models.ApprovalStatus, err error)
PullIsApproved returns true if the merge request was approved.
func (*Client) PullIsMergeable ¶ added in v0.4.13
func (b *Client) PullIsMergeable(repo models.Repo, pull models.PullRequest, vcsstatusname string) (bool, error)
PullIsMergeable returns true if the merge request has no conflicts and can be merged.
func (*Client) ReactToComment ¶ added in v0.24.0
func (*Client) SupportsSingleFileDownload ¶ added in v0.15.0
func (*Client) UpdateStatus ¶
func (b *Client) UpdateStatus(repo models.Repo, pull models.PullRequest, status models.CommitStatus, src string, description string, url string) error
UpdateStatus updates the status of a commit.
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 DeleteSourceBranch ¶ added in v0.17.4
type MergeStatus ¶ added in v0.4.13
type PullRequest ¶
type PullRequest struct { Version *int `json:"version,omitempty" validate:"required"` 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"` }