bitbucket

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package bitbucket reads tags, files and directory listings of Bitbucket Cloud repositories through its REST API, with the same methods the GitHub client offers the digester.

Index

Constants

View Source
const APIHost = "api.bitbucket.org"

APIHost is the host of the Bitbucket Cloud REST API.

View Source
const TokenEnv = "BITBUCKET_API_TOKEN"

TokenEnv is the environment variable whose token the client sends as Bearer.

Variables

View Source
var ErrBadRepo = errors.New("not a bitbucket workspace/repo")

ErrBadRepo is wrapped by errors for a repository that isn't workspace/repo.

Functions

This section is empty.

Types

type Client

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

Client reads tags and files of Bitbucket Cloud repositories. Bitbucket Cloud has no releases.

func New

func New(hc *http.Client, o Options) *Client

New returns a client that sends requests through hc. The token goes only to the API host.

func (*Client) Authenticated

func (c *Client) Authenticated() bool

Authenticated reports whether the client has a token.

func (*Client) File

func (c *Client) File(ctx context.Context, repo, ref, path string) ([]byte, error)

File returns path in repo at ref; an empty ref means the default branch. A ref with a slash is looked up as a tag, because the src endpoint can't take one.

func (*Client) ReleaseBodies

func (c *Client) ReleaseBodies(context.Context, string, []string) (map[string]github.Release, error)

ReleaseBodies returns no releases: Bitbucket Cloud has none, so notes come from files.

func (*Client) Releases

func (c *Client) Releases(ctx context.Context, repo string) ([]github.Release, error)

Releases lists the tags of repo as releases without bodies, because Bitbucket Cloud has none.

func (*Client) RootFiles

func (c *Client) RootFiles(ctx context.Context, repo string) ([]github.File, error)

RootFiles lists the top directory of repo on its default branch.

func (*Client) TagRefs

func (c *Client) TagRefs(ctx context.Context, repo string) ([]version.Ref, error)

TagRefs lists every tag of repo with its commit date.

func (*Client) Tags

func (c *Client) Tags(ctx context.Context, repo string) ([]string, error)

Tags lists every tag name of repo.

type Options

type Options struct {
	Token string // empty means anonymous requests (60 an hour per IP)
	Base  string // API base URL; empty means https://api.bitbucket.org/2.0
}

Options configures New.

Jump to

Keyboard shortcuts

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