bitbucketserver

package
v5.13.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEventNotSpecifiedToParse  = errors.New("no Event specified to parse")
	ErrInvalidHTTPMethod         = errors.New("invalid HTTP Method")
	ErrMissingEventKeyHeader     = errors.New("missing X-Event-Key Header")
	ErrMissingHubSignatureHeader = errors.New("missing X-Hub-Signature Header")
	ErrEventNotFound             = errors.New("event not defined to be parsed")
	ErrParsingPayload            = errors.New("error parsing payload")
	ErrHMACVerificationFailed    = errors.New("HMAC verification failed")
)
View Source
var Options = WebhookOptions{}

Options is a namespace var for configuration options

Functions

This section is empty.

Types

type Comment

type Comment struct {
	ID                  uint64                   `json:"id"`
	Properties          map[string]interface{}   `json:"properties,omitempty"`
	Version             uint64                   `json:"version"`
	Text                string                   `json:"text"`
	Author              User                     `json:"author"`
	CreatedDate         uint64                   `json:"createdDate"`
	UpdatedDate         uint64                   `json:"updatedDate"`
	Comments            []map[string]interface{} `json:"comments"`
	Tasks               []map[string]interface{} `json:"tasks"`
	PermittedOperations map[string]interface{}   `json:"permittedOperations,omitempty"`
}

type Date

type Date time.Time

func (Date) MarshalJSON

func (b Date) MarshalJSON() ([]byte, error)

func (*Date) UnmarshalJSON

func (b *Date) UnmarshalJSON(p []byte) error

type DiagnosticsPingPayload

type DiagnosticsPingPayload struct{}

type Event

type Event string
const (
	RepositoryReferenceChangedEvent Event = "repo:refs_changed"
	RepositoryModifiedEvent         Event = "repo:modified"
	RepositoryForkedEvent           Event = "repo:forked"
	RepositoryCommentAddedEvent     Event = "repo:comment:added"
	RepositoryCommentEditedEvent    Event = "repo:comment:edited"
	RepositoryCommentDeletedEvent   Event = "repo:comment:deleted"

	PullRequestOpenedEvent   Event = "pr:opened"
	PullRequestModifiedEvent Event = "pr:modified"
	PullRequestMergedEvent   Event = "pr:merged"
	PullRequestDeclinedEvent Event = "pr:declined"
	PullRequestDeletedEvent  Event = "pr:deleted"

	PullRequestReviewerUpdatedEvent    Event = "pr:reviewer:updated"
	PullRequestReviewerApprovedEvent   Event = "pr:reviewer:approved"
	PullRequestReviewerUnapprovedEvent Event = "pr:reviewer:unapproved"
	PullRequestReviewerNeedsWorkEvent  Event = "pr:reviewer:needs_work"

	PullRequestCommentAddedEvent   Event = "pr:comment:added"
	PullRequestCommentEditedEvent  Event = "pr:comment:edited"
	PullRequestCommentDeletedEvent Event = "pr:comment:deleted"

	DiagnosticsPingEvent Event = "diagnostics:ping"
)

type Option

type Option func(*Webhook) error

Option is a configuration option for the webhook

type Project

type Project struct {
	ID     uint64                 `json:"id"`
	Key    string                 `json:"key"`
	Name   string                 `json:"name"`
	Type   string                 `json:"type"`
	Public *bool                  `json:"public,omitempty"`
	Owner  User                   `json:"owner"`
	Links  map[string]interface{} `json:"links"`
}

type PullRequest

type PullRequest struct {
	ID           uint64                   `json:"id"`
	Version      uint64                   `json:"version"`
	Title        string                   `json:"title"`
	Description  string                   `json:"description,omitempty"`
	State        string                   `json:"state"`
	Open         bool                     `json:"open"`
	Closed       bool                     `json:"closed"`
	CreatedDate  uint64                   `json:"createdDate"`
	UpdatedDate  uint64                   `json:"updatedDate,omitempty"`
	ClosedDate   uint64                   `json:"closedDate,omitempty"`
	FromRef      RepositoryReference      `json:"fromRef"`
	ToRef        RepositoryReference      `json:"toRef"`
	Locked       bool                     `json:"locked"`
	Author       PullRequestParticipant   `json:"author"`
	Reviewers    []PullRequestParticipant `json:"reviewers"`
	Participants []PullRequestParticipant `json:"participants"`
	Properties   map[string]interface{}   `json:"properties,omitempty"`
	Links        map[string]interface{}   `json:"links"`
}

type PullRequestCommentAddedPayload

type PullRequestCommentAddedPayload struct {
	Date            Date        `json:"date"`
	EventKey        Event       `json:"eventKey"`
	Actor           User        `json:"actor"`
	PullRequest     PullRequest `json:"pullRequest"`
	Comment         Comment     `json:"comment"`
	CommentParentId uint64      `json:"commentParentId,omitempty"`
}

type PullRequestCommentDeletedPayload

type PullRequestCommentDeletedPayload struct {
	Date            Date        `json:"date"`
	EventKey        Event       `json:"eventKey"`
	Actor           User        `json:"actor"`
	PullRequest     PullRequest `json:"pullRequest"`
	Comment         Comment     `json:"comment"`
	CommentParentId uint64      `json:"commentParentId,omitempty"`
}

type PullRequestCommentEditedPayload

type PullRequestCommentEditedPayload struct {
	Date            Date        `json:"date"`
	EventKey        Event       `json:"eventKey"`
	Actor           User        `json:"actor"`
	PullRequest     PullRequest `json:"pullRequest"`
	Comment         Comment     `json:"comment"`
	CommentParentId string      `json:"commentParentId,omitempty"`
	PreviousComment string      `json:"previousComment"`
}

type PullRequestDeclinedPayload

type PullRequestDeclinedPayload struct {
	Date        Date        `json:"date"`
	EventKey    Event       `json:"eventKey"`
	Actor       User        `json:"actor"`
	PullRequest PullRequest `json:"pullRequest"`
}

type PullRequestDeletedPayload

type PullRequestDeletedPayload struct {
	Date        Date        `json:"date"`
	EventKey    Event       `json:"eventKey"`
	Actor       User        `json:"actor"`
	PullRequest PullRequest `json:"pullRequest"`
}

type PullRequestMergedPayload

type PullRequestMergedPayload struct {
	Date        Date        `json:"date"`
	EventKey    Event       `json:"eventKey"`
	Actor       User        `json:"actor"`
	PullRequest PullRequest `json:"pullRequest"`
}

type PullRequestModifiedPayload

type PullRequestModifiedPayload struct {
	Date                Date                   `json:"date"`
	EventKey            Event                  `json:"eventKey"`
	Actor               User                   `json:"actor"`
	PullRequest         PullRequest            `json:"pullRequest"`
	PreviousTitle       string                 `json:"previousTitle"`
	PreviousDescription string                 `json:"previousDescription"`
	PreviousTarget      map[string]interface{} `json:"previousTarget"`
}

type PullRequestOpenedPayload

type PullRequestOpenedPayload struct {
	Date        Date        `json:"date"`
	EventKey    Event       `json:"eventKey"`
	Actor       User        `json:"actor"`
	PullRequest PullRequest `json:"pullRequest"`
}

type PullRequestParticipant

type PullRequestParticipant struct {
	User               User   `json:"user"`
	LastReviewedCommit string `json:"lastReviewedCommit,omitempty"`
	Role               string `json:"role"`
	Approved           bool   `json:"approved"`
	Status             string `json:"status"`
}

type PullRequestReviewerApprovedPayload

type PullRequestReviewerApprovedPayload struct {
	Date           Date                   `json:"date"`
	EventKey       Event                  `json:"eventKey"`
	Actor          User                   `json:"actor"`
	PullRequest    PullRequest            `json:"pullRequest"`
	Participant    PullRequestParticipant `json:"participant"`
	PreviousStatus string                 `json:"previousStatus"`
}

type PullRequestReviewerNeedsWorkPayload

type PullRequestReviewerNeedsWorkPayload struct {
	Date           Date                   `json:"date"`
	EventKey       Event                  `json:"eventKey"`
	Actor          User                   `json:"actor"`
	PullRequest    PullRequest            `json:"pullRequest"`
	Participant    PullRequestParticipant `json:"participant"`
	PreviousStatus string                 `json:"previousStatus"`
}

type PullRequestReviewerUnapprovedPayload

type PullRequestReviewerUnapprovedPayload struct {
	Date           Date                   `json:"date"`
	EventKey       Event                  `json:"eventKey"`
	Actor          User                   `json:"actor"`
	PullRequest    PullRequest            `json:"pullRequest"`
	Participant    PullRequestParticipant `json:"participant"`
	PreviousStatus string                 `json:"previousStatus"`
}

type PullRequestReviewerUpdatedPayload

type PullRequestReviewerUpdatedPayload struct {
	Date             Date        `json:"date"`
	EventKey         Event       `json:"eventKey"`
	Actor            User        `json:"actor"`
	PullRequest      PullRequest `json:"pullRequest"`
	RemovedReviewers []User      `json:"removedReviewers"`
	AddedReviewers   []User      `json:"addedReviewers"`
}

type Repository

type Repository struct {
	ID            uint64                 `json:"id"`
	Slug          string                 `json:"slug"`
	Name          string                 `json:"name"`
	ScmId         string                 `json:"scmId"`
	State         string                 `json:"state"`
	StatusMessage string                 `json:"statusMessage"`
	Forkable      bool                   `json:"forkable"`
	Origin        *Repository            `json:"origin,omitempty"`
	Project       Project                `json:"project"`
	Public        bool                   `json:"public"`
	Links         map[string]interface{} `json:"links"`
}

type RepositoryChange

type RepositoryChange struct {
	Reference   RepositoryReference `json:"ref"`
	ReferenceId string              `json:"refId"`
	FromHash    string              `json:"fromHash"`
	ToHash      string              `json:"toHash"`
	Type        string              `json:"type"`
}

type RepositoryCommentAddedPayload

type RepositoryCommentAddedPayload struct {
	Date       Date       `json:"date"`
	EventKey   Event      `json:"eventKey"`
	Actor      User       `json:"actor"`
	Comment    Comment    `json:"comment"`
	Repository Repository `json:"repository"`
	Commit     string     `json:"commit"`
}

type RepositoryCommentDeletedPayload

type RepositoryCommentDeletedPayload struct {
	Date       Date       `json:"date"`
	EventKey   Event      `json:"eventKey"`
	Actor      User       `json:"actor"`
	Comment    Comment    `json:"comment"`
	Repository Repository `json:"repository"`
	Commit     string     `json:"commit"`
}

type RepositoryCommentEditedPayload

type RepositoryCommentEditedPayload struct {
	Date            Date       `json:"date"`
	EventKey        Event      `json:"eventKey"`
	Actor           User       `json:"actor"`
	Comment         Comment    `json:"comment"`
	PreviousComment string     `json:"previousComment"`
	Repository      Repository `json:"repository"`
	Commit          string     `json:"commit"`
}

type RepositoryForkedPayload

type RepositoryForkedPayload struct {
	Date       Date       `json:"date"`
	EventKey   Event      `json:"eventKey"`
	Actor      User       `json:"actor"`
	Repository Repository `json:"repository"`
}

type RepositoryModifiedPayload

type RepositoryModifiedPayload struct {
	Date     Date       `json:"date"`
	EventKey Event      `json:"eventKey"`
	Actor    User       `json:"actor"`
	Old      Repository `json:"old"`
	New      Repository `json:"new"`
}

type RepositoryReference

type RepositoryReference struct {
	ID           string     `json:"id"`
	DisplayId    string     `json:"displayId"`
	Type         string     `json:"type,omitempty"`
	LatestCommit string     `json:"latestCommit,omitempty"`
	Repository   Repository `json:"repository,omitempty"`
}

type RepositoryReferenceChangedPayload

type RepositoryReferenceChangedPayload struct {
	Date       Date               `json:"date"`
	EventKey   Event              `json:"eventKey"`
	Actor      User               `json:"actor"`
	Repository Repository         `json:"repository"`
	Changes    []RepositoryChange `json:"changes"`
}

type User

type User struct {
	ID           uint64                 `json:"id"`
	Name         string                 `json:"name"`
	EmailAddress string                 `json:"emailAddress"`
	DisplayName  string                 `json:"displayName"`
	Active       bool                   `json:"active"`
	Slug         string                 `json:"slug"`
	Type         string                 `json:"type"`
	Links        map[string]interface{} `json:"links"`
}

type Webhook

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

Webhook instance contains all methods needed to process events

func New

func New(options ...Option) (*Webhook, error)

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

func (*Webhook) Parse

func (hook *Webhook) Parse(r *http.Request, events ...Event) (interface{}, error)

type WebhookOptions

type WebhookOptions struct{}

WebhookOptions is a namespace for configuration option methods

func (WebhookOptions) Secret

func (WebhookOptions) Secret(secret string) Option

Secret registers the GitHub secret

Jump to

Keyboard shortcuts

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