Documentation
¶
Index ¶
- type Client
- func (c *Client) ClosePR(ctx context.Context, repo string, number int) error
- func (c *Client) CommentPR(ctx context.Context, repo string, number int, body string) error
- func (c *Client) CreatePR(ctx context.Context, in operations.PRInput) (operations.PRDetail, error)
- func (c *Client) CreateRepo(ctx context.Context, in operations.RepoInput) (operations.Repo, error)
- func (c *Client) DeleteRepo(ctx context.Context, fullName string) error
- func (c *Client) FetchSpec(ctx context.Context, repo string, number int) (operations.FetchSpec, error)
- func (c *Client) GetPR(ctx context.Context, repo string, number int) (operations.PRDetail, error)
- func (c *Client) ListIssues(ctx context.Context) ([]operations.Issue, error)
- func (c *Client) ListPRs(ctx context.Context) ([]operations.PR, error)
- func (c *Client) ListProjects(ctx context.Context) ([]operations.Project, error)
- func (c *Client) ListRepos(ctx context.Context) ([]operations.Repo, error)
- func (c *Client) ListRuns(ctx context.Context, fullName string) ([]operations.Run, error)
- func (c *Client) ListWorkflows(ctx context.Context, fullName string) ([]operations.Workflow, error)
- func (c *Client) MergePR(ctx context.Context, repo string, number int, opts operations.MergeOptions) error
- func (c *Client) Name() string
- func (c *Client) PRDiff(ctx context.Context, repo string, number int) (string, error)
- func (c *Client) RenameRepo(ctx context.Context, fullName, newName string) (operations.Repo, error)
- func (c *Client) SetForgeLabel(label string)
- func (c *Client) SetInstance(name string)
- func (c *Client) SetVisibility(ctx context.Context, fullName string, private bool) (operations.Repo, error)
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 ¶
func New(cfg operations.BitbucketConfig) (*Client, error)
New builds a Bitbucket client from the given credentials.
func (*Client) ClosePR ¶
ClosePR declines a pull request, which is Bitbucket's equivalent of closing.
func (*Client) CommentPR ¶
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 ¶
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) ListIssues ¶
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) ListProjects ¶
ListProjects lists workspace projects.
func (*Client) ListRuns ¶
ListRuns lists pipeline runs for a repository. fullName is workspace/repo.
func (*Client) ListWorkflows ¶
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) RenameRepo ¶
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 ¶
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 ¶
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.