gistcafe

gist.cafe utils for Kotlin

License

License

Categories

Categories

Net
GroupId

GroupId

net.servicestack
ArtifactId

ArtifactId

gistcafe
Last Version

Last Version

0.0.7
Release Date

Release Date

Type

Type

jar
Description

Description

gistcafe
gist.cafe utils for Kotlin
Project URL

Project URL

https://github.com/maven
Source Code Management

Source Code Management

https://github.com/ServiceStack/gistcafe-kotlin

Download gistcafe

How to add to project

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

Dependencies

runtime (2)

Group / Artifact Type Version
org.jetbrains.kotlin : kotlin-stdlib jar 1.4.21
com.google.code.gson : gson jar 2.8.6

test (2)

Group / Artifact Type Version
org.junit : junit-bom jar 5.7.0
org.junit.jupiter : junit-jupiter jar

Project Modules

There are no modules declared in this project.

Useful utils for gist.cafe Kotlin Apps.

Usage

Simple usage example:

import com.google.gson.Gson
import com.google.gson.annotations.SerializedName
import java.net.URL
import net.servicestack.gistcafe.*

data class GithubRepo(
    val name: String,
    val description: String = "",
    val homepage: String = "",
    @SerializedName("language") val lang: String = "",
    val watchers: Int,
    val forks: Int)

fun main(args: Array<String>) {
    val orgName = "Kotlin"

    val json = URL("https://api.github.com/orgs/$orgName/repos").readText()
    val orgRepos = Gson().fromJson<List<GithubRepo>>(json)
        .sortedByDescending { it.watchers }

    println("Top 3 $orgName GitHub Repos:")
    Inspect.printDump(orgRepos.take(3))

    println("\nTop 10 $orgName GitHub Repos:")
    Inspect.printDumpTable(orgRepos.take(10), listOf("name","language","watchers","forks"))

    Inspect.vars(mapOf("orgRepos" to orgRepos))
}

Which outputs:

Top 3 Kotlin GitHub Repos:
[
  {
    name: anko,
    description: Pleasant Android application development,
    homepage: ,
    language: Kotlin,
    watchers: 15892,
    forks: 1281
  },
  {
    name: kotlinx.coroutines,
    description: Library support for Kotlin coroutines ,
    homepage: ,
    language: Kotlin,
    watchers: 8684,
    forks: 1228
  },
  {
    name: kotlin-examples,
    description: Various examples for Kotlin,
    language: Kotlin,
    watchers: 2892,
    forks: 1056
  }
]

Top 10 Kotlin GitHub Repos:
+--------------------------------------------------------+
|          name           | language | watchers | forks  |
|--------------------------------------------------------|
| anko                    | Kotlin   |    15892 |   1281 |
| kotlinx.coroutines      | Kotlin   |     8684 |   1228 |
| kotlin-examples         | Kotlin   |     2892 |   1056 |
| kotlinx.serialization   | Kotlin   |     2697 |    287 |
| kotlin-koans            | Kotlin   |     2559 |   1504 |
| KEEP                    |          |     1953 |    215 |
| dokka                   | Kotlin   |     1839 |    194 |
| coroutines-examples     |          |     1259 |    149 |
| kotlin-fullstack-sample | Kotlin   |     1185 |    165 |
| kotlinx.html            | Kotlin   |     1074 |     97 |
+--------------------------------------------------------+

Features and bugs

Please file feature requests and bugs at the issue tracker.

net.servicestack

ServiceStack

Versions

Version
0.0.7
0.0.6
0.0.5
0.0.4
0.0.2