Documentation
¶
Index ¶
- func IsAuthError(err error) bool
- func IsNetworkError(err error) bool
- func IsNotFound(err error) bool
- func IsRateLimit(err error) bool
- func RegisterIndexer(name string, factory IndexerFactory)
- type ErrorKind
- type HTTPClient
- type IndexerError
- func NewAPIError(indexer string, statusCode int, url string, body string) *IndexerError
- func NewAuthConfigError(indexer string, msg string) *IndexerError
- func NewDecodeError(indexer string, url string, err error) *IndexerError
- func NewNetworkError(indexer string, url string, err error) *IndexerError
- type IndexerFactory
- type Modpack
- type ModpackFile
- type ModpackIndexer
- type SearchResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsNetworkError ¶
Reports whether the error is a network error
func RegisterIndexer ¶
func RegisterIndexer(name string, factory IndexerFactory)
RegisterIndexer registers an IndexerFactory under the given name. Typically called from an indexer package's init() function.
Types ¶
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
HTTPClient wraps http.Client with common indexer request logic.
func NewHTTPClient ¶
func NewHTTPClient(indexer string, userAgent string, extraHeaders map[string]string) *HTTPClient
NewHTTPClient creates a shared HTTP client for an indexer.
type IndexerError ¶
type IndexerError struct {
Kind ErrorKind
Indexer string
StatusCode int
URL string
Body string
Err error
}
func NewAPIError ¶
func NewAPIError(indexer string, statusCode int, url string, body string) *IndexerError
It automatically classifies 401/403 as Auth, 404 as NotFound, 429 as RateLimit.
func NewAuthConfigError ¶
func NewAuthConfigError(indexer string, msg string) *IndexerError
Missing API key configuration
func NewDecodeError ¶
func NewDecodeError(indexer string, url string, err error) *IndexerError
JSON decode failures.
func NewNetworkError ¶
func NewNetworkError(indexer string, url string, err error) *IndexerError
IndexerError for network-level failures like dns
func (*IndexerError) Error ¶
func (e *IndexerError) Error() string
func (*IndexerError) Unwrap ¶
func (e *IndexerError) Unwrap() error
type IndexerFactory ¶
type IndexerFactory func(apiKey string, cfg *config.Config) ModpackIndexer
IndexerFactory creates a ModpackIndexer from an API key and config.
type Modpack ¶
type Modpack struct {
ID string `json:"id"`
IndexerID string `json:"indexer_id"` // Original ID from the indexer
Indexer string `json:"indexer"` // Which indexer this came from
Name string `json:"name"`
Slug string `json:"slug"`
Summary string `json:"summary"`
Description string `json:"description"`
LogoURL string `json:"logo_url"`
WebsiteURL string `json:"website_url"`
DownloadCount int64 `json:"download_count"`
Categories []string `json:"categories"`
GameVersions []string `json:"game_versions"`
ModLoaders []string `json:"mod_loaders"`
LatestFileID string `json:"latest_file_id"`
DateCreated time.Time `json:"date_created"`
DateModified time.Time `json:"date_modified"`
DateReleased time.Time `json:"date_released"`
}
Modpack represents a modpack from any indexer
type ModpackFile ¶
type ModpackFile struct {
ID string `json:"id"`
ModpackID string `json:"modpack_id"`
DisplayName string `json:"display_name"`
FileName string `json:"file_name"`
FileDate time.Time `json:"file_date"`
FileLength int64 `json:"file_length"`
ReleaseType string `json:"release_type"` // "release", "beta", "alpha"
DownloadURL string `json:"download_url"`
GameVersions []string `json:"game_versions"`
ModLoader string `json:"mod_loader"`
ServerPackFileID *string `json:"server_pack_file_id,omitempty"`
SortIndex int `json:"sort_index"`
VersionNumber string `json:"version_number"` // Human-readable version for Modrinth
}
ModpackFile represents a downloadable file for a modpack
type ModpackIndexer ¶
type ModpackIndexer interface {
// SearchModpacks searches for modpacks with the given criteria
SearchModpacks(ctx context.Context, query string, gameVersion string, modLoader string, offset, limit int) (*SearchResult, error)
// GetModpack retrieves detailed information about a specific modpack
GetModpack(ctx context.Context, modpackID string) (*Modpack, error)
// GetModpackFiles retrieves all available files for a modpack
GetModpackFiles(ctx context.Context, modpackID string) ([]ModpackFile, error)
// GetIndexerName returns the name of this indexer (e.g., "fuego", "modrinth")
GetIndexerName() string
}
ModpackIndexer defines the interface for modpack indexing services
func NewIndexer ¶
NewIndexer creates a ModpackIndexer by name using the factory registry.