source

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package source lists repositories from a source forge (GitHub, GitLab or Forgejo/Gitea) so they can be migrated into a target Forgejo instance.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Capabilities

type Capabilities struct {
	Issues       *bool
	PullRequests *bool
	Wiki         *bool
	Releases     *bool
}

Capabilities reports which units a source repository has enabled, when the forge exposes that information. A nil pointer means "not reported", which callers treat as available so nothing is masked without evidence.

type Config

type Config struct {
	// BaseURL overrides the forge base URL; when empty a public default is used
	// for GitHub and GitLab. It is required for Forgejo/Gitea.
	BaseURL string
	// Token authenticates against the source forge; may be empty for public data.
	Token string
}

Config configures a Source client.

type Kind

type Kind string

Kind identifies a supported source-forge type.

const (
	KindGitHub  Kind = "github"
	KindGitLab  Kind = "gitlab"
	KindForgejo Kind = "forgejo"
	KindGitea   Kind = "gitea"
	KindGit     Kind = "git"
)

Supported source-forge kinds. These map onto the Forgejo migration "service" field via Source.Service.

func ParseKind

func ParseKind(s string) (Kind, error)

ParseKind validates and normalises a user-supplied source type.

type Repo

type Repo struct {
	Owner       string
	Name        string
	CloneURL    string
	Description string
	Private     bool
	Caps        Capabilities
}

Repo is a single source repository to migrate.

type Source

type Source interface {
	// ListOrgRepos returns every repository owned by an organization/group.
	ListOrgRepos(ctx context.Context, org string) ([]Repo, error)
	// ListUserRepos returns every repository owned by a user.
	ListUserRepos(ctx context.Context, user string) ([]Repo, error)
	// GetRepo resolves a single owner/name repository's metadata.
	GetRepo(ctx context.Context, owner, name string) (Repo, error)
	// Service returns the Forgejo migration service identifier.
	Service() string
}

Source lists and resolves repositories on a source forge.

func New

func New(kind Kind, cfg Config, client *httpx.Client) (Source, error)

New builds a Source for the given kind. The git kind has no listing API and is handled by the caller, so it is rejected here.

Jump to

Keyboard shortcuts

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