provider

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

internal/provider/bitbucket.go

internal/provider/github.go

internal/provider/provider.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bitbucket

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

Bitbucket implements Provider for Bitbucket Cloud.

func NewBitbucket

func NewBitbucket(token, username, baseURL string) *Bitbucket

NewBitbucket creates a new Bitbucket provider. If baseURL is empty, the default Bitbucket Cloud API endpoint is used. If username is non-empty, Basic Auth is used instead of Bearer token auth.

func (*Bitbucket) CommitStats added in v0.7.0

func (b *Bitbucket) CommitStats(ctx context.Context, repo model.Repo, hash string) (int64, int64, error)

CommitStats fetches addition/deletion counts for a single Bitbucket commit.

func (*Bitbucket) ListCommits added in v0.7.0

func (b *Bitbucket) ListCommits(ctx context.Context, repo model.Repo, limit int) ([]CommitInfo, error)

ListCommits fetches up to limit commits for a repo via the Bitbucket API.

func (*Bitbucket) ListProjects added in v0.2.0

func (b *Bitbucket) ListProjects(ctx context.Context, workspace string) ([]Project, error)

ListProjects fetches all projects in a Bitbucket workspace, handling pagination automatically.

func (*Bitbucket) ListRepos

func (b *Bitbucket) ListRepos(ctx context.Context, opts ListOpts) ([]model.Repo, error)

ListRepos fetches all repositories matching the given options from the Bitbucket API, handling pagination automatically.

type CommitInfo added in v0.7.0

type CommitInfo struct {
	Hash    string
	Author  string
	Message string
}

CommitInfo represents a commit returned from a provider API.

type CommitLister added in v0.7.0

type CommitLister interface {
	ListCommits(ctx context.Context, repo model.Repo, limit int) ([]CommitInfo, error)
	CommitStats(ctx context.Context, repo model.Repo, hash string) (additions, deletions int64, err error)
}

CommitLister extends Provider with commit history capabilities.

type GitHub

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

GitHub implements Provider for GitHub.

func NewGitHub

func NewGitHub(token string, baseURL string) *GitHub

NewGitHub creates a new GitHub provider. If baseURL is empty, the default GitHub API endpoint is used.

func (*GitHub) CommitStats added in v0.7.0

func (g *GitHub) CommitStats(ctx context.Context, repo model.Repo, hash string) (int64, int64, error)

CommitStats fetches addition/deletion counts for a single commit.

func (*GitHub) ListCommits added in v0.7.0

func (g *GitHub) ListCommits(ctx context.Context, repo model.Repo, limit int) ([]CommitInfo, error)

ListCommits fetches up to limit commits for a repo via the GitHub API.

func (*GitHub) ListRepos

func (g *GitHub) ListRepos(ctx context.Context, opts ListOpts) ([]model.Repo, error)

ListRepos fetches all repositories matching the given options from the GitHub API, handling Link header pagination automatically.

type ListOpts

type ListOpts struct {
	Workspace       string
	Organization    string
	User            string
	Projects        []string
	Repos           []string
	Exclude         []string
	IncludeArchived bool
	IncludeForks    bool
}

ListOpts configures which repositories to retrieve from a provider.

type Project added in v0.2.0

type Project struct {
	Key  string
	Name string
}

Project represents a Bitbucket project within a workspace.

type Provider

type Provider interface {
	ListRepos(ctx context.Context, opts ListOpts) ([]model.Repo, error)
}

Provider is the interface that both Bitbucket and GitHub implement for listing repositories.

Jump to

Keyboard shortcuts

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