Skip to content

Commit

Permalink
[ML4SE-168] Fixed PR comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikrise2 authored and nbirillo committed Dec 7, 2023
1 parent 97ddda8 commit 3dbe491
Showing 1 changed file with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ object IdRequests {
try {
return@runBlocking client.submitForm(
url = url,
formParameters = parameters {
append("name", name)
append("email", email)
}
formParameters = mapOf(
"name" to name,
"email" to email
).buildParameters()
).body<Int>()
} catch (e: Exception) {
logger.warn("Server interaction error while getting user id! Url: $url", e)
Expand All @@ -43,17 +43,23 @@ object IdRequests {
requireNotNull(GlobalPluginStorage.userId) { "User id is not defined" }
return@runBlocking client.submitForm(
url = url,
formParameters = parameters {
append("name", pluginInfoConfig.pluginName)
append("description", pluginInfoConfig.pluginDescription)
append("user_id", GlobalPluginStorage.userId.toString())
}
formParameters = mapOf(
"name" to pluginInfoConfig.pluginName,
"description" to pluginInfoConfig.pluginDescription,
"user_id" to GlobalPluginStorage.userId.toString()
).buildParameters()
).body<Int>()
} catch (e: IllegalArgumentException) {
logger.warn(e.localizedMessage)
} catch (e: Exception) {
logger.warn("Server interaction error while getting user id! Url: $url", e)
logger.warn("Server interaction error while getting research id! Url: $url", e)
}
return@runBlocking null
}

private fun Map<String, String>.buildParameters() = parameters {
this@buildParameters.forEach { (name, param) ->
append(name, param)
}
}
}

0 comments on commit 3dbe491

Please sign in to comment.