bitbucket

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handle

func Handle(eventType string, body []byte) (string, *discordgo.MessageEmbed, error)

Types

type Actor

type Actor struct {
	Nickname    string `json:"nickname"`
	Type        string `json:"type"`
	UUID        string `json:"uuid"`
	Links       Links  `json:"links"`
	DisplayName string `json:"display_name"`
}

Actor is a common struct used in several types

type Approval

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

An Approval is used in pull requests

type Author

type Author struct {
	Raw  string `json:"raw"`
	User struct {
		Username    string `json:"username"`
		Type        string `json:"type"`
		UUID        string `json:"uuid"`
		Links       Links  `json:"links"`
		DisplayName string `json:"display_name"`
	} `json:"user"`
}

Author is a common struct used in several types

type Comment

type Comment struct {
	ID     int `json:"id"`
	Parent struct {
		ID int `json:"id"`
	} `json:"parent"`
	Content struct {
		Raw    string `json:"raw"`
		HTML   string `json:"html"`
		Markup string `json:"markup"`
	} `json:"content"`
	Inline struct {
		Path string      `json:"path"`
		From interface{} `json:"from"`
		To   int         `json:"to"`
	} `json:"inline"`
	User      User       `json:"user"`
	CreatedOn *time.Time `json:"created_on"`
	UpdatedOn *time.Time `json:"updated_on"`
	Links     Links      `json:"links"`
}

Comment https://confluence.atlassian.com/bitbucket/event-payloads-740262817.html#EventPayloads-entity_comment

type Commit

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

Commit is a common struct used in several types

type Issue

type Issue struct {
	ID        int    `json:"id"`
	Component string `json:"component"`
	Title     string `json:"title"`
	Content   struct {
		Raw    string `json:"raw"`
		HTML   string `json:"html"`
		Markup string `json:"markup"`
	} `json:"content"`
	Priority  string `json:"priority"`
	State     string `json:"state"`
	Type      string `json:"type"`
	Milestone struct {
		Name string `json:"name"`
	} `json:"milestone"`
	Version struct {
		Name string `json:"name"`
	} `json:"version"`
	CreatedOn *time.Time `json:"created_on"`
	UpdatedOn *time.Time `json:"updated_on"`
	Links     Links      `json:"links"`
}

Issue https://confluence.atlassian.com/bitbucket/event-payloads-740262817.html#EventPayloads-entity_issue

type IssueCommentCreatedEvent

type IssueCommentCreatedEvent struct {
	IssueEvent
	Comment Comment `json:"comment"`
}

IssueCommentCreatedEvent https://confluence.atlassian.com/bitbucket/event-payloads-740262817.html#EventPayloads-CommentCreated

type IssueEvent

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

An IssueEvent is not a BB event. This is the base for several Issue* events.

type IssueUpdatedEvent

type IssueUpdatedEvent struct {
	IssueEvent
	Comment Comment `json:"comment"`
	Changes struct {
		Status struct {
			Old string `json:"old"`
			New string `json:"new"`
		} `json:"status"`
	} `json:"changes"`
}

IssueUpdatedEvent https://confluence.atlassian.com/bitbucket/event-payloads-740262817.html#EventPayloads-Updated

type Links struct {
	Avatar struct {
		Href string `json:"href"`
	} `json:"avatar"`
	HTML struct {
		Href string `json:"href"`
	} `json:"html"`
	Self struct {
		Href string `json:"href"`
	} `json:"self"`
	Commits struct {
		Href string `json:"href"`
	} `json:"commits"`
	Commit struct {
		Href string `json:"href"`
	} `json:"commit"`
}

Links is a common struct used in several types. Refer to the event documentation to find out which link types are populated in which events.

type OldOrNew

type OldOrNew struct {
	Repository struct {
		FullName string `json:"full_name"`
		UUID     string `json:"uuid"`
		Links    Links  `json:"links"`
		Name     string `json:"name"`
		Type     string `json:"type"`
	} `json:"repository"`
	Target struct {
		Date    *time.Time `json:"date"`
		Parents []struct {
			Hash  string `json:"hash"`
			Links Links  `json:"links"`
			Type  string `json:"type"`
		} `json:"parents"`
		Message string `json:"message"`
		Hash    string `json:"hash"`
		Author  Author `json:"author"`
		Links   Links  `json:"links"`
		Type    string `json:"type"`
	} `json:"target"`
	Links Links  `json:"links"`
	Name  string `json:"name"`
	Type  string `json:"type"`
}

OldOrNew is used in the RepoPushEvent type

type Participant

type Participant struct {
	Role     string `json:"role"`
	Type     string `json:"type"`
	Approved bool   `json:"approved"`
	User     User   `json:"user"`
}

Participant is the actual structure returned in PullRequest events Note: this doesn't match the docs!?

type PullRequest

type PullRequest struct {
	ID          int    `json:"id"`
	Title       string `json:"title"`
	Description string `json:"description"`
	State       string `json:"state"`
	Author      User   `json:"author"`
	Source      struct {
		Branch struct {
			Name string `json:"name"`
		} `json:"branch"`
		Commit struct {
			Hash string `json:"hash"`
		} `json:"commit"`
		Repository Repository `json:"repository"`
	} `json:"source"`
	Destination struct {
		Branch struct {
			Name string `json:"name"`
		} `json:"branch"`
		Commit struct {
			Hash string `json:"hash"`
		} `json:"commit"`
		Repository Repository `json:"repository"`
	} `json:"destination"`
	MergeCommit struct {
		Hash string `json:"hash"`
	} `json:"merge_commit"`
	Participants      []Participant `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             Links         `json:"links"`
}

PullRequest https://confluence.atlassian.com/bitbucket/event-payloads-740262817.html#EventPayloads-entity_pullrequest

type PullRequestApprovalRemovedEvent

type PullRequestApprovalRemovedEvent struct {
	PullRequestEvent
	Approval Approval `json:"approval"`
}

PullRequestApprovalRemovedEvent https://confluence.atlassian.com/bitbucket/event-payloads-740262817.html#EventPayloads-ApprovalRemoved

type PullRequestApprovedEvent

type PullRequestApprovedEvent struct {
	PullRequestEvent
	Approval Approval `json:"approval"`
}

PullRequestApprovedEvent https://confluence.atlassian.com/bitbucket/event-payloads-740262817.html#EventPayloads-Approved

type PullRequestCommentEvent

type PullRequestCommentEvent struct {
	PullRequestEvent
	Comment Comment `json:"comment"`
}

A PullRequestCommentEvent doesn't exist. It is used as the base for several real events.

type PullRequestEvent

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

A PullRequestEvent is not a BB event. This is the base for several PullRequest* events.

type RepoCommitCommentCreatedEvent

type RepoCommitCommentCreatedEvent struct {
	Actor      Actor      `json:"actor"`
	Comment    Comment    `json:"comment"`
	Repository Repository `json:"repository"`
	Commit     struct {
		Hash string `json:"hash"`
	} `json:"commit"`
}

RepoCommitCommentCreatedEvent https://confluence.atlassian.com/bitbucket/event-payloads-740262817.html#EventPayloads-CommitCommentCreated

type RepoCommitStatusEvent

type RepoCommitStatusEvent struct {
	Actor        Actor      `json:"actor"`
	Repository   Repository `json:"repository"`
	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"`
		Commit      struct {
			Hash   string `json:"hash"`
			Author struct {
				User User `json:"user"`
			} `json:"author"`
		} `json:"commit"`
		CreatedOn *time.Time `json:"created_on"`
		UpdatedOn *time.Time `json:"updated_on"`
		Links     Links      `json:"links"`
	} `json:"commit_status"`
}

A RepoCommitStatusEvent is not a BB event. This is the base for several CommitStatus* events.

type RepoForkEvent

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

RepoForkEvent https://confluence.atlassian.com/bitbucket/event-payloads-740262817.html#EventPayloads-Fork

type RepoPushEvent

type RepoPushEvent struct {
	Actor      Actor      `json:"actor"`
	Repository Repository `json:"repository"`
	Push       struct {
		Changes []struct {
			Forced    bool     `json:"forced"`
			Old       OldOrNew `json:"old"`
			New       OldOrNew `json:"new"`
			Closed    bool     `json:"closed"`
			Created   bool     `json:"created"`
			Truncated bool     `json:"truncated"`
			Links     `json:"links"`
			Commits   []Commit `json:"commits"`
		} `json:"changes"`
	} `json:"push"`
}

RepoPushEvent https://confluence.atlassian.com/bitbucket/event-payloads-740262817.html#EventPayloads-Push

type Repository

type Repository struct {
	Scm      string `json:"scm"`
	FullName string `json:"full_name"`
	Type     string `json:"type"`
	Website  string `json:"website"`
	Owner    struct {
		Username    string `json:"username"`
		Type        string `json:"type"`
		UUID        string `json:"uuid"`
		Links       Links  `json:"links"`
		DisplayName string `json:"display_name"`
	} `json:"owner"`
	UUID      string `json:"uuid"`
	Links     Links  `json:"links"`
	Name      string `json:"name"`
	IsPrivate bool   `json:"is_private"`
}

Repository is a common struct used in several types

type User

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

User https://confluence.atlassian.com/bitbucket/event-payloads-740262817.html#EventPayloads-entity_userUser

Jump to

Keyboard shortcuts

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