commonMain.io.ipfs.kotlin.commands.Pins.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ipfs-api Show documentation
Show all versions of ipfs-api Show documentation
IPFS API for kotlin to access a IPFS node via http
package io.ipfs.kotlin.commands
import io.ipfs.kotlin.IPFSConnection
import io.ktor.client.statement.*
class Pins(val ipfs: IPFSConnection) {
suspend fun add(hash: String): Boolean {
val resultString = ipfs.callCmd("pin/add/$hash").let { it.bodyAsText() }
val resultBoolean = resultString.contains(hash)
if (!resultBoolean) {
ipfs.setErrorByJSON(resultString)
}
return resultBoolean
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy