bitbucket

package
v3.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Approval

type Approval struct {
	Date time.Time `json:"date"`
	User User      `json:"user"`
}

Approval is the common Bitbucket Issue Approval Sub Entity

type Avatar

type Avatar struct {
	HREF string `json:"href"`
}

Avatar is the common Bitbucket Avatar Sub Entity

type Branch

type Branch struct {
	Name string `json:"name"`
}

Branch is the common Bitbucket Branch Sub Entity

type Change

type Change struct {
	New       ChangeData           `json:"new"`
	Old       ChangeData           `json:"old"`
	Links     LinksHTMLDiffCommits `json:"links"`
	Created   bool                 `json:"created"`
	Forced    bool                 `json:"forced"`
	Closed    bool                 `json:"closed"`
	Commits   []Commit             `json:"commits"`
	Truncated bool                 `json:"truncated"`
}

Change is the common Bitbucket Change Sub Entity

type ChangeData

type ChangeData struct {
	Type   string               `json:"type"`
	Name   string               `json:"name"`
	Target Target               `json:"target"`
	Links  LinksHTMLSelfCommits `json:"links"`
}

ChangeData is the common Bitbucket ChangeData Sub Entity

type Comment

type Comment struct {
	ID        int64         `json:"id"`
	Parent    ParentID      `json:"parent"`
	Content   Content       `json:"content"`
	Inline    Inline        `json:"inline"`
	CreatedOn time.Time     `json:"created_on"`
	UpdatedOn time.Time     `json:"updated_on"`
	Links     LinksHTMLSelf `json:"links"`
}

Comment is the common Bitbucket Comment Entity

type Commit

type Commit struct {
	Hash    string        `json:"hash"`
	Type    string        `json:"type"`
	Message string        `json:"message"`
	Author  User          `json:"author"`
	Links   LinksHTMLSelf `json:"links"`
}

Commit is the common Bitbucket Commit Sub Entity

type CommitHash

type CommitHash struct {
	Hash string `json:"hash"`
}

CommitHash is the common Bitbucket CommitHash Sub Entity

type CommitStatus

type CommitStatus struct {
	Name        string          `json:"name"`
	Description string          `json:"description"`
	State       string          `json:"state"`
	Key         string          `json:"key"`
	URL         string          `json:"url"`
	Type        string          `json:"type"`
	CreatedOn   time.Time       `json:"created_on"`
	UpdatedOn   time.Time       `json:"updated_on"`
	Links       LinksSelfCommit `json:"links"`
}

CommitStatus is the common Bitbucket CommitStatus Sub Entity

type Commits

type Commits struct {
	HREF string `json:"href"`
}

Commits is the common Bitbucket Commits Sub Entity

type Config

type Config struct {
	UUID string
}

Config defines the configuration to create a new Bitbucket Webhook instance

type Content

type Content struct {
	HTML   string `json:"html"`
	Markup string `json:"markup"`
	Raw    string `json:"raw"`
}

Content is the common Bitbucket Content Sub Entity

type Destination

type Destination struct {
	Branch     Branch     `json:"branch"`
	Commit     CommitHash `json:"commit"`
	Repository Repository `json:"repository"`
}

Destination is the common Bitbucket Destination Sub Entity

type Diff

type Diff struct {
	HREF string `json:"href"`
}

Diff is the common Bitbucket Diff Sub Entity

type Event

type Event string

Event defines a Bitbucket hook event type

const (
	RepoPushEvent                   Event = "repo:push"
	RepoForkEvent                   Event = "repo:fork"
	RepoCommitCommentCreatedEvent   Event = "repo:commit_comment_created"
	RepoCommitStatusCreatedEvent    Event = "repo:commit_status_created"
	RepoCommitStatusUpdatedEvent    Event = "repo:commit_status_updated"
	IssueCreatedEvent               Event = "issue:created"
	IssueUpdatedEvent               Event = "issue:updated"
	IssueCommentCreatedEvent        Event = "issue:comment_created"
	PullRequestCreatedEvent         Event = "pullrequest:created"
	PullRequestUpdatedEvent         Event = "pullrequest:updated"
	PullRequestApprovedEvent        Event = "pullrequest:approved"
	PullRequestApprovalRemovedEvent Event = "pullrequest:unapproved"
	PullRequestMergedEvent          Event = "pullrequest:fulfilled"
	PullRequestDeclinedEvent        Event = "pullrequest:rejected"
	PullRequestCommentCreatedEvent  Event = "pullrequest:comment_created"
	PullRequestCommentUpdatedEvent  Event = "pullrequest:comment_updated"
	PullRequestCommentDeletedEvent  Event = "pull_request:comment_deleted"
)

Bitbucket hook types

type HTML

type HTML struct {
	HREF string `json:"href"`
}

HTML is the common Bitbucket HTML Sub Entity

type Inline

type Inline struct {
	Path string `json:"path"`
	From *int64 `json:"from"`
	To   int64  `json:"to"`
}

Inline is the common Bitbucket Inline Sub Entity

type Issue

type Issue struct {
	ID        int64         `json:"id"`
	Component string        `json:"component"`
	Title     string        `json:"title"`
	Content   Content       `json:"content"`
	Priority  string        `json:"priority"`
	State     string        `json:"state"`
	Type      string        `json:"type"`
	Milestone Milestone     `json:"milestone"`
	Version   Version       `json:"version"`
	CreatedOn time.Time     `json:"created_on"`
	UpdatedOn time.Time     `json:"updated_on"`
	Links     LinksHTMLSelf `json:"links"`
}

Issue is the common Bitbucket Issue Entity

type IssueChangeStatus

type IssueChangeStatus struct {
	Old string `json:"old"`
	New string `json:"new"`
}

IssueChangeStatus is the common Bitbucket Issue Change Status Sub Entity

type IssueChanges

type IssueChanges struct {
	Status IssueChangeStatus `json:"status"`
}

IssueChanges is the common Bitbucket Issue Changes Sub Entity

type IssueCommentCreatedPayload

type IssueCommentCreatedPayload struct {
	Actor      User       `json:"actor"`
	Repository Repository `json:"repository"`
	Issue      Issue      `json:"issue"`
	Comment    Comment    `json:"comment"`
}

IssueCommentCreatedPayload is the Bitbucket issue:comment_created payload

type IssueCreatedPayload

type IssueCreatedPayload struct {
	Actor      User       `json:"actor"`
	Issue      Issue      `json:"issue"`
	Repository Repository `json:"repository"`
}

IssueCreatedPayload is the Bitbucket issue:created payload

type IssueUpdatedPayload

type IssueUpdatedPayload struct {
	Actor      User         `json:"actor"`
	Issue      Issue        `json:"issue"`
	Repository Repository   `json:"repository"`
	Comment    Comment      `json:"comment"`
	Changes    IssueChanges `json:"changes"`
}

IssueUpdatedPayload is the Bitbucket issue:updated payload

type Links struct {
	Avatar Avatar `json:"avatar"`
	HTML   HTML   `json:"html"`
	Self   Self   `json:"self"`
}

Links is the common Bitbucket Links Sub Entity

type LinksHTMLDiffCommits

type LinksHTMLDiffCommits struct {
	HTML    HTML    `json:"html"`
	Diff    Diff    `json:"diff"`
	Commits Commits `json:"commits"`
}

LinksHTMLDiffCommits is the common Bitbucket LinksHTMLDiffCommits Sub Entity

type LinksHTMLSelf

type LinksHTMLSelf struct {
	HTML HTML `json:"html"`
	Self Self `json:"self"`
}

LinksHTMLSelf is the common Bitbucket LinksHTMLSelf Sub Entity

type LinksHTMLSelfCommits

type LinksHTMLSelfCommits struct {
	Self    Self    `json:"self"`
	Commits Commits `json:"commits"`
	HTML    HTML    `json:"html"`
}

LinksHTMLSelfCommits is the common Bitbucket LinksHTMLSelfCommits Sub Entity

type LinksSelfCommit

type LinksSelfCommit struct {
	Self   Self    `json:"self"`
	Commit Commits `json:"commit"`
}

LinksSelfCommit is the common Bitbucket LinksSelfCommit Sub Entity

type Milestone

type Milestone struct {
	Name string `json:"name"`
}

Milestone is the common Bitbucket Milestone Sub Entity

type Parent

type Parent struct {
	Type  string        `json:"type"`
	Hash  string        `json:"hash"`
	Links LinksHTMLSelf `json:"links"`
}

Parent is the common Bitbucket Parent Sub Entity

type ParentID

type ParentID struct {
	ID int64 `json:"id"`
}

ParentID is the common Bitbucket ParentID Sub Entity

type PullRequest

type PullRequest struct {
	ID                int64         `json:"id"`
	Title             string        `json:"title"`
	Description       string        `json:"description"`
	State             string        `json:"state"`
	Author            User          `json:"author"`
	Source            Source        `json:"source"`
	Destination       Destination   `json:"destination"`
	MergeCommit       CommitHash    `json:"merge_commit"`
	Participants      []User        `json:"participants"`
	Reviewers         []User        `json:"reviewers"`
	CloseSourceBranch bool          `json:"close_source_branch"`
	ClosedBy          User          `json:"closed_by"`
	Reason            string        `json:"reason"`
	CreatedOn         time.Time     `json:"created_on"`
	UpdatedOn         time.Time     `json:"updated_on"`
	Links             LinksHTMLSelf `json:"links"`
}

PullRequest is the common Bitbucket PullRequest Entity

type PullRequestApprovalRemovedPayload

type PullRequestApprovalRemovedPayload struct {
	Actor       User        `json:"actor"`
	PullRequest PullRequest `json:"pullrequest"`
	Repository  Repository  `json:"repository"`
	Approval    Approval    `json:"approval"`
}

PullRequestApprovalRemovedPayload is the Bitbucket pullrequest:unapproved payload

type PullRequestApprovedPayload

type PullRequestApprovedPayload struct {
	Actor       User        `json:"actor"`
	PullRequest PullRequest `json:"pullrequest"`
	Repository  Repository  `json:"repository"`
	Approval    Approval    `json:"approval"`
}

PullRequestApprovedPayload is the Bitbucket pullrequest:approved payload

type PullRequestCommentCreatedPayload

type PullRequestCommentCreatedPayload struct {
	Actor       User        `json:"actor"`
	Repository  Repository  `json:"repository"`
	PullRequest PullRequest `json:"pullrequest"`
	Comment     Comment     `json:"comment"`
}

PullRequestCommentCreatedPayload is the Bitbucket pullrequest:comment_created payload

type PullRequestCommentDeletedPayload

type PullRequestCommentDeletedPayload struct {
	Actor       User        `json:"actor"`
	Repository  Repository  `json:"repository"`
	PullRequest PullRequest `json:"pullrequest"`
	Comment     Comment     `json:"comment"`
}

PullRequestCommentDeletedPayload is the Bitbucket pull_request:comment_deleted payload

type PullRequestCommentUpdatedPayload

type PullRequestCommentUpdatedPayload struct {
	Actor       User        `json:"actor"`
	Repository  Repository  `json:"repository"`
	PullRequest PullRequest `json:"pullrequest"`
	Comment     Comment     `json:"comment"`
}

PullRequestCommentUpdatedPayload is the Bitbucket pullrequest:comment_updated payload

type PullRequestCreatedPayload

type PullRequestCreatedPayload struct {
	Actor       User        `json:"actor"`
	PullRequest PullRequest `json:"pullrequest"`
	Repository  Repository  `json:"repository"`
}

PullRequestCreatedPayload is the Bitbucket pullrequest:created payload

type PullRequestDeclinedPayload

type PullRequestDeclinedPayload struct {
	Actor       User        `json:"actor"`
	PullRequest PullRequest `json:"pullrequest"`
	Repository  Repository  `json:"repository"`
}

PullRequestDeclinedPayload is the Bitbucket pullrequest:rejected payload

type PullRequestMergedPayload

type PullRequestMergedPayload struct {
	Actor       User        `json:"actor"`
	PullRequest PullRequest `json:"pullrequest"`
	Repository  Repository  `json:"repository"`
}

PullRequestMergedPayload is the Bitbucket pullrequest:fulfilled payload

type PullRequestUpdatedPayload

type PullRequestUpdatedPayload struct {
	Actor       User        `json:"actor"`
	PullRequest PullRequest `json:"pullrequest"`
	Repository  Repository  `json:"repository"`
}

PullRequestUpdatedPayload is the Bitbucket pullrequest:updated payload

type Push

type Push struct {
	Changes []Change `json:"changes"`
}

Push is the common Bitbucket Push Sub Entity

type RepoCommitCommentCreatedPayload

type RepoCommitCommentCreatedPayload struct {
	Actor      User       `json:"actor"`
	Comment    Comment    `json:"comment"`
	Repository Repository `json:"repository"`
	Commit     CommitHash `json:"commit"`
}

RepoCommitCommentCreatedPayload is the Bitbucket repo:commit_comment_created payload

type RepoCommitStatusCreatedPayload

type RepoCommitStatusCreatedPayload struct {
	Actor        User         `json:"actor"`
	Repository   Repository   `json:"repository"`
	CommitStatus CommitStatus `json:"commit_status"`
}

RepoCommitStatusCreatedPayload is the Bitbucket repo:commit_status_created payload

type RepoCommitStatusUpdatedPayload

type RepoCommitStatusUpdatedPayload struct {
	Actor        User         `json:"actor"`
	Repository   Repository   `json:"repository"`
	CommitStatus CommitStatus `json:"commit_status"`
}

RepoCommitStatusUpdatedPayload is the Bitbucket repo:commit_status_updated payload

type RepoForkPayload

type RepoForkPayload struct {
	Actor      User       `json:"actor"`
	Repository Repository `json:"repository"`
	Fork       Repository `json:"fork"`
}

RepoForkPayload is the Bitbucket repo:fork payload

type RepoPushPayload

type RepoPushPayload struct {
	Actor      User       `json:"actor"`
	Repository Repository `json:"repository"`
	Push       Push       `json:"push"`
}

RepoPushPayload is the Bitbucket repo:push payload

type Repository

type Repository struct {
	Links     Links  `json:"links"`
	UUID      string `json:"uuid"`
	FullName  string `json:"full_name"`
	Name      string `json:"name"`
	Scm       string `json:"scm"`
	IsPrivate bool   `json:"is_private"`
}

Repository is the common Bitbucket Repository Entity

type Self

type Self struct {
	HREF string `json:"href"`
}

Self is the common Bitbucket Self Sub Entity

type Source

type Source struct {
	Branch     Branch     `json:"branch"`
	Commit     CommitHash `json:"commit"`
	Repository Repository `json:"repository"`
}

Source is the common Bitbucket Source Sub Entity

type Target

type Target struct {
	Type    string        `json:"type"`
	Hash    string        `json:"hash"`
	Author  User          `json:"author"`
	Message string        `json:"message"`
	Date    time.Time     `json:"date"`
	Parents []Parent      `json:"parents"`
	Links   LinksHTMLSelf `json:"links"`
}

Target is the common Bitbucket Target Sub Entity

type User

type User struct {
	Username    string `json:"username"`
	DisplayName string `json:"display_name"`
	UUID        string `json:"uuid"`
	Links       Links  `json:"links"`
}

User is the common Bitbucket User Entity

type Version

type Version struct {
	Name string `json:"name"`
}

Version is the common Bitbucket Version Sub Entity

type Webhook

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

Webhook instance contains all methods needed to process events

func New

func New(config *Config) *Webhook

New creates and returns a WebHook instance denoted by the Provider type

func (Webhook) ParsePayload

func (hook Webhook) ParsePayload(w http.ResponseWriter, r *http.Request)

ParsePayload parses and verifies the payload and fires off the mapped function, if it exists.

func (Webhook) Provider

func (hook Webhook) Provider() webhooks.Provider

Provider returns the current hooks provider ID

func (Webhook) RegisterEvents

func (hook Webhook) RegisterEvents(fn webhooks.ProcessPayloadFunc, events ...Event)

RegisterEvents registers the function to call when the specified event(s) are encountered

Jump to

Keyboard shortcuts

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