models

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatTime

func FormatTime(t string) string

FormatTime formats a Bitbucket timestamp for display.

Types

type Branch

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

Branch represents a branch reference.

type Clone

type Clone struct {
	Href string `json:"href"`
	Name string `json:"name"`
}

Clone represents a clone link with its protocol name.

type Comment

type Comment struct {
	ID      int  `json:"id"`
	Parent  *ID  `json:"parent,omitempty"`
	Deleted bool `json:"deleted"`
	Content struct {
		Raw    string `json:"raw"`
		Markup string `json:"markup"`
		HTML   string `json:"html"`
	} `json:"content"`
	Inline *InlineRef `json:"inline,omitempty"`
	Author User       `json:"user"`

	CreatedOn string `json:"created_on"`
	UpdatedOn string `json:"updated_on"`
	Links     Links  `json:"links"`
}

Comment represents a pull request comment.

type Commit

type Commit struct {
	Hash    string `json:"hash"`
	Message string `json:"message"`
	Date    string `json:"date"`
	Author  *User  `json:"author"`
}

Commit represents a commit reference.

type ID

type ID struct {
	ID int `json:"id"`
}

ID is used for parent reference.

type InlineRef

type InlineRef struct {
	Path string `json:"path"`
	From *int   `json:"from,omitempty"` // old line
	To   *int   `json:"to,omitempty"`   // new line
}

InlineRef marks a comment as inline on a specific file/line.

type Link struct {
	Href string `json:"href"`
}

Link is a single link.

type Links struct {
	Self   *Link   `json:"self,omitempty"`
	HTML   *Link   `json:"html,omitempty"`
	Clone  []Clone `json:"clone,omitempty"`
	Avatar *Link   `json:"avatar,omitempty"`
}

Links holds common link structures.

type PREndpoint

type PREndpoint struct {
	Branch     Branch      `json:"branch"`
	Commit     Commit      `json:"commit"`
	Repository *Repository `json:"repository"`
}

PREndpoint represents a source or destination branch endpoint.

type Participant

type Participant struct {
	User     User   `json:"user"`
	Role     string `json:"role"` // "REVIEWER", "PARTICIPANT"
	Approved bool   `json:"approved"`
	State    string `json:"state"` // "approved", "changes_requested", etc.
}

Participant represents a PR participant.

type Pipeline

type Pipeline struct {
	UUID        string         `json:"uuid"`
	BuildNumber int            `json:"build_number"`
	State       *PipelineState `json:"state"`
	Target      PipelineTarget `json:"target"`
	CreatedOn   string         `json:"created_on"`
	CompletedOn string         `json:"completed_on"`
	Creator     User           `json:"creator"`
	Links       Links          `json:"links"`
}

Pipeline represents a Bitbucket pipeline.

func (*Pipeline) Duration

func (p *Pipeline) Duration() string

Duration returns the pipeline duration as a string.

func (*Pipeline) StatusText

func (p *Pipeline) StatusText() string

StatusText returns a human-readable status string for a pipeline.

type PipelineState

type PipelineState struct {
	Name   string              `json:"name"` // PENDING, IN_PROGRESS, COMPLETED, etc.
	Result *PipelineStateValue `json:"result,omitempty"`
	Stage  *PipelineStateValue `json:"stage,omitempty"`
}

PipelineState represents the pipeline state.

type PipelineStateValue

type PipelineStateValue struct {
	Name string `json:"name"` // SUCCESSFUL, FAILED, STOPPED, etc.
}

PipelineStateValue holds a state result or stage name.

type PipelineStep

type PipelineStep struct {
	UUID        string         `json:"uuid"`
	Name        string         `json:"name"`
	State       *PipelineState `json:"state"`
	StartedOn   string         `json:"started_on"`
	CompletedOn string         `json:"completed_on"`
	LogLink     string         `json:"-"` // Computed from links
	Links       Links          `json:"links"`
}

PipelineStep represents a step in a pipeline.

type PipelineTarget

type PipelineTarget struct {
	Type     string `json:"type"` // pipeline_ref_target, pipeline_custom_target
	RefType  string `json:"ref_type"`
	RefName  string `json:"ref_name"`
	Selector *struct {
		Type    string `json:"type"`
		Pattern string `json:"pattern"`
	} `json:"selector,omitempty"`
	Commit Commit `json:"commit"`
}

PipelineTarget represents what triggered the pipeline.

type Project

type Project struct {
	Key  string `json:"key"`
	Name string `json:"name"`
	UUID string `json:"uuid"`
}

Project represents a Bitbucket project.

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
	CreatedOn         string        `json:"created_on"`
	UpdatedOn         string        `json:"updated_on"`
	Author            User          `json:"author"`
	Source            PREndpoint    `json:"source"`
	Destination       PREndpoint    `json:"destination"`
	Draft             bool          `json:"draft"`
	CloseSourceBranch bool          `json:"close_source_branch"`
	MergeCommit       *Commit       `json:"merge_commit"`
	Reviewers         []User        `json:"reviewers"`
	Participants      []Participant `json:"participants"`
	TaskCount         int           `json:"task_count"`
	CommentCount      int           `json:"comment_count"`
	Reason            string        `json:"reason"`
	Links             Links         `json:"links"`
}

PullRequest represents a Bitbucket pull request.

type Repository

type Repository struct {
	UUID        string    `json:"uuid"`
	Name        string    `json:"name"`
	FullName    string    `json:"full_name"`
	Slug        string    `json:"slug"`
	Description string    `json:"description"`
	IsPrivate   bool      `json:"is_private"`
	Language    string    `json:"language"`
	CreatedOn   string    `json:"created_on"`
	UpdatedOn   string    `json:"updated_on"`
	Size        int64     `json:"size"`
	ForkPolicy  string    `json:"fork_policy"`
	SCM         string    `json:"scm"`
	Project     *Project  `json:"project"`
	Owner       *User     `json:"owner"`
	Workspace   Workspace `json:"workspace"`
	MainBranch  *Branch   `json:"mainbranch"`
	Links       Links     `json:"links"`
}

Repository represents a Bitbucket repository.

func (*Repository) CloneURL

func (r *Repository) CloneURL(protocol string) string

CloneURL returns the clone URL for the given protocol ("ssh" or "https").

func (*Repository) Visibility

func (r *Repository) Visibility() string

Visibility returns "private" or "public".

type SearchCodeResult added in v0.0.8

type SearchCodeResult struct {
	Type              string               `json:"type"`
	ContentMatchCount int                  `json:"content_match_count"`
	ContentMatches    []SearchContentMatch `json:"content_matches"`
	PathMatches       []SearchSegment      `json:"path_matches"`
	File              SearchFile           `json:"file"`
}

SearchCodeResult represents a single code search result from the Bitbucket API.

type SearchContentMatch added in v0.0.8

type SearchContentMatch struct {
	Lines []SearchLine `json:"lines"`
}

SearchContentMatch holds a set of matched lines within a file.

type SearchFile added in v0.0.8

type SearchFile struct {
	Type  string `json:"type"`
	Path  string `json:"path"`
	Links Links  `json:"links"`
}

SearchFile describes the file that matched a code search.

type SearchLine added in v0.0.8

type SearchLine struct {
	Line     int             `json:"line"`
	Segments []SearchSegment `json:"segments"`
}

SearchLine represents a single line in a content match.

type SearchSegment added in v0.0.8

type SearchSegment struct {
	Text  string `json:"text"`
	Match bool   `json:"match"`
}

SearchSegment represents a segment of text, possibly a match.

type User

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

User represents a Bitbucket user.

type Workspace

type Workspace struct {
	UUID string `json:"uuid"`
	Name string `json:"name"`
	Slug string `json:"slug"`
}

Workspace represents a Bitbucket workspace.

Jump to

Keyboard shortcuts

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