Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIDiff ¶
type APIDiff struct { New struct { Path string `json:"path"` } `json:"new"` }
Details of a single file changed
type Config ¶
type Config struct { Username string Token string Endpoint string Logger logrus.FieldLogger }
Connection details for talking with bitbucket cloud
type DiffStatResponse ¶
type DiffStatResponse struct { PagedAPIResponse Diffs []APIDiff `json:"values"` }
Response of getting diff details of a commit. Documentation: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/diffstat/%7Bspec%7D
type FileService ¶
type FileService struct { BbcloudEndpoint string BbcloudToken string BbcloudUsername string Logger logrus.FieldLogger // contains filtered or unexported fields }
FileService is for working with repositories
func (*FileService) DecodeURL ¶
func (f *FileService) DecodeURL(url string) (org, repo, path, branch string)
DecodeURL takes a url and returns the org, repo, path and branch
func (*FileService) Download ¶
func (f *FileService) Download(org, repo, path, branch string) (string, error)
Download downloads a file from Bitbucket Cloud. The API returns the file's contents as a paginated list of lines
func (*FileService) EncodeURL ¶
func (f *FileService) EncodeURL(org, repo, path, branch string) string
EncodeURL returns the git url for a given org, repo, path and branch
type PagedAPIResponse ¶
type PagedAPIResponse struct { PageLength int `json:"pagelen"` CurrentPage int `json:"page"` NumberOfPages int `json:"size"` }
PagedAPIResponse contains the fields needed for paged APIs
type Push ¶
type Push struct { Payload WebhookPayload ChangedFiles []string Logger logrus.FieldLogger }
Information about what files changed in a push
func NewPush ¶
func NewPush(payload WebhookPayload, cfg Config) (*Push, error)
Converts the raw webhook payload sent by Bitbucket Cloud, to an internal Push structure with the list of files changed.
func (*Push) ContainsFile ¶
ContainsFile checks to see if a given file is in the push.
func (*Push) SetCommitStatus ¶
SetCommitStatus sets a commit status
type WebhookChange ¶
type WebhookChange struct { New WebhookChangeComparison `json:"new"` Old WebhookChangeComparison `json:"old"` }
Change details in a webhook payload
func (*WebhookChange) Branch ¶
func (c *WebhookChange) Branch() string
Find the branch in the webhook payload
func (*WebhookChange) IsMaster ¶
func (c *WebhookChange) IsMaster() bool
Find in the webhook payload if the change was done in "master" branch
type WebhookChangeComparison ¶
type WebhookChangeComparison struct { Name string `json:"name"` Target WebhookChangeTarget `json:"target"` }
type WebhookChangeTarget ¶
type WebhookChangeTarget struct {
Hash string `json:"hash"`
}
type WebhookPayload ¶
type WebhookPayload struct { Repository WebhookRepository `json:"repository"` Push WebhookPush `json:"push"` }
Payload received in a "push" type webhook
type WebhookProject ¶
type WebhookProject struct {
Key string `json:"key"`
}
type WebhookPush ¶
type WebhookPush struct {
Changes []WebhookChange `json:"changes"`
}
type WebhookRepository ¶
type WebhookRepository struct { Name string `json:"name"` FullName string `json:"full_name"` Project WebhookProject `json:"project"` }