cursekt-js

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

Лицензия

Лицензия

Категории

Категории

JavaScript Языки программирования Сеть
Группа

Группа

net.pearx.cursekt
Идентификатор

Идентификатор

cursekt-js
Последняя версия

Последняя версия

0.1.2
Дата

Дата

Тип

Тип

module
Описание

Описание

cursekt-js
Multiplatform Kotlin library to work with the Curse (CurseForge) API using Ktor.
Ссылка на сайт

Ссылка на сайт

https://github.com/pearxteam/cursekt
Организация-разработчик

Организация-разработчик

PearX Team
Система контроля версий

Система контроля версий

https://github.com/pearxteam/cursekt

Скачать cursekt-js

Зависимости

runtime (8)

Идентификатор библиотеки Тип Версия
org.jetbrains.kotlin : kotlin-stdlib-js jar 1.3.71
io.ktor : ktor-client-serialization-js jar 1.3.2
io.ktor : ktor-client-json-js jar 1.3.2
io.ktor : ktor-client-js jar 1.3.2
org.jetbrains.kotlin : kotlin-stdlib-common jar 1.3.71
io.ktor : ktor-client-serialization jar 1.3.2
io.ktor : ktor-client-json jar 1.3.2
io.ktor : ktor-client-core jar 1.3.2

Модули Проекта

Данный проект не имеет модулей.

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

Версии библиотеки

Версия
0.1.2
0.1.0