Skip to content

GradientTim/ungh-kt

Repository files navigation

ungh-kt

Unofficial Kotlin driver for the unjs/ungh api

kotlin license version

Installation

Gradle (Kotlin)

dependencies {
    implementation("dev.gradienttim", "ungh-kt", "VERSION")
}

Gradle (Groovy)

dependencies {
    implementation "dev.gradienttim:ungh-kt:VERSION"
}

Maven

<dependencies>
    <dependency>
        <groupId>dev.gradienttim</groupId>
        <artifactId>ungh-kt</artifactId>
        <version>VERSION</version>
    </dependency>
</dependencies>

Example usages

These are just a few examples of how to use the library.
In the Ungh class you will find more functions to use all the features provided by the unjs/ungh api

Repository

val repository = Ungh.repository("unjs", "ungh")
if (repository == null) {
    println("unjs/ungh repository not found :/")
}

Organization

val organization = Ungh.organization("unjs")
organization?.let {
    println("Organization description: ${it.description}")
}

Stars

// val stars = Ungh.stars("GradientTim/ungh-kt") // single repo
val stars = Ungh.stars(listOf(
    "unjs/ungh",
    "Jetbrains/Kotlin",
    "GradientTim/ungh-kt",
))
stars?.let {
    println("Total stars: ${it.totalStars}")
    it.stars.forEach { (key, value) ->
        println("$key has $value stars")
    }
}

Users

val user = Ungh.user("GradientTim")
user?.let {
    println("Did you know that his name is ${it.name}?")
}

License

This project is licensed under the MIT license