Kraken
A Java/Kotlin wrapper for the Metron API.
Installation
Add Kraken as a dependency.
repositories {
maven("https://codeberg.org/api/packages/buriedincode/maven")
}
dependencies {
implementation("duckpond.buriedincode:Kraken:<version>")
}Content copied to clipboard
Example Usage
import duckpond.buriedincode.Metron
import duckpond.buriedincode.cache.SQLiteCache
import duckpond.buriedincode.exceptions.AuthenticationException
import duckpond.buriedincode.exceptions.RateLimitException
import duckpond.buriedincode.exceptions.ServiceException
import java.nio.file.Paths
fun main() {
try {
val cache = SQLiteCache(path = Paths.get("cache.sqlite"))
val session = Metron(username = "Username", password = "Password", cache = cache)
// Get all Marvel comics for the week of 2021-06-07
val thisWeek = session.listIssues(params = mapOf(
"store_date_range_after" to "2021-06-07",
"store_date_range_before" to "2021-06-13",
"publisher_name" to "marvel"
))
// Print the results
thisWeek.forEach {
println("${it.id} ${it.name}")
}
// Retrieve the detail for an individual issue
val asm68 = session.getIssue(id = 31660)
// Print the issue Description
println(asm68.description)
} catch (ae: AuthenticationException) {
println("Invalid Metron Username/Password.")
} catch(re: RatelimitException) {
println("Rate limit exceeded. Please try again later.")
} catch (se: ServiceException) {
println("Unsuccessful request: ${se.message}")
}
}Content copied to clipboard
Documentation
Bugs/Requests
Please use the Issue Tracker to submit bugs or request features.