Documentation
¶
Index ¶
- Variables
- func TypeLabelOf(src ModSource) string
- type AuthInstructionsProvider
- type Capabilities
- type CapabilityReporter
- type DownloadHeaderProvider
- type EnvKeyProvider
- type GameCatalog
- type GameEntry
- type KeyValidator
- type ModSource
- type Registry
- type SearchQuery
- type SearchResult
- type Token
- type TypeLabeler
Constants ¶
This section is empty.
Variables ¶
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 ¶
func TypeLabelOf ¶ added in v1.21.0
TypeLabelOf returns src's self-reported kind ("directory"/"manifest"/ "api" for custom sources, "built-in" for NexusMods/CurseForge), falling back to "unknown" when src implements no TypeLabeler. Mirrors CapabilitiesOf's optional-interface pattern; the fallback is unreachable in production (every real source implements TypeLabeler), reachable only by bare test doubles.
Types ¶
type AuthInstructionsProvider ¶ added in v1.21.0
type AuthInstructionsProvider interface{ AuthInstructions() string }
AuthInstructionsProvider supplies human setup steps for obtaining a key. Absent: generic instructions naming the env var.
type Capabilities ¶ added in v1.6.0
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. Sources that do not implement CapabilityReporter are assumed fully capable — a default kept for test doubles; production sources should implement CapabilityReporter explicitly rather than rely on this fallback.
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
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 EnvKeyProvider ¶ added in v1.21.0
type EnvKeyProvider interface{ EnvKey() string }
EnvKeyProvider names the environment variable consulted for this source's API key. Absent: the derived LMM_<ID>_API_KEY convention applies.
type GameCatalog ¶ added in v1.21.0
GameCatalog lists the games a source knows about, for interactive game-creation flows. Absent: manual identifier entry.
type GameEntry ¶ added in v1.21.0
type GameEntry struct{ ID, Name, Slug string }
GameEntry is one game known to a source's catalog, for interactive game-creation flows.
type KeyValidator ¶ added in v1.21.0
KeyValidator performs a live API-key check at auth-login time. Absent: keys are stored and validated on first use.
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
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 TypeLabeler ¶ added in v1.21.0
type TypeLabeler interface{ TypeLabel() string }
TypeLabeler names the source's kind for listings (directory/manifest/api/ built-in). Absent: "unknown".
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, ...). |