bitbucket

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client talks to the Bitbucket REST API on behalf of the configured user.

func New

New builds a Bitbucket client from the given credentials.

func (*Client) ClosePR

func (c *Client) ClosePR(ctx context.Context, repo string, number int) error

ClosePR declines a pull request, which is Bitbucket's equivalent of closing.

func (*Client) CommentPR

func (c *Client) CommentPR(ctx context.Context, repo string, number int, body string) error

CommentPR adds a comment to a pull request.

Bitbucket has no issue tracker, but pull request comments are available on the same endpoints the retired tracker used, so comments still work.

func (*Client) CreatePR

func (c *Client) CreatePR(ctx context.Context, in operations.PRInput) (operations.PRDetail, error)

CreatePR opens a pull request.

func (*Client) CreateRepo

func (c *Client) CreateRepo(ctx context.Context, in operations.RepoInput) (operations.Repo, error)

CreateRepo creates a repository in the configured workspace.

func (*Client) DeleteRepo

func (c *Client) DeleteRepo(ctx context.Context, fullName string) error

DeleteRepo deletes a repository. fullName is workspace/repo.

func (*Client) FetchSpec

func (c *Client) FetchSpec(ctx context.Context, repo string, number int) (operations.FetchSpec, error)

FetchSpec returns how to fetch a pull request head locally.

Bitbucket publishes no pull request ref namespace, so the head branch itself is fetched. That only works when the head lives in the base repository: for a pull request opened from a fork the branch exists solely on the fork, so the spec points at the fork's clone URL under a distinct remote name and the caller adds that remote before fetching.

func (*Client) GetPR

func (c *Client) GetPR(ctx context.Context, repo string, number int) (operations.PRDetail, error)

GetPR returns a single pull request in full.

func (*Client) ListIssues

func (c *Client) ListIssues(ctx context.Context) ([]operations.Issue, error)

ListIssues reports that Bitbucket no longer provides an issue tracker. The tracker was retired in 2023 and the issue API endpoints are marked deprecated; scanning them would silently return empty or stale data.

func (*Client) ListPRs

func (c *Client) ListPRs(ctx context.Context) ([]operations.PR, error)

ListPRs returns open pull requests across the workspace's repositories.

func (*Client) ListProjects

func (c *Client) ListProjects(ctx context.Context) ([]operations.Project, error)

ListProjects lists workspace projects.

func (*Client) ListRepos

func (c *Client) ListRepos(ctx context.Context) ([]operations.Repo, error)

ListRepos returns the repositories in the configured workspace.

func (*Client) ListRuns

func (c *Client) ListRuns(ctx context.Context, fullName string) ([]operations.Run, error)

ListRuns lists pipeline runs for a repository. fullName is workspace/repo.

func (*Client) ListWorkflows

func (c *Client) ListWorkflows(ctx context.Context, fullName string) ([]operations.Workflow, error)

ListWorkflows returns ErrNotSupported: Bitbucket pipelines are surfaced by ListRuns and there is no workflow-definition API.

func (*Client) MergePR

func (c *Client) MergePR(ctx context.Context, repo string, number int, opts operations.MergeOptions) error

MergePR merges a pull request.

Bitbucket has no draft concept and no readiness toggle, so the draft-related operations are deliberately absent: this client satisfies prWriter but not prChecker, and the command layer reports that as a note.

func (*Client) Name

func (c *Client) Name() string

Name returns the instance name.

func (*Client) PRDiff

func (c *Client) PRDiff(ctx context.Context, repo string, number int) (string, error)

PRDiff returns the unified diff of a pull request.

func (*Client) RenameRepo

func (c *Client) RenameRepo(ctx context.Context, fullName, newName string) (operations.Repo, error)

RenameRepo renames a repository. fullName is workspace/repo.

Bitbucket has no dedicated rename endpoint; PUT on the repository accepts a new name and re-slugifies the location (the new URL comes back in the Location header, and in the body's full_name). The slug is derived from the name, so the request fails if the resulting slug collides with an existing repository in the workspace.

func (*Client) SetForgeLabel

func (c *Client) SetForgeLabel(label string)

SetForgeLabel overrides the forge label the client stamps on returned resources. Used to give user-named aliases the right identity in listings while the Bitbucket client does the API work.

func (*Client) SetInstance

func (c *Client) SetInstance(name string)

SetInstance names this client's instance (default: the forge type).

func (*Client) SetVisibility

func (c *Client) SetVisibility(ctx context.Context, fullName string, private bool) (operations.Repo, error)

SetVisibility changes whether a repository is private. fullName is workspace/repo.

Jump to

Keyboard shortcuts

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