provider

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

internal/provider/bitbucket.go

internal/provider/github.go

internal/provider/gitlab.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, client *http.Client) *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) CommitFileStats added in v0.8.0

func (b *Bitbucket) CommitFileStats(ctx context.Context, repo model.Repo, hash string) ([]FileChange, error)

CommitFileStats fetches per-file addition/deletion counts for a single Bitbucket commit.

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 ChurnLister added in v0.8.0

type ChurnLister interface {
	CommitLister
	CommitFileStats(ctx context.Context, repo model.Repo, hash string) ([]FileChange, error)
}

ChurnLister extends Provider with per-file commit stats.

type CommitInfo added in v0.7.0

type CommitInfo struct {
	Hash    string
	Author  string
	Message string
	Date    time.Time
}

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 FileChange added in v0.8.0

type FileChange struct {
	Path      string
	Additions int64
	Deletions int64
}

FileChange represents a file modified in a commit.

type GitHub

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

GitHub implements Provider for GitHub.

func NewGitHub

func NewGitHub(token string, baseURL string, client *http.Client) *GitHub

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

func (*GitHub) CommitFileStats added in v0.8.0

func (g *GitHub) CommitFileStats(ctx context.Context, repo model.Repo, hash string) ([]FileChange, error)

CommitFileStats fetches per-file addition/deletion counts for a single commit.

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 GitLab added in v0.8.0

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

GitLab implements Provider and CommitLister for GitLab.

func NewGitLab added in v0.8.0

func NewGitLab(token string, baseURL string, client *http.Client) *GitLab

NewGitLab creates a new GitLab provider. If baseURL is empty, the default GitLab.com endpoint is used.

func (*GitLab) CommitStats added in v0.8.0

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

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

func (*GitLab) ListCommits added in v0.8.0

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

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

func (*GitLab) ListRepos added in v0.8.0

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

func (*GitLab) ListSubgroups added in v0.8.0

func (g *GitLab) ListSubgroups(ctx context.Context, group string) ([]Subgroup, error)

ListSubgroups fetches all subgroups in a GitLab group.

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 Bitbucket, GitHub, and GitLab implement for listing repositories.

type RateLimitTransport added in v0.8.1

type RateLimitTransport struct {
	ReqPerSec float64           // 0 = unlimited (retry-only)
	Base      http.RoundTripper // nil = http.DefaultTransport
	// contains filtered or unexported fields
}

RateLimitTransport wraps an http.RoundTripper with rate limiting and 429 retry.

func (*RateLimitTransport) RoundTrip added in v0.8.1

func (t *RateLimitTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements http.RoundTripper with rate limiting and 429 retry.

type Subgroup added in v0.8.0

type Subgroup struct {
	ID       int
	Path     string
	FullPath string
	Name     string
}

Subgroup represents a GitLab subgroup within a group.

Jump to

Keyboard shortcuts

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