Skip to content

Instantly share code, notes, and snippets.

@s1monw1
Created September 15, 2022 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s1monw1/053b6fb8b36854f6b501808a4f758a5a to your computer and use it in GitHub Desktop.
Save s1monw1/053b6fb8b36854f6b501808a4f758a5a to your computer and use it in GitHub Desktop.
private fun requestContributor(name: String): Contributor {
val contributors =
with(client) {
val response =
Request.Builder().url(ENDPOINT).build().let { newCall(it).execute() }
val responseAsString = response.use {
it.body()?.source()?.readByteArray()?.let { String(it) }
?: throw IllegalStateException("No response from server!")
}
responseAsString.let {
LOG.debug("response from git api: $it\n")
mapper.readValue(it)
}
}
return contributors.first { it.login == name }.also {
cachedLeadResults[name] = it
LOG.debug("found kotlin contributor: $it")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment