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("codeberg.buriedincode:Kraken:0.5.0")
}Content copied to clipboard
Example Usage
import codeberg.buriedincode.kraken.Metron
import codeberg.buriedincode.kraken.SQLiteCache
import codeberg.buriedincode.kraken.AuthenticationException
import codeberg.buriedincode.kraken.RateLimitException
import codeberg.buriedincode.kraken.ServiceException
fun main() {
try {
val session = Metron(username="Username", password="Password", cache=SQLiteCache())
// 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.