models

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: Apache-2.0 Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	Properties struct {
		RepositoryID int `json:"repositoryId"`
	} `json:"properties"`
	ID          int           `json:"id"`
	Version     int           `json:"version"`
	Text        string        `json:"text"`
	Author      User          `json:"author"`
	CreatedDate int64         `json:"createdDate"`
	UpdatedDate int64         `json:"updatedDate"`
	Comments    []interface{} `json:"comments"`
	Tasks       []interface{} `json:"tasks"`
}

type Merge

type Merge struct {
	CanMerge   bool   `json:"canMerge"`
	Conflicted bool   `json:"conflicted"`
	Outcome    string `json:"outcome"`
	Vetoes     []Veto `json:"vetoes"`
}

type Participant

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

type Ref

type Ref struct {
	ID           string `json:"id"`
	DisplayID    string `json:"displayId"`
	LatestCommit string `json:"latestCommit"`
	Repository   struct {
		Slug          string `json:"slug"`
		ID            int    `json:"id"`
		Name          string `json:"name"`
		ScmID         string `json:"scmId"`
		State         string `json:"state"`
		StatusMessage string `json:"statusMessage"`
		Forkable      bool   `json:"forkable"`
		Project       struct {
			Key    string `json:"key"`
			ID     int    `json:"id"`
			Name   string `json:"name"`
			Public bool   `json:"public"`
			Type   string `json:"type"`
		} `json:"project"`
		Public bool `json:"public"`
	} `json:"repository"`
}

type User

type User struct {
	Name         string `json:"name"`
	EmailAddress string `json:"emailAddress"`
	ID           int    `json:"id"`
	DisplayName  string `json:"displayName"`
	Active       bool   `json:"active"`
	Slug         string `json:"slug"`
	Type         string `json:"type"`
}

type Veto

type Veto struct {
	SummaryMessage  string `json:"summaryMessage"`
	DetailedMessage string `json:"detailedMessage"`
}

type WebhookBody

type WebhookBody struct {
	BitbucketURL string `json:"bitbucketURL"`
	EventKey     string `json:"eventKey"`
	Date         string `json:"date"`
	Actor        User   `json:"actor"`
	PullRequest  struct {
		ID          int    `json:"id"`
		Version     int    `json:"version"`
		Title       string `json:"title"`
		Description string `json:"description"`
		State       string `json:"state"`
		Open        bool   `json:"open"`
		Closed      bool   `json:"closed"`
		CreatedDate int64  `json:"createdDate"`
		UpdatedDate int64  `json:"updatedDate"`
		Locked      bool   `json:"locked"`
		ToRef       Ref    `json:"toRef"`
		FromRef     Ref    `json:"fromRef"`
		Author      struct {
			User     User   `json:"user"`
			Role     string `json:"role"`
			Approved bool   `json:"approved"`
			Status   string `json:"status"`
		} `json:"author"`
		Reviewers []struct {
			User               User   `json:"user"`
			LastReviewedCommit string `json:"lastReviewedCommit"`
			Role               string `json:"role"`
			Approved           bool   `json:"approved"`
			Status             string `json:"status"`
		} `json:"reviewers"`
		Participants []interface{} `json:"participants"`
	} `json:"pullRequest"`
	// Comment is present if eventKey is pr:comment...
	Comment *Comment `json:"comment"`
	// Participant is present if eventKey is pr:reviewer...
	Participant *Participant `json:"participant"`
	// PreviousStatus is present if eventKey is pr:reviewer:approved , pr:reviewer:unapproved, pr:reviewer:needs_work
	PreviousStatus   string `json:"previousStatus"`
	AddedReviewers   []User `json:"addedReviewers"`
	RemovedReviewers []User `json:"removedReviewers"`
}

func (WebhookBody) ApprovedCount

func (w WebhookBody) ApprovedCount() int

func (WebhookBody) FormatMessage

func (w WebhookBody) FormatMessage(msg string, action string) []slack.MsgOption

func (WebhookBody) GetPrURL

func (w WebhookBody) GetPrURL() string

func (WebhookBody) ID

func (w WebhookBody) ID() (string, string, int)

ID can be used to send into functions that needs the uniqu path to the exact pull request.

Jump to

Keyboard shortcuts

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