Documentation
¶
Overview ¶
Package gitea implements the provider interface for Gitea.
This package provides Gitea-specific API integration for repository operations including listing, cloning, and organization management.
Features ¶
- Repository listing (org and user)
- Token validation
- Self-hosted instance support
- Pagination handling
Usage ¶
provider, err := gitea.NewProvider(token, "https://gitea.example.com") repos, err := provider.ListOrganizationRepos(ctx, "myorg")
Index ¶
- type Provider
- func (p *Provider) CreatePullRequest(ctx context.Context, in provider.CreatePullRequestInput) (*provider.PullRequest, error)
- func (p *Provider) FindPullRequest(ctx context.Context, owner, repo, head, base string) (*provider.PullRequest, error)
- func (p *Provider) GetRateLimit(ctx context.Context) (*provider.RateLimit, error)
- func (p *Provider) GetRepository(ctx context.Context, owner, repo string) (*provider.Repository, error)
- func (p *Provider) ListOrganizationRepos(ctx context.Context, org string) ([]*provider.Repository, error)
- func (p *Provider) ListOrganizations(ctx context.Context) ([]*provider.Organization, error)
- func (p *Provider) ListUserRepos(ctx context.Context, user string) ([]*provider.Repository, error)
- func (p *Provider) Name() string
- func (p *Provider) SetToken(token string) error
- func (p *Provider) ValidateToken(ctx context.Context) (bool, error)
- type ProviderOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider implements the provider.Provider interface for Gitea.
func NewProvider ¶
NewProvider creates a new Gitea provider.
func NewProviderWithOptions ¶
func NewProviderWithOptions(opts ProviderOptions) (*Provider, error)
NewProviderWithOptions creates a new Gitea provider with custom options.
Construction is offline: the Gitea SDK's NewClient defaults to probing /api/v1/version, which would make object creation require a live server. github/gitlab NewProvider do not network; SetGiteaVersion("") matches that contract by skipping the constructor version check. Feature gates that need a real version can still be enforced later via a dedicated Ping/Validate.
func (*Provider) CreatePullRequest ¶
func (p *Provider) CreatePullRequest(ctx context.Context, in provider.CreatePullRequestInput) (*provider.PullRequest, error)
CreatePullRequest creates a Gitea pull request.
func (*Provider) FindPullRequest ¶
func (p *Provider) FindPullRequest(ctx context.Context, owner, repo, head, base string) (*provider.PullRequest, error)
FindPullRequest returns the open PR for head/base, or ErrPullRequestNotFound.
func (*Provider) GetRateLimit ¶
GetRateLimit returns current rate limit status Gitea doesn't have a dedicated rate limit API, so we return estimated values.
func (*Provider) GetRepository ¶
func (p *Provider) GetRepository(ctx context.Context, owner, repo string) (*provider.Repository, error)
GetRepository gets a single repository from Gitea.
func (*Provider) ListOrganizationRepos ¶
func (p *Provider) ListOrganizationRepos(ctx context.Context, org string) ([]*provider.Repository, error)
ListOrganizationRepos lists all repositories in a Gitea organization.
func (*Provider) ListOrganizations ¶
ListOrganizations lists organizations the authenticated user belongs to.
func (*Provider) ListUserRepos ¶
ListUserRepos lists all repositories for a user.
type ProviderOptions ¶
ProviderOptions configures the Gitea Provider.