cloud

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package cloud is the Bitbucket Cloud adapter for the backend.Client interface.

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 is the Bitbucket Cloud HTTP client.

func NewClient

func NewClient(httpClient HTTPClient, baseURL, token, username string) *Client

NewClient constructs a Cloud Client. If token is non-empty Bearer auth is used; else if username is non-empty Basic auth is used with username:token as credentials.

func (*Client) AddPRComment added in v1.6.0

func (c *Client) AddPRComment(ns, slug string, id int, in backend.AddPRCommentInput) (backend.PRComment, error)

AddPRComment adds a top-level comment to a pull request.

func (*Client) ApprovePR

func (c *Client) ApprovePR(ns, slug string, id int) error

ApprovePR approves a PR on behalf of the authenticated user. A nil body is intentional: Bitbucket Cloud returns HTTP 400 when Content-Type: application/json is sent with an empty body on this endpoint. The ContentTypeWhenBody policy on the Cloud transport ensures no Content-Type is set for nil-body POSTs.

func (*Client) CreateBranch

func (c *Client) CreateBranch(ns, slug string, in backend.CreateBranchInput) (backend.Branch, error)

CreateBranch creates a new branch in the given repository. Cloud requires a commit hash as the target; if StartAt is a branch name (not a 40-char hex string) it is resolved to its HEAD commit hash first.

func (*Client) CreatePR

func (c *Client) CreatePR(ns, slug string, in backend.CreatePRInput) (backend.PullRequest, error)

CreatePR creates a new pull request.

func (*Client) CreateRepo

func (c *Client) CreateRepo(ns string, in backend.CreateRepoInput) (backend.Repository, error)

CreateRepo creates a new repository in the workspace ns.

func (*Client) CreateTag

func (c *Client) CreateTag(ns, slug string, in backend.CreateTagInput) (backend.Tag, error)

CreateTag creates a new tag in a repository.

func (*Client) DeclinePR

func (c *Client) DeclinePR(ns, slug string, id int) error

DeclinePR declines an open pull request. A nil body is intentional: ContentTypeWhenBody ensures no Content-Type is set, which is required for this endpoint on Bitbucket Cloud.

func (*Client) DeleteBranch

func (c *Client) DeleteBranch(ns, slug, branch string) error

DeleteBranch deletes a branch in a repository.

func (*Client) DeleteRepo

func (c *Client) DeleteRepo(ns, slug string) error

DeleteRepo deletes a repository.

func (*Client) DeleteTag

func (c *Client) DeleteTag(ns, slug, name string) error

DeleteTag deletes a tag in a repository.

func (*Client) GetCommit

func (c *Client) GetCommit(ns, slug, hash string) (backend.Commit, error)

GetCommit fetches a single commit by hash.

func (*Client) GetCurrentUser

func (c *Client) GetCurrentUser() (backend.User, error)

GetCurrentUser fetches the authenticated user.

func (*Client) GetPR

func (c *Client) GetPR(ns, slug string, id int) (backend.PullRequest, error)

GetPR fetches a single pull request.

func (*Client) GetPRDiff

func (c *Client) GetPRDiff(ns, slug string, id int) (string, error)

GetPRDiff fetches the unified diff for a PR.

func (*Client) GetPipeline

func (c *Client) GetPipeline(ns, slug, uuid string) (backend.Pipeline, error)

GetPipeline fetches a single pipeline run by UUID. Bitbucket Cloud requires pipeline UUIDs to be enclosed in curly braces in the URL path (e.g. "{abc-123}"), so we normalise the caller-supplied uuid.

func (*Client) GetRepo

func (c *Client) GetRepo(ns, slug string) (backend.Repository, error)

GetRepo fetches a single repository.

func (*Client) ListBranches

func (c *Client) ListBranches(ns, slug string, limit int) ([]backend.Branch, error)

ListBranches lists branches for a repository, following all pagination pages.

func (*Client) ListCommitStatuses added in v1.6.0

func (c *Client) ListCommitStatuses(ns, slug, hash string) ([]backend.CommitStatus, error)

ListCommitStatuses lists build / CI statuses reported against a commit hash.

func (*Client) ListCommits

func (c *Client) ListCommits(ns, slug, branch string, limit int) ([]backend.Commit, error)

ListCommits lists commits on a branch for a repository.

func (*Client) ListPRComments added in v1.6.0

func (c *Client) ListPRComments(ns, slug string, id int) ([]backend.PRComment, error)

ListPRComments lists top-level comments on a pull request, following all pagination pages.

func (*Client) ListPRs

func (c *Client) ListPRs(ns, slug, state string, limit int) ([]backend.PullRequest, error)

ListPRs lists pull requests for a repository, following all pagination pages.

func (*Client) ListPipelines

func (c *Client) ListPipelines(ns, slug string, limit int) ([]backend.Pipeline, error)

ListPipelines lists recent pipeline runs for a repository.

func (*Client) ListRepos

func (c *Client) ListRepos(limit int) ([]backend.Repository, error)

ListRepos lists repositories visible to the authenticated user, following all pagination pages.

func (*Client) ListTags

func (c *Client) ListTags(ns, slug string, limit int) ([]backend.Tag, error)

ListTags lists tags for a repository, following all pagination pages.

func (*Client) MergePR

func (c *Client) MergePR(ns, slug string, id int, in backend.MergePRInput) (backend.PullRequest, error)

MergePR merges a pull request.

func (*Client) ReadyPR

func (c *Client) ReadyPR(ns, slug string, id int) error

ReadyPR marks a draft pull request as ready for review.

func (*Client) RequestChangesPR

func (c *Client) RequestChangesPR(ns, slug string, id int) error

RequestChangesPR requests changes on a pull request (Cloud only). A nil body is intentional: ContentTypeWhenBody ensures no Content-Type is set, which is required for this endpoint on Bitbucket Cloud.

func (*Client) RequestReview

func (c *Client) RequestReview(ns, slug string, id int, users []string) error

RequestReview adds reviewers to a pull request (one request per user).

func (*Client) RunPipeline

func (c *Client) RunPipeline(ns, slug string, in backend.RunPipelineInput) (backend.Pipeline, error)

RunPipeline triggers a new pipeline run on a branch.

func (*Client) UnapprovePR

func (c *Client) UnapprovePR(ns, slug string, id int) error

UnapprovePR removes the authenticated user's approval from a pull request.

func (*Client) UpdatePR

func (c *Client) UpdatePR(ns, slug string, id int, in backend.UpdatePRInput) (backend.PullRequest, error)

UpdatePR updates the title and/or description of a pull request.

type HTTPClient

type HTTPClient = httpx.Doer

HTTPClient is the transport interface for making HTTP requests.

Jump to

Keyboard shortcuts

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