A Java library for handling interactions with CurseForge.
All public-facing code is documented with Javadoc and (mostly) tested with JUnit.
The methods found in CurseAPI can be used to retrieve information about projects and files.
CurseAPI#project(int)can be used to retrieve aCurseProjectinstance for a project ID. ThisCurseProjectinstance can then be used to retrieve information about a CurseForge project.CurseAPI#searchProjects(CurseSearchQuery)can be used with aCurseSearchQueryinstance to search for CurseForge projects.CurseAPI#files(int)andCurseProject#filescan be used to retrieve aCurseFilesinstance containing all files for a project.CurseFilesextendsTreeSetand contains a few utility methods forCurseFiles.CurseAPI#file(int, int)can be used to retrieve aCurseFileinstance for a project and file ID.CurseFiles#fileWithID(int)can be used instead if aCurseFilesinstance is already available.CurseAPI#fileDownloadURL(int, int)can be used to retrieve a download URL for a project and file ID. If aCurseFileis already available,CurseFile#downloadURL()can be used instead.CurseAPI#downloadFile(int, int, Path)andCurseAPI#downloadFileToDirectory(int, int, Path)can be used to download a file with a specific project and file ID. If aCurseFileis already available,CurseFile#download(Path)andCurseFile#downloadToDirectory(Path)can be used instead.CurseFilesinstances can be filtered usingCurseFileFilters:
final Optional<CurseFiles<CurseFile>> optionalFiles = CurseAPI.files(285612);
if (optionalFiles.isPresent()) {
final CurseFiles<CurseFile> files = optionalFiles.get();
new CurseFileFilter().gameVersionStrings("1.12.2").apply(files);
//Or:
//files.filter(new CurseFileFilter().gameVersionStrings("1.12.2"));
logger.info("Latest 1.12.2 file: {}", files.first());
}CurseAPI#games()can be used to retrieve aSetcontainingCurseGameinstances that represent all supported games on CurseForge.CurseAPI#streamGames()can be used to stream these games.CurseAPI#game(int)can be used to retrieve aCurseGameinstance that represents the CurseForge game with a specific ID.- If an extension such as CurseAPI-Minecraft
is installed,
CurseAPI#gameVersions(int)can be used to retrieveCurseGameVersioninstances representing versions of the specified game supported by CurseForge. CurseAPI#categories()andCurseAPI#categories(int)can be used to retrieve aSetofCurseCategoryinstances representing CurseForge project categories.CurseAPI#streamCategories()andCurseAPI#streamCategories(int)can be used to retrieve aStreamfor theseSets.CurseAPI#category(int)can be used to retrieve aCurseCategoryinstance representing the CurseForge project category with the specified ID.- In general,
nullvalues are not returned. Methods in theCurseAPIclass returnOptionals.
CurseAPI can be found on Jitpack:
repositories {
mavenCentral()
maven {
url "https://jitpack.io"
}
}
dependencies {
api "com.github.TheRandomLabs:CurseAPI:master-SNAPSHOT"
}CurseAPI uses SLF4J to log warnings, errors and information messages.