client

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: GPL-3.0, LGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	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

type ApiQueryParams map[string]any

func (ApiQueryParams) QueryString

func (f ApiQueryParams) QueryString() string

type CfgFunc

type CfgFunc func(config *Config)

func EnableDebug

func EnableDebug(enabled bool) CfgFunc

func WithEndpoint

func WithEndpoint(endpoint string) CfgFunc

func WithLogger

func WithLogger(log Logger) CfgFunc

func WithTimeout

func WithTimeout(timeout time.Duration) CfgFunc

type Config

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

func NewConfig

func NewConfig(apiKey string, cfgs ...CfgFunc) *Config

func NewDefaultConfig

func NewDefaultConfig(apiKey string) *Config

func (*Config) IsDebug

func (cfg *Config) IsDebug() bool

func (*Config) NewGetRequest

func (cfg *Config) NewGetRequest(path string) (*http.Request, error)

func (*Config) NewHTTPClient

func (cfg *Config) NewHTTPClient() *http.Client

func (*Config) NewPostRequest

func (cfg *Config) NewPostRequest(path string, body any) (*http.Request, error)

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

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 GetModsByIdsListRequest struct {
	ModIds       []int64 `json:"modIds"`
	FilterPcOnly bool    `json:"filterPcOnly"`
}

type Logger

type Logger interface {
	Printf(format string, v ...any)
	Println(v ...any)
	DebugRequest(res *http.Response)
}

func NewDefaultSlogClientLogger

func NewDefaultSlogClientLogger(logger *slog.Logger) Logger

type MinecraftModLoadersQueryOption

type MinecraftModLoadersQueryOption ApiQueryOption

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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