Documentation
¶
Index ¶
- Constants
- type ApiQueryOption
- type ApiQueryParams
- type CfgFunc
- type Config
- type CurseClient
- type DefaultSlogClientLogger
- type GetModsByIdsListRequest
- type Logger
- type MinecraftModLoadersQueryOption
- type MinecraftVersionsQueryOption
- type ModsQueryOption
- func WithGameID(g string) ModsQueryOption
- func WithModsCategoryID(cid string) ModsQueryOption
- func WithModsCategoryIDs(cids string) ModsQueryOption
- func WithModsClassID(cid string) ModsQueryOption
- func WithModsGameID(id string) ModsQueryOption
- func WithModsGameVersion(gv string) ModsQueryOption
- func WithModsIndex(index int64) ModsQueryOption
- func WithModsModLoaderType(mlt int) ModsQueryOption
- func WithModsPageSize(pageSize int64) ModsQueryOption
- func WithModsSeatchFilter(q string) ModsQueryOption
- func WithModsSortField(field int) ModsQueryOption
- func WithModsSortOrder(order string) ModsQueryOption
Constants ¶
View Source
const (
// CurseforgeBaseURL default API base path
CurseforgeBaseURL = "https://api.curseforge.com"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiQueryOption ¶
type ApiQueryOption func(ApiQueryParams)
func PageIndex ¶
func PageIndex(index int64) ApiQueryOption
func PageSize ¶
func PageSize(size int64) ApiQueryOption
type ApiQueryParams ¶
func (ApiQueryParams) QueryString ¶
func (f ApiQueryParams) QueryString() string
type CfgFunc ¶
type CfgFunc func(config *Config)
CfgFunc is configuration function
func EnableDebug ¶
EnableDebug to define the API endpoint to be used
func WithEndpoint ¶
WithEndpoint to define the API endpoint to be used
func WithTimeout ¶
WithTimeout to define the API client timeout to be used
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is the client config data
func NewDefaultConfig ¶
NewDefaultConfig creates a new client Config with default values
func (*Config) NewGetRequest ¶
NewGetRequest creates a new GET request object to be used with client
func (*Config) NewHTTPClient ¶
NewHTTPClient creates a new HTTP client
type CurseClient ¶
type CurseClient interface {
GetGameVersions(ctx context.Context, gameID string) (versions *types.GameVersionsResponse, err error)
GetCategories(ctx context.Context, gameID string) (*types.GetCategoriesResponse, error)
GetMods(ctx context.Context, opts ...ModsQueryOption) (*types.ModsResponse, error)
GetModsByIDs(ctx context.Context, req *GetModsByIdsListRequest, opts ...ModsQueryOption) (*types.ModsResponse, error)
GetModDescription(ctx context.Context, modID int64) (*types.StringResponse, error)
GetModFiles(ctx context.Context, modID int64) (*types.GetModFilesResponse, error)
}
func NewCurseClient ¶
func NewCurseClient(apiKey string, opts ...CfgFunc) CurseClient
NewCurseClient creates a new Curseforge client
type DefaultSlogClientLogger ¶
type DefaultSlogClientLogger struct {
Logger
// contains filtered or unexported fields
}
func (DefaultSlogClientLogger) DebugRequest ¶
func (l DefaultSlogClientLogger) DebugRequest(res *http.Response)
func (DefaultSlogClientLogger) Printf ¶
func (l DefaultSlogClientLogger) Printf(format string, args ...any)
func (DefaultSlogClientLogger) Println ¶
func (l DefaultSlogClientLogger) Println(v ...any)
type GetModsByIdsListRequest ¶
type Logger ¶
type Logger interface {
Printf(format string, v ...any)
Println(v ...any)
DebugRequest(res *http.Response)
}
Logger is a logger definition to be used with client
func NewDefaultSlogClientLogger ¶
NewDefaultSlogClientLogger creates a default logger using log/slog
type MinecraftModLoadersQueryOption ¶
type MinecraftModLoadersQueryOption ApiQueryOption
func WithIncludeAll ¶
func WithIncludeAll(b bool) MinecraftModLoadersQueryOption
func WithMinecraftVersion ¶
func WithMinecraftVersion(version string) MinecraftModLoadersQueryOption
type MinecraftVersionsQueryOption ¶
type MinecraftVersionsQueryOption ApiQueryOption
func WithSortDescending ¶
func WithSortDescending(descending bool) MinecraftVersionsQueryOption
type ModsQueryOption ¶
type ModsQueryOption ApiQueryOption
func WithGameID ¶
func WithGameID(g string) ModsQueryOption
func WithModsCategoryID ¶
func WithModsCategoryID(cid string) ModsQueryOption
func WithModsCategoryIDs ¶
func WithModsCategoryIDs(cids string) ModsQueryOption
func WithModsClassID ¶
func WithModsClassID(cid string) ModsQueryOption
func WithModsGameID ¶
func WithModsGameID(id string) ModsQueryOption
func WithModsGameVersion ¶
func WithModsGameVersion(gv string) ModsQueryOption
func WithModsIndex ¶
func WithModsIndex(index int64) ModsQueryOption
func WithModsModLoaderType ¶
func WithModsModLoaderType(mlt int) ModsQueryOption
func WithModsPageSize ¶
func WithModsPageSize(pageSize int64) ModsQueryOption
func WithModsSeatchFilter ¶
func WithModsSeatchFilter(q string) ModsQueryOption
func WithModsSortField ¶
func WithModsSortField(field int) ModsQueryOption
func WithModsSortOrder ¶
func WithModsSortOrder(order string) ModsQueryOption
Click to show internal directories.
Click to hide internal directories.