1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
use crate::IpfsApi; use reqwest; use anyhow::Error; #[derive(Deserialize, Debug)] #[serde(rename_all="PascalCase")] pub struct IpfsVersion { version: String, commit: String, repo: String, system: String, golang: String } impl IpfsApi { /// Get the version from the IPFS daemon. pub async fn version(&self) -> Result<IpfsVersion, Error> { let url = format!("{}/api/v0/version", self.url); let resp = reqwest::get(&url).await?.json().await?; Ok(resp) } }