source

package
v1.20.1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotSupported = errors.New("operation not supported by this source")

ErrNotSupported indicates a source does not support the requested operation. Callers should branch with errors.Is(err, ErrNotSupported) and degrade gracefully (hide the action, show a notice) rather than treat it as a failure.

Functions

This section is empty.

Types

type Capabilities added in v1.6.0

type Capabilities struct {
	Search       bool
	Dependencies bool
	Updates      bool
	Auth         bool
}

Capabilities reports which optional operations a source supports.

func CapabilitiesOf added in v1.6.0

func CapabilitiesOf(src ModSource) Capabilities

CapabilitiesOf returns src's capabilities, assuming full capability for sources that do not implement CapabilityReporter (all built-in sources).

type CapabilityReporter added in v1.6.0

type CapabilityReporter interface {
	Capabilities() Capabilities
}

CapabilityReporter is implemented by sources that support only a subset of ModSource operations. Sources that do not implement it are assumed fully capable.

type DownloadHeaderProvider added in v1.7.0

type DownloadHeaderProvider interface {
	DownloadHeaders(fileURL string) map[string]string
}

DownloadHeaderProvider is implemented by sources whose file downloads need extra HTTP headers (e.g. header-mode API-key auth on a manifest source). Service.DownloadModToCache consults it with the resolved download URL so the source can scope credentials (e.g. same-origin only). A nil map means no extra headers.

type ModSource

type ModSource interface {
	// Identity
	ID() string
	Name() string

	// Authentication
	AuthURL() string
	ExchangeToken(ctx context.Context, code string) (*Token, error)

	// Discovery
	Search(ctx context.Context, query SearchQuery) (SearchResult, error)
	GetMod(ctx context.Context, gameID, modID string) (*domain.Mod, error)
	GetDependencies(ctx context.Context, mod *domain.Mod) ([]domain.ModReference, error)

	// Downloads
	GetModFiles(ctx context.Context, mod *domain.Mod) ([]domain.DownloadableFile, error)
	GetDownloadURL(ctx context.Context, mod *domain.Mod, fileID string) (string, error)

	// Updates
	CheckUpdates(ctx context.Context, installed []domain.InstalledMod) ([]domain.Update, error)
}

ModSource is the interface for mod repositories

type Registry

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

Registry manages available mod sources

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new source registry

func (*Registry) Get

func (r *Registry) Get(id string) (ModSource, error)

Get retrieves a source by ID

func (*Registry) List

func (r *Registry) List() []ModSource

List returns all registered sources

func (*Registry) Register

func (r *Registry) Register(source ModSource)

Register adds a source to the registry

type SearchQuery

type SearchQuery struct {
	GameID   string
	Query    string
	Category string   // Optional category filter (source-specific: ID or name)
	Tags     []string // Optional tag filters (source-specific)
	Page     int
	PageSize int
}

SearchQuery contains parameters for searching mods.

type SearchResult added in v1.3.0

type SearchResult struct {
	Mods       []domain.Mod
	TotalCount int // Total results available (0 if unknown)
	Page       int
	PageSize   int
}

SearchResult contains paginated search results.

type Token

type Token struct {
	AccessToken  string
	RefreshToken string
	ExpiresAt    time.Time
}

Token represents an OAuth token

Directories

Path Synopsis
Package custom implements user-defined mod sources configured declaratively via YAML files in <configDir>/sources/.
Package custom implements user-defined mod sources configured declaratively via YAML files in <configDir>/sources/.
metadata
Package metadata extracts mod metadata from well-known files inside a mod directory (e.g.
Package metadata extracts mod metadata from well-known files inside a mod directory (e.g.
Package httpclient is a thin JSON HTTP client used by mod-source SDKs (NexusMods, CurseForge, ...).
Package httpclient is a thin JSON HTTP client used by mod-source SDKs (NexusMods, CurseForge, ...).

Jump to

Keyboard shortcuts

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