shared

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PRStateFromString

func PRStateFromString(state string) string

PRStateFromString converts a string state to the Bitbucket API state format

func ParsePRArg

func ParsePRArg(arg string) (int, bbrepo.Interface, error)

ParsePRArg parses a PR argument which can be a number or URL

Types

type Branch

type Branch struct {
	Branch struct {
		Name string `json:"name"`
	} `json:"branch"`
	Commit struct {
		Hash string `json:"hash"`
	} `json:"commit"`
	Repository struct {
		FullName string `json:"full_name"`
		UUID     string `json:"uuid"`
		Name     string `json:"name"`
		Links    Links  `json:"links"`
	} `json:"repository"`
}

type Comment

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

Comment represents a Bitbucket pull request comment

type CommentList

type CommentList struct {
	Size     int       `json:"size"`
	Page     int       `json:"page"`
	PageLen  int       `json:"pagelen"`
	Next     string    `json:"next"`
	Previous string    `json:"previous"`
	Values   []Comment `json:"values"`
}

CommentList represents a paginated list of comments

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

type PullRequest

type PullRequest struct {
	ID          int    `json:"id"`
	Title       string `json:"title"`
	Description string `json:"description"`
	State       string `json:"state"` // OPEN, MERGED, DECLINED, SUPERSEDED
	Author      User   `json:"author"`
	Source      Branch `json:"source"`
	Destination Branch `json:"destination"`
	CreatedOn   string `json:"created_on"`
	UpdatedOn   string `json:"updated_on"`
	CloseSource bool   `json:"close_source_branch"`
	Links       Links  `json:"links"`
	Reviewers   []User `json:"reviewers"`
	MergeCommit *struct {
		Hash string `json:"hash"`
	} `json:"merge_commit,omitempty"`
	CommentCount int `json:"comment_count"`
	TaskCount    int `json:"task_count"`
}

PullRequest represents a Bitbucket pull request

func (*PullRequest) BaseBranch

func (pr *PullRequest) BaseBranch() string

BaseBranch returns the destination branch name

func (*PullRequest) HTMLURL

func (pr *PullRequest) HTMLURL() string

HTMLURL returns the web URL for the PR

func (*PullRequest) HeadBranch

func (pr *PullRequest) HeadBranch() string

HeadBranch returns the source branch name

func (*PullRequest) StateDisplay

func (pr *PullRequest) StateDisplay() string

StateDisplay returns a human-readable state

type PullRequestList

type PullRequestList struct {
	Size     int           `json:"size"`
	Page     int           `json:"page"`
	PageLen  int           `json:"pagelen"`
	Next     string        `json:"next"`
	Previous string        `json:"previous"`
	Values   []PullRequest `json:"values"`
}

PullRequestList represents a paginated list of pull requests

type User

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

Jump to

Keyboard shortcuts

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