gitea

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 7 Imported by: 1

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

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

func NewProvider(token, baseURL string) (*Provider, error)

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

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

func (p *Provider) GetRateLimit(ctx context.Context) (*provider.RateLimit, error)

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

func (p *Provider) ListOrganizations(ctx context.Context) ([]*provider.Organization, error)

ListOrganizations lists organizations the authenticated user belongs to.

func (*Provider) ListUserRepos

func (p *Provider) ListUserRepos(ctx context.Context, user string) ([]*provider.Repository, error)

ListUserRepos lists all repositories for a user.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

func (*Provider) SetToken

func (p *Provider) SetToken(token string) error

SetToken sets the authentication token.

func (*Provider) ValidateToken

func (p *Provider) ValidateToken(ctx context.Context) (bool, error)

ValidateToken validates the current token.

type ProviderOptions

type ProviderOptions struct {
	Token   string
	BaseURL string // Gitea instance URL (required)
}

ProviderOptions configures the Gitea Provider.

Jump to

Keyboard shortcuts

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