Documentation
¶
Index ¶
- Constants
- type APIResponse
- type Author
- type Category
- type Client
- func (c *Client) GetCategories(ctx context.Context, gameID int) ([]Category, error)
- func (c *Client) GetDownloadURL(ctx context.Context, modID, fileID int) (string, error)
- func (c *Client) GetGame(ctx context.Context, gameID int) (*Game, error)
- func (c *Client) GetGames(ctx context.Context) ([]Game, error)
- func (c *Client) GetMod(ctx context.Context, modID int) (*Mod, error)
- func (c *Client) GetModFile(ctx context.Context, modID, fileID int) (*File, error)
- func (c *Client) GetModFiles(ctx context.Context, modID int) ([]File, error)
- func (c *Client) GetMods(ctx context.Context, modIDs []int) ([]Mod, error)
- func (c *Client) IsAuthenticated() bool
- func (c *Client) SearchMods(ctx context.Context, gameID int, query string, categoryID int, ...) ([]Mod, *Pagination, error)
- func (c *Client) SetAPIKey(key string)
- type CurseForge
- func (c *CurseForge) AuthURL() string
- func (c *CurseForge) CheckUpdates(ctx context.Context, installed []domain.InstalledMod) ([]domain.Update, error)
- func (c *CurseForge) ExchangeToken(ctx context.Context, code string) (*source.Token, error)
- func (c *CurseForge) GetDependencies(ctx context.Context, mod *domain.Mod) ([]domain.ModReference, error)
- func (c *CurseForge) GetDownloadURL(ctx context.Context, mod *domain.Mod, fileID string) (string, error)
- func (c *CurseForge) GetMod(ctx context.Context, gameID, modID string) (*domain.Mod, error)
- func (c *CurseForge) GetModFiles(ctx context.Context, mod *domain.Mod) ([]domain.DownloadableFile, error)
- func (c *CurseForge) ID() string
- func (c *CurseForge) IsAuthenticated() bool
- func (c *CurseForge) Name() string
- func (c *CurseForge) Search(ctx context.Context, query source.SearchQuery) ([]domain.Mod, error)
- func (c *CurseForge) SetAPIKey(key string)
- type File
- type FileDependency
- type FileHash
- type FileIndex
- type FileModule
- type Game
- type GameAssets
- type Mod
- type ModAsset
- type ModLinks
- type PaginatedResponse
- type Pagination
- type SortableGameVersion
- type StringDownloadURL
Constants ¶
const ( RelationEmbeddedLibrary = 1 RelationOptionalDependency = 2 RelationRequiredDependency = 3 RelationTool = 4 RelationIncompatible = 5 RelationInclude = 6 )
Dependency relation types
const ( ReleaseTypeRelease = 1 ReleaseTypeBeta = 2 ReleaseTypeAlpha = 3 )
Release types
const ( ModLoaderAny = 0 ModLoaderForge = 1 ModLoaderCauldron = 2 ModLoaderLiteLoader = 3 ModLoaderFabric = 4 ModLoaderQuilt = 5 ModLoaderNeoForge = 6 )
Mod loader types
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIResponse ¶
type APIResponse[T any] struct { Data T `json:"data"` }
APIResponse wraps all CurseForge API responses
type Category ¶
type Category struct {
ID int `json:"id"`
GameID int `json:"gameId"`
Name string `json:"name"`
Slug string `json:"slug"`
URL string `json:"url"`
IconURL string `json:"iconUrl"`
DateModified time.Time `json:"dateModified"`
IsClass bool `json:"isClass"`
ClassID int `json:"classId"`
ParentCategoryID int `json:"parentCategoryId"`
DisplayIndex int `json:"displayIndex"`
}
Category represents a mod category
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the CurseForge REST API v1
func (*Client) GetCategories ¶
GetCategories fetches categories for a game
func (*Client) GetDownloadURL ¶
GetDownloadURL fetches the download URL for a mod file
func (*Client) GetModFile ¶
GetModFile fetches a specific file for a mod
func (*Client) GetModFiles ¶
GetModFiles fetches files for a mod
func (*Client) IsAuthenticated ¶
IsAuthenticated returns true if an API key is configured
type CurseForge ¶
type CurseForge struct {
// contains filtered or unexported fields
}
CurseForge implements the ModSource interface
func New ¶
func New(httpClient *http.Client, apiKey string) *CurseForge
New creates a new CurseForge source
func (*CurseForge) AuthURL ¶
func (c *CurseForge) AuthURL() string
AuthURL returns the authentication URL. CurseForge uses API key authentication obtained from console.curseforge.com.
func (*CurseForge) CheckUpdates ¶
func (c *CurseForge) CheckUpdates(ctx context.Context, installed []domain.InstalledMod) ([]domain.Update, error)
CheckUpdates checks for available updates.
func (*CurseForge) ExchangeToken ¶
ExchangeToken exchanges an OAuth code for tokens. CurseForge uses API key authentication instead of OAuth.
func (*CurseForge) GetDependencies ¶
func (c *CurseForge) GetDependencies(ctx context.Context, mod *domain.Mod) ([]domain.ModReference, error)
GetDependencies returns mod dependencies from CurseForge. Dependencies are extracted from the latest file's dependency list.
func (*CurseForge) GetDownloadURL ¶
func (c *CurseForge) GetDownloadURL(ctx context.Context, mod *domain.Mod, fileID string) (string, error)
GetDownloadURL gets the download URL for a mod file
func (*CurseForge) GetModFiles ¶
func (c *CurseForge) GetModFiles(ctx context.Context, mod *domain.Mod) ([]domain.DownloadableFile, error)
GetModFiles returns the available download files for a mod
func (*CurseForge) IsAuthenticated ¶
func (c *CurseForge) IsAuthenticated() bool
IsAuthenticated returns true if an API key is configured
func (*CurseForge) Search ¶
func (c *CurseForge) Search(ctx context.Context, query source.SearchQuery) ([]domain.Mod, error)
Search finds mods matching the query. gameID can be either a numeric CurseForge game ID (e.g., "432") or a slug (e.g., "minecraft").
func (*CurseForge) SetAPIKey ¶
func (c *CurseForge) SetAPIKey(key string)
SetAPIKey sets the API key for authentication
type File ¶
type File struct {
ID int `json:"id"`
GameID int `json:"gameId"`
ModID int `json:"modId"`
IsAvailable bool `json:"isAvailable"`
DisplayName string `json:"displayName"`
FileName string `json:"fileName"`
ReleaseType int `json:"releaseType"` // 1=Release, 2=Beta, 3=Alpha
FileStatus int `json:"fileStatus"`
Hashes []FileHash `json:"hashes"`
FileDate time.Time `json:"fileDate"`
FileLength int64 `json:"fileLength"`
DownloadCount int64 `json:"downloadCount"`
DownloadURL string `json:"downloadUrl"`
GameVersions []string `json:"gameVersions"`
SortableGameVersions []SortableGameVersion `json:"sortableGameVersions"`
Dependencies []FileDependency `json:"dependencies"`
AlternateFileID int `json:"alternateFileId"`
IsServerPack bool `json:"isServerPack"`
FileFingerprint int64 `json:"fileFingerprint"`
Modules []FileModule `json:"modules"`
}
File represents a downloadable mod file
type FileDependency ¶
type FileDependency struct {
ModID int `json:"modId"`
RelationType int `json:"relationType"` // 1=EmbeddedLibrary, 2=OptionalDependency, 3=RequiredDependency, 4=Tool, 5=Incompatible, 6=Include
}
FileDependency represents a file's dependency on another mod
type FileIndex ¶
type FileIndex struct {
GameVersion string `json:"gameVersion"`
FileID int `json:"fileId"`
Filename string `json:"filename"`
ReleaseType int `json:"releaseType"`
GameVersionTypeID int `json:"gameVersionTypeId"`
ModLoader int `json:"modLoader"` // 0=Any, 1=Forge, 2=Cauldron, 3=LiteLoader, 4=Fabric, 5=Quilt, 6=NeoForge
}
FileIndex contains file index info for latest files
type FileModule ¶
FileModule represents a module within a mod file
type Game ¶
type Game struct {
ID int `json:"id"`
Name string `json:"name"`
Slug string `json:"slug"`
DateModified time.Time `json:"dateModified"`
Assets GameAssets `json:"assets"`
Status int `json:"status"`
APIStatus int `json:"apiStatus"`
}
Game represents a game from the CurseForge API
type GameAssets ¶
type GameAssets struct {
IconURL string `json:"iconUrl"`
TileURL string `json:"tileUrl"`
CoverURL string `json:"coverUrl"`
}
GameAssets contains image assets for a game
type Mod ¶
type Mod struct {
ID int `json:"id"`
GameID int `json:"gameId"`
Name string `json:"name"`
Slug string `json:"slug"`
Links ModLinks `json:"links"`
Summary string `json:"summary"`
Status int `json:"status"`
DownloadCount int64 `json:"downloadCount"`
IsFeatured bool `json:"isFeatured"`
PrimaryCategoryID int `json:"primaryCategoryId"`
Categories []Category `json:"categories"`
ClassID int `json:"classId"`
Authors []Author `json:"authors"`
Logo *ModAsset `json:"logo"`
Screenshots []ModAsset `json:"screenshots"`
MainFileID int `json:"mainFileId"`
LatestFiles []File `json:"latestFiles"`
LatestFilesIndexes []FileIndex `json:"latestFilesIndexes"`
DateCreated time.Time `json:"dateCreated"`
DateModified time.Time `json:"dateModified"`
DateReleased time.Time `json:"dateReleased"`
AllowModDistribution *bool `json:"allowModDistribution"`
GamePopularityRank int `json:"gamePopularityRank"`
IsAvailable bool `json:"isAvailable"`
ThumbsUpCount int `json:"thumbsUpCount"`
}
Mod represents a mod from the CurseForge API
type ModAsset ¶
type ModAsset struct {
ID int `json:"id"`
ModID int `json:"modId"`
Title string `json:"title"`
Description string `json:"description"`
ThumbnailURL string `json:"thumbnailUrl"`
URL string `json:"url"`
}
ModAsset represents an image asset (logo, screenshot)
type ModLinks ¶
type ModLinks struct {
WebsiteURL string `json:"websiteUrl"`
WikiURL string `json:"wikiUrl"`
IssuesURL string `json:"issuesUrl"`
SourceURL string `json:"sourceUrl"`
}
ModLinks contains URLs associated with a mod
type PaginatedResponse ¶
type PaginatedResponse[T any] struct { Data T `json:"data"` Pagination Pagination `json:"pagination"` }
PaginatedResponse wraps paginated CurseForge API responses
type Pagination ¶
type Pagination struct {
Index int `json:"index"`
PageSize int `json:"pageSize"`
ResultCount int `json:"resultCount"`
TotalCount int `json:"totalCount"`
}
Pagination contains pagination info from CurseForge API
type SortableGameVersion ¶
type SortableGameVersion struct {
GameVersionName string `json:"gameVersionName"`
GameVersionPadded string `json:"gameVersionPadded"`
GameVersion string `json:"gameVersion"`
GameVersionReleaseDate time.Time `json:"gameVersionReleaseDate"`
GameVersionTypeID int `json:"gameVersionTypeId"`
}
SortableGameVersion contains structured version info
type StringDownloadURL ¶
type StringDownloadURL struct {
Data string `json:"data"`
}
StringDownloadURL is the response for the download URL endpoint