All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.io.ipfs.kotlin.commands.Pins.kt Maven / Gradle / Ivy

There is a newer version: 1.0.0-rc
Show newest version
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