Created
September 15, 2022 20:58
-
-
Save s1monw1/053b6fb8b36854f6b501808a4f758a5a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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