backend

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppProperties

type AppProperties struct {
	Version     string
	BuildNumber string
	DisplayName string
}

AppProperties holds Bitbucket server version metadata.

type Branch

type Branch struct {
	Name       string
	IsDefault  bool
	LatestHash string
}

Branch is the domain representation of a repository branch.

type BranchCreator

type BranchCreator interface {
	CreateBranch(ns, slug string, in CreateBranchInput) (Branch, error)
}

BranchCreator can create branches.

type BranchDeleter

type BranchDeleter interface {
	DeleteBranch(ns, slug, branch string) error
}

BranchDeleter can delete branches.

type BranchLister

type BranchLister interface {
	ListBranches(ns, slug string, limit int) ([]Branch, error)
}

BranchLister can list branches.

type Commit

type Commit struct {
	Hash      string
	Message   string // subject line only (first line of commit message)
	Author    User
	Timestamp time.Time
	WebURL    string
}

Commit is the domain representation of a single repository commit.

type CommitLister

type CommitLister interface {
	ListCommits(ns, slug, branch string, limit int) ([]Commit, error)
}

CommitLister can list commits for a branch.

type CommitReader

type CommitReader interface {
	GetCommit(ns, slug, hash string) (Commit, error)
}

CommitReader can fetch a single commit by hash.

type CreateBranchInput

type CreateBranchInput struct {
	Name    string
	StartAt string // branch name or commit hash
}

CreateBranchInput carries the parameters for creating a branch.

type CreatePRInput

type CreatePRInput struct {
	Title       string
	Description string
	Draft       bool
	FromBranch  string
	ToBranch    string
}

CreatePRInput carries the parameters for creating a pull request.

type CreateRepoInput

type CreateRepoInput struct {
	Name        string
	SCM         string
	Public      bool
	Description string
}

CreateRepoInput carries the parameters for creating a repository.

type CreateTagInput

type CreateTagInput struct {
	Name    string
	StartAt string // branch name or commit hash
	Message string // empty = lightweight tag; non-empty = annotated tag
}

CreateTagInput carries the parameters for creating a tag.

type HTTPError

type HTTPError struct {
	StatusCode int
	Message    string
	RequestURL string
}

HTTPError represents an error HTTP response from the Bitbucket API.

func (*HTTPError) Error

func (e *HTTPError) Error() string

Error implements the error interface.

type MergePRInput

type MergePRInput struct {
	Message  string
	Strategy string
}

MergePRInput carries the parameters for merging a pull request.

type Options added in v1.1.1

type Options struct {
	Token         string
	SkipTLSVerify bool
	// Username is the Bitbucket username / slug. Required for Bitbucket
	// Server/Data Center instances because the Server REST API does not support
	// the Cloud-style "~" self-reference in GET /users/~.
	Username string
}

Options overrides the stored config when constructing a backend client. Used by auth login to validate a new token before it is persisted.

type PRApprover

type PRApprover interface {
	ApprovePR(ns, slug string, id int) error
}

PRApprover can approve pull requests.

type PRChangesRequester

type PRChangesRequester interface {
	RequestChangesPR(ns, slug string, id int) error
}

PRChangesRequester can request changes on a pull request (Cloud only). Access via type assertion — not embedded in Client.

type PRCreator

type PRCreator interface {
	CreatePR(ns, slug string, in CreatePRInput) (PullRequest, error)
}

PRCreator can create pull requests.

type PRDecliner

type PRDecliner interface {
	DeclinePR(ns, slug string, id int) error
}

PRDecliner can decline pull requests.

type PRDiffer

type PRDiffer interface {
	GetPRDiff(ns, slug string, id int) (string, error)
}

PRDiffer can fetch pull request diffs.

type PREditor

type PREditor interface {
	UpdatePR(ns, slug string, id int, in UpdatePRInput) (PullRequest, error)
}

PREditor can update pull request metadata.

type PRLister

type PRLister interface {
	ListPRs(ns, slug, state string, limit int) ([]PullRequest, error)
}

PRLister can list pull requests.

type PRMerger

type PRMerger interface {
	MergePR(ns, slug string, id int, in MergePRInput) (PullRequest, error)
}

PRMerger can merge pull requests.

type PRReader

type PRReader interface {
	GetPR(ns, slug string, id int) (PullRequest, error)
}

PRReader can fetch a single pull request.

type PRReadier

type PRReadier interface {
	ReadyPR(ns, slug string, id int) error
}

PRReadier can mark a draft pull request as ready for review.

type PRReviewRequester

type PRReviewRequester interface {
	RequestReview(ns, slug string, id int, users []string) error
}

PRReviewRequester can request reviewers on a pull request.

type PRUnapprover

type PRUnapprover interface {
	UnapprovePR(ns, slug string, id int) error
}

PRUnapprover can remove approval from pull requests.

type Pipeline

type Pipeline struct {
	UUID        string
	BuildNumber int
	State       string // PENDING, IN_PROGRESS, SUCCESSFUL, FAILED, ERROR, STOPPED
	RefType     string // "branch", "tag", "commit"
	RefName     string
	CreatedOn   string
	Duration    int // seconds
	WebURL      string
}

Pipeline is the domain representation of a Bitbucket Cloud pipeline run.

type PipelineClient

type PipelineClient interface {
	ListPipelines(ns, slug string, limit int) ([]Pipeline, error)
	GetPipeline(ns, slug, uuid string) (Pipeline, error)
	RunPipeline(ns, slug string, in RunPipelineInput) (Pipeline, error)
}

PipelineClient is implemented only by Bitbucket Cloud clients.

func AsPipelineClient

func AsPipelineClient(c Client) (PipelineClient, error)

AsPipelineClient returns the PipelineClient view of c, or an error if the backend does not support pipelines (i.e. is not Bitbucket Cloud).

type PullRequest

type PullRequest struct {
	ID          int
	Title       string
	Description string
	State       string
	Draft       bool
	Author      User
	FromBranch  string
	ToBranch    string
	WebURL      string
}

PullRequest is the domain representation of a Bitbucket pull request.

type RepoDeleter

type RepoDeleter interface {
	DeleteRepo(ns, slug string) error
}

RepoDeleter can delete repositories.

type RepoLister

type RepoLister interface {
	ListRepos(limit int) ([]Repository, error)
}

RepoLister can list repositories.

type RepoReader

type RepoReader interface {
	GetRepo(ns, slug string) (Repository, error)
}

RepoReader can fetch a single repository.

type RepoWriter

type RepoWriter interface {
	CreateRepo(ns string, in CreateRepoInput) (Repository, error)
}

RepoWriter can create repositories.

type Repository

type Repository struct {
	Slug      string
	Name      string
	Namespace string
	SCM       string
	WebURL    string
}

Repository is the domain representation of a Bitbucket repository.

type RunPipelineInput

type RunPipelineInput struct {
	Branch string
}

RunPipelineInput carries the parameters for triggering a pipeline run.

type ServerCapabilities

type ServerCapabilities interface {
	GetApplicationProperties() (AppProperties, error)
}

ServerCapabilities is implemented only by Bitbucket Data Center clients.

type Tag

type Tag struct {
	Name    string
	Hash    string
	Message string // empty for lightweight tags; first line for annotated
	WebURL  string
}

Tag is the domain representation of a repository tag.

type TagCreator

type TagCreator interface {
	CreateTag(ns, slug string, in CreateTagInput) (Tag, error)
}

TagCreator can create tags.

type TagDeleter

type TagDeleter interface {
	DeleteTag(ns, slug, name string) error
}

TagDeleter can delete tags.

type TagLister

type TagLister interface {
	ListTags(ns, slug string, limit int) ([]Tag, error)
}

TagLister can list tags.

type UpdatePRInput

type UpdatePRInput struct {
	Title       string // empty = no change
	Description string // empty = no change
}

UpdatePRInput carries the parameters for editing a pull request.

type User

type User struct {
	Slug        string
	DisplayName string
}

User is the domain representation of a Bitbucket user.

type UserGetter

type UserGetter interface {
	GetCurrentUser() (User, error)
}

UserGetter can retrieve the currently authenticated user.

Jump to

Keyboard shortcuts

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