adapter

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ForgeName  = "forgejo"
	TokenEnv   = "CODEBERG_TOKEN"
	DefaultAPI = "https://__HOST__/api/v1"
)

Variables

This section is empty.

Functions

func ForgeRegistry

func ForgeRegistry() map[string]ForgeMeta

ForgeRegistry returns all registered forge metadata.

func RegisterForge

func RegisterForge(meta ForgeMeta, f factory)

RegisterForge adds a forge to the registry. Called by each adapter's init.

Types

type Adapter

type Adapter interface {
	Name() string
	Ensure(ctx context.Context, issue Issue) (Result, error)
}

Adapter hides one forge's API quirks (label IDs, dedup, payload shape).

func New

func New(cfg Config) (Adapter, error)

type Config

type Config struct {
	Forge  string
	Host   string
	Owner  string
	Repo   string
	APIURL string
	Token  string
	HTTP   *http.Client
}

Config is everything an adapter needs to talk to one repository.

type ForgeMeta

type ForgeMeta struct {
	Name         string
	TokenEnv     string
	DefaultAPI   func(host string) string
	HostPatterns []string // Host substrings that identify this forge
}

ForgeMeta holds per-forge metadata.

func GetForgeMeta

func GetForgeMeta(name string) (ForgeMeta, bool)

GetForgeMeta returns metadata for a forge, or zero if unknown.

type Issue

type Issue struct {
	Title  string
	Body   string
	Labels []string
}

Issue is the forge-agnostic input.

type Result

type Result struct {
	URL      string
	Existing bool
}

Result reports what Ensure did.

Jump to

Keyboard shortcuts

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