cursekt

Multiplatform Kotlin library to work with the Curse (CurseForge) API using Ktor.

License

License

Categories

Categories

Net
GroupId

GroupId

net.pearx.cursekt
ArtifactId

ArtifactId

cursekt
Last Version

Last Version

0.1.2
Release Date

Release Date

Type

Type

pom
Description

Description

cursekt
Multiplatform Kotlin library to work with the Curse (CurseForge) API using Ktor.
Project URL

Project URL

https://github.com/pearxteam/cursekt
Project Organization

Project Organization

PearX Team
Source Code Management

Source Code Management

https://github.com/pearxteam/cursekt

Download cursekt

How to add to project

<!-- https://jarcasting.com/artifacts/net.pearx.cursekt/cursekt/ -->
<dependency>
    <groupId>net.pearx.cursekt</groupId>
    <artifactId>cursekt</artifactId>
    <version>0.1.2</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/net.pearx.cursekt/cursekt/
implementation 'net.pearx.cursekt:cursekt:0.1.2'
// https://jarcasting.com/artifacts/net.pearx.cursekt/cursekt/
implementation ("net.pearx.cursekt:cursekt:0.1.2")
'net.pearx.cursekt:cursekt:pom:0.1.2'
<dependency org="net.pearx.cursekt" name="cursekt" rev="0.1.2">
  <artifact name="cursekt" type="pom" />
</dependency>
@Grapes(
@Grab(group='net.pearx.cursekt', module='cursekt', version='0.1.2')
)
libraryDependencies += "net.pearx.cursekt" % "cursekt" % "0.1.2"
[net.pearx.cursekt/cursekt "0.1.2"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

CurseKT Maven Central Maven Central Maven Central

License Discord Release Build Status Develop Build Status

Multiplatform Kotlin library to work with the Curse (CurseForge) API using Ktor.

Setup

  1. Add the lib to your project's dependencies by copying one of the following lines depending on the platform:
  • Groovy (replace $cursekt_version with the version you want):
 implementation "net.pearx.cursekt:cursekt-metadata:$cursekt_version" // for Common
 // or
 implementation "net.pearx.cursekt:cursekt-jvm:$cursekt_version" // for JVM
 // or
 implementation "net.pearx.cursekt:cursekt-js:$cursekt_version" // for JS
  • Kotlin (replace $cursektVersion with the version you want):
 implementation("net.pearx.cursekt:cursekt-metadata:$cursektVersion") // for Common
 // or
 implementation("net.pearx.cursekt:cursekt-jvm:$cursektVersion") // for JVM
 // or
 implementation("net.pearx.cursekt:cursekt-js:$cursektVersion") // for JS
  1. CurseKT uses coroutines! Ensure you've added kotlinx.coroutines as a dependency: https://github.com/Kotlin/kotlinx.coroutines#using-in-your-projects.

  2. Don't forget to declare the JCenter Maven repository to your build script (required by Ktor):

repositories {
    jcenter()
}
  1. Use the library and have fun!

How to Use the Library

You can get a brief example of how to work with the library at the Example Application section. To get all the methods available in CurseKT, take a look at the CurseClient.kt file.

Example Application

This application will search for Minecraft 1.15.2 mods matching the "just enough items" filter, sort by download count and print them.

import kotlinx.coroutines.runBlocking
import net.pearx.cursekt.client.CurseClient

fun main() {
    runBlocking {
        val curse = CurseClient() // create a new CurseClient instance
        val minecraftGame = curse.getGames(supportsAddons = true).first { it.slug == "minecraft" } // get Minecraft game
        val modsSection = minecraftGame.categorySections.first { it.name == "Mods" } // get Minecraft Mods section
        val addons = curse.searchAddons(gameId = minecraftGame.id, sectionId = modsSection.gameCategoryId, gameVersion = "1.15.2", searchFilter = "just enough items") // search for Minecraft 1.15.2 mods matching the "just enough items" filter
        val addonsSorted = addons.sortedByDescending { it.downloadCount } // sort search results by download count
        println(addonsSorted.joinToString(System.lineSeparator()) { "${it.name} - ${it.downloadCount.toInt()}" }) // print sorted search results
    }
}
net.pearx.cursekt

PearX Team

Versions

Version
0.1.2
0.1.0