/// <summary> /// Get and serialize the DAG node named by <key> /// 'ipfs object get' is a plumbing command for retreiving DAG nodes. /// It serializes the DAG node to the format specified by the "--encoding" /// flag.It outputs to stdout, and <key> is a base58 encoded multihash. /// </summary> /// <param name="key">Key of the object to retrieve (in base58-encoded multihash format)</param> /// <param name="encoding">The encoding of the data</param> /// <returns></returns> public async Task <HttpContent> Get(string key, IpfsEncoding encoding) { var flags = new Dictionary <string, string>(); flags.Add("encoding", GetIpfsEncodingValue(encoding)); return(await ExecuteGetAsync("get", key, flags)); }
/// <summary> /// Get and serialize the DAG node named by <key> /// 'ipfs object get' is a plumbing command for retreiving DAG nodes. /// It serializes the DAG node to the format specified by the "--encoding" /// flag.It outputs to stdout, and <key> is a base58 encoded multihash. /// </summary> /// <param name="key">Key of the object to retrieve (in base58-encoded multihash format)</param> /// <param name="encoding">The encoding of the data</param> /// <returns></returns> public async Task<HttpContent> Get(string key, IpfsEncoding encoding) { var flags = new Dictionary<string, string>(); flags.Add("encoding", GetIpfsEncodingValue(encoding)); return await ExecuteGetAsync("get", key, flags); }
private string GetIpfsEncodingValue(IpfsEncoding encoding) { switch (encoding) { case IpfsEncoding.Json: return("json"); case IpfsEncoding.Protobuf: return("protobuf"); case IpfsEncoding.Base64: return("base64"); default: return(null); } }
private string GetIpfsEncodingValue(IpfsEncoding encoding) { switch (encoding) { case IpfsEncoding.Json: return "json"; case IpfsEncoding.Protobuf: return "protobuf"; case IpfsEncoding.Base64: return "base64"; default: return null; } }