curseforge

package module
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2024 License: MIT Imports: 3 Imported by: 0

README

Go Reference

go-curseforge

CurseForge API client for golang

Supported API

Mods
  • Search Mods
  • Get Mod
  • Get Mods
  • Get Featured Mods
  • Get Mod Description
Files
  • Get Mod File
  • Get Mod Files
  • Get Files
  • Get Mod File Changelog
  • Get Mod File Download URL
Minecraft
  • Get Minecraft Versions
  • Get Specific Minecraft Version
  • Get Minecraft ModLoaders
  • Get Specific Minecraft ModLoader
Games
  • Get Games
  • Get Game
  • Get Versions
  • Get Version Types
  • Get Versions V2
Categories
  • Get Categories
Fingerprints
  • Get Fingerprints Matches By Game Id
  • Get Fingerprints Matches
  • Get Fingerprints Fuzzy Matches By Game Id
  • Get Fingerprints Fuzzy Matches

Acknowledgements

This client library is developed totally in interest and for non-commercial usage, and may not be updated as frequently as the CurseForge API. If you find any inconsistent defines or error, please open an issue or a pull request.

Some ID types are intentionally leaved as enums since they may be useful while using the API(i.e. enum.GameID), but they are not documented in the official documentation. Currently I'm focusing on the APIs so there is only one GameID, which is 432 for Minecraft cause it's the only one I used. After I'm done with the API stuff I'll try to do some code generation for those enums. Also, any PRs are welcome.

Documentation

Overview

go-curseforge implements a full-typed client for the CurseForge API.

Example (GetLatestModFile)
cli := NewClient(apiKey)

rsp, err := cli.ModFiles(32274,
	cli.ModFiles.WithGameVersion("1.19.2"),
	cli.ModFiles.WithModLoader(enum.ModLoaderForge),
	cli.ModFiles.WithIndex(0),
	cli.ModFiles.WithPageSize(1),
)
if err != nil {
	panic(err)
}

fmt.Printf("FileName:    %s\nFileDate:    %s\nDownloadURL: %s\n",
	rsp.Data[0].FileName, rsp.Data[0].FileDate, rsp.Data[0].DownloadURL)
Output:

FileName:    journeymap-1.19.2-5.9.7-forge.jar
FileDate:    2023-05-11 15:42:02.777 +0000 UTC
DownloadURL: https://edge.forgecdn.net/files/4532/924/journeymap-1.19.2-5.9.7-forge.jar
Example (SearchMod)
cli := NewClient(apiKey)

rsp, err := cli.SearchMod(enum.MinecraftGameID,
	cli.SearchMod.WithGameVersion("1.19.2"),
	cli.SearchMod.WithModLoaderType(enum.ModLoaderForge),
	cli.SearchMod.WithSearchFilter("JourneyMap"),
	cli.SearchMod.WithSortField(enum.ModsSearchSortFieldPopularity),
	cli.SearchMod.WithSortOrder(enum.SortOrderDescending),
	cli.SearchMod.WithIndex(0),
	cli.SearchMod.WithPageSize(1),
)
if err != nil {
	panic(err)
}

fmt.Printf("ModID: %d\nName: %s\nSummary: %s\n",
	rsp.Data[0].ID, rsp.Data[0].Name, rsp.Data[0].Summary)
Output:

ModID: 32274
Name: JourneyMap
Summary: Real-time mapping in-game or your browser as you explore.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitDefault added in v0.5.1

func InitDefault(apiKey string)

Types

type Client

type Client struct {
	*api.API
}

func NewClient

func NewClient(apiKey string) *Client

Directories

Path Synopsis
api

Jump to

Keyboard shortcuts

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