Skip to content

Instantly share code, notes, and snippets.

@barinek
Created February 26, 2018 03:08
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 barinek/612fd056b0259bbe8ded3674c1fd11e3 to your computer and use it in GitHub Desktop.
Save barinek/612fd056b0259bbe8ded3674c1fd11e3 to your computer and use it in GitHub Desktop.
open class ProjectClient(val mapper: ObjectMapper, val template: RestTemplate) {
open fun getProject(projectId: Long): ProjectInfo? {
val endpoint = System.getenv("REGISTRATION_SERVER_ENDPOINT")
val response = template.get("$endpoint/project", "application/vnd.appcontinuum.v2+json", BasicNameValuePair("projectId", projectId.toString()))
when {
response.isBlank() -> return null
else -> return mapper.readValue(response, ProjectInfo::class.java)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment