diff --git a/config/detekt/baseline.xml b/config/detekt/baseline.xml
index 8b70a46..840b4b1 100644
--- a/config/detekt/baseline.xml
+++ b/config/detekt/baseline.xml
@@ -3,7 +3,7 @@
LongParameterList:PinboardPoster.kt$PinboardPoster$( url: String, description: String, extended: String = "", tags: String = "", dt: String = "", replace: Boolean = true, shared: Boolean = true, toRead: Boolean = false )
- NestedBlockDepth:PinboardPoster.kt$PinboardPoster$private fun executeMethod(method: String, params: List<Pair<String, String>>): Boolean
+ NestedBlockDepth:PinboardPoster.kt$PinboardPoster$private fun executeMethod(method: String, params: Map<String, String>): Boolean
ThrowsCount:PinboardPoster.kt$PinboardPoster$@Throws(IOException::class) internal fun parseMethodResponse(method: String, response: String)
diff --git a/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt b/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt
index d309c73..0ba5610 100644
--- a/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt
+++ b/src/main/kotlin/net/thauvin/erik/pinboard/PinboardPoster.kt
@@ -167,15 +167,15 @@ open class PinboardPoster() {
} else if (description.isBlank()) {
logger.severe("Please specify a valid description to pin: `$url`")
} else {
- val params = listOf(
- Pair("url", url),
- Pair("description", description),
- Pair("extended", extended),
- Pair("tags", tags),
- Pair("dt", dt),
- Pair("replace", yesNo(replace)),
- Pair("shared", yesNo(shared)),
- Pair("toread", yesNo(toRead))
+ val params = mapOf(
+ "url" to url,
+ "description" to description,
+ "extended" to extended,
+ "tags" to tags,
+ "dt" to dt,
+ "replace" to yesNo(replace),
+ "shared" to yesNo(shared),
+ "toread" to yesNo(toRead)
)
return executeMethod("posts/add", params)
}
@@ -198,7 +198,7 @@ open class PinboardPoster() {
if (!validateUrl(url)) {
logger.severe("Please specify a valid URL to delete.")
} else {
- return executeMethod("posts/delete", listOf(Pair("url", url)))
+ return executeMethod("posts/delete", mapOf("url" to url))
}
}
@@ -244,13 +244,13 @@ open class PinboardPoster() {
}
}
- private fun executeMethod(method: String, params: List>): Boolean {
+ private fun executeMethod(method: String, params: Map): Boolean {
try {
val apiUrl = cleanEndPoint(method).toHttpUrlOrNull()
if (apiUrl != null) {
val httpUrl = apiUrl.newBuilder().apply {
params.forEach {
- addQueryParameter(it.first, it.second)
+ addQueryParameter(it.key, it.value)
}
addQueryParameter("auth_token", apiToken)
}.build()