Documentation ¶
Index ¶
- Constants
- func DoCommandBody(ctx context.Context, client *Client, cmd command) (io.ReadCloser, error)
- func DoCommandResponse[C commandResponse[T], T any](ctx context.Context, client *Client, cmd C) (T, error)
- func NewCache[K comparable, V any]() *syncedCache[K, V]
- type BitbucketRepo
- type Client
- func (c *Client) AuthorizeRequest(req *http.Request)
- func (c *Client) ClearCache()
- func (c *Client) GetCommits(ctx context.Context, cmd *GetCommitsCommand) (*GetCommitsResponse, error)
- func (c *Client) GetFileContent(ctx context.Context, cmd *GetFileContentCommand) ([]byte, error)
- func (c *Client) GetFiles(ctx context.Context, cmd *GetFilesCommand) (*GetFilesResponse, error)
- func (c *Client) GetFilesIterator(ctx context.Context, cmd *GetFilesCommand) (*FilesIterator, error)
- func (c *Client) GetTags(ctx context.Context, cmd *GetTagsCommand) (*GetTagsResponse, error)
- func (c *Client) OpenRawFile(ctx context.Context, cmd *OpenRawFileCommand) (io.ReadCloser, error)
- type Commit
- type Committer
- type FileInfo
- type FilesIterator
- type GetCommitsCommand
- type GetCommitsResponse
- type GetFileContentCommand
- type GetFilesCommand
- type GetFilesResponse
- type GetTagsCommand
- type GetTagsResponse
- type OpenRawFileCommand
- type SecretString
- type Tag
Constants ¶
const (
MaxBodyInCache = 100 * 1024 * 1024
)
Variables ¶
This section is empty.
Functions ¶
func DoCommandBody ¶ added in v0.0.2
DoCommandBody performs Do for the given command and returns the response body. You need to close the io.ReadCloser after use.
func DoCommandResponse ¶ added in v0.0.2
func DoCommandResponse[C commandResponse[T], T any](ctx context.Context, client *Client, cmd C) (T, error)
DoCommandResponse performs do for the given command and returns the parsed body.
func NewCache ¶ added in v0.0.5
func NewCache[K comparable, V any]() *syncedCache[K, V]
Types ¶
type BitbucketRepo ¶
func (*BitbucketRepo) GetContent ¶
func (r *BitbucketRepo) GetContent(ctx context.Context, component string, version string, filePath string) ([]byte, error)
GetContent implements server.BitbucketRepository.
type Client ¶
type Client struct { BaseURL string AccessKey SecretString Logger *slog.Logger // MaxBodyInCache determines the max body size for requests in the cache. // Defaults to 100Mi. // Set to a negative value to disable caching. MaxBodyInCache int64 // contains filtered or unexported fields }
Client is a client for the Bitbucket repository.
func (*Client) AuthorizeRequest ¶
AuthorizeRequest adds an Authorization bearer header to the headers.
func (*Client) ClearCache ¶ added in v0.0.5
func (c *Client) ClearCache()
func (*Client) GetCommits ¶ added in v0.0.5
func (c *Client) GetCommits(ctx context.Context, cmd *GetCommitsCommand) (*GetCommitsResponse, error)
GetCommits returns an array of commits or a single commit.
func (*Client) GetFileContent ¶
GetFileContent retrieves text content from the file.
Use OpenRawFile if you want to read the file content.
func (*Client) GetFiles ¶
func (c *Client) GetFiles(ctx context.Context, cmd *GetFilesCommand) (*GetFilesResponse, error)
GetFiles returns a GetFilesResponse that contains the list of files found.
func (*Client) GetFilesIterator ¶
func (c *Client) GetFilesIterator(ctx context.Context, cmd *GetFilesCommand) (*FilesIterator, error)
GetFilesIterator returns a file interator for the FilePath in GetFilesCommand.
func (*Client) GetTags ¶
func (c *Client) GetTags(ctx context.Context, cmd *GetTagsCommand) (*GetTagsResponse, error)
GetTags returns the tags in the repository.
func (*Client) OpenRawFile ¶
func (c *Client) OpenRawFile(ctx context.Context, cmd *OpenRawFileCommand) (io.ReadCloser, error)
OpenRawFile opens the file as specified in the cmd parameter. The returned io.ReadCloser is the body of the response. You need to close the io.ReadCloser after use.
type FilesIterator ¶
type FilesIterator struct {
// contains filtered or unexported fields
}
FilesIterator is an iterator for the files in a directory in the repository.
func (*FilesIterator) Files ¶ added in v0.0.4
func (i *FilesIterator) Files() iter.Seq[*FileInfo]
Files returns a new iter iterator
func (*FilesIterator) Next ¶
func (i *FilesIterator) Next() *FileInfo
Next returns the next FileInfo in the directory, or nil if all entries have been read.
type GetCommitsCommand ¶ added in v0.0.5
type GetCommitsCommand struct { ProjectKey string RepoSlug string OrderBy string Start int Limit int CommitID string // optional }
func (*GetCommitsCommand) ParseResponse ¶ added in v0.0.5
func (c *GetCommitsCommand) ParseResponse(data []byte) (*GetCommitsResponse, error)
func (*GetCommitsCommand) Validate ¶ added in v0.0.5
func (c *GetCommitsCommand) Validate() error
type GetCommitsResponse ¶ added in v0.0.5
type GetCommitsResponse struct {
Commits []*Commit
}
type GetFileContentCommand ¶
func (*GetFileContentCommand) ParseResponse ¶
func (c *GetFileContentCommand) ParseResponse(data []byte) ([]byte, error)
func (*GetFileContentCommand) Validate ¶
func (c *GetFileContentCommand) Validate() error
type GetFilesCommand ¶
type GetFilesCommand struct { FilePath string ProjectKey string RepoSlug string At string Start int Limit int }
func (*GetFilesCommand) ParseResponse ¶
func (c *GetFilesCommand) ParseResponse(data []byte) (*GetFilesResponse, error)
func (*GetFilesCommand) Validate ¶
func (c *GetFilesCommand) Validate() error
type GetFilesResponse ¶
type GetTagsCommand ¶
GetTagsCommand is the command to retrieve all tags from the repository.
func (*GetTagsCommand) ParseResponse ¶
func (c *GetTagsCommand) ParseResponse(data []byte) (*GetTagsResponse, error)
func (*GetTagsCommand) Validate ¶
func (c *GetTagsCommand) Validate() error
type GetTagsResponse ¶ added in v0.0.5
type GetTagsResponse struct {
Tags []*Tag
}
type OpenRawFileCommand ¶
func (*OpenRawFileCommand) Validate ¶
func (c *OpenRawFileCommand) Validate() error
type SecretString ¶
type SecretString string
Secret string masks the value for String to avoid accidental disclosure.