Ejemplo n.º 1
0
        /// <summary>
        ///   Gets a raw <see cref="Block">IPFS block</see>.
        /// </summary>
        /// <param name="cancel">
        ///   Is used to stop the task.  When cancelled, the <see cref="TaskCanceledException"/> is raised.
        /// </param>
        /// <param name="hash">
        ///   The <see cref="string"/> representation of a base58 encoded <see cref="Ipfs.MultiHash"/>.
        /// </param>
        public async Task <Block> GetAsync(string hash, CancellationToken cancel = default(CancellationToken)) // TODO CID support
        {
            var data = await ipfs.DownloadBytesAsync("block/get", cancel, hash);

            return(new Block
            {
                DataBytes = data,
                Hash = hash
            });
        }
Ejemplo n.º 2
0
        public async Task <IDataBlock> GetAsync(Cid id, CancellationToken cancel = default(CancellationToken)) // TODO CID support
        {
            var data = await ipfs.DownloadBytesAsync("block/get", cancel, id);

            return(new Block
            {
                DataBytes = data,
                Id = id
            });
        }
Ejemplo n.º 3
0
        /// <summary>
        ///   Gets a raw <see cref="Block">IPFS block</see>.
        /// </summary>
        /// <param name="hash">
        ///   The <see cref="string"/> representation of a base58 encoded <see cref="Ipfs.MultiHash"/>.
        /// </param>
        public async Task <Block> GetAsync(string hash) // TODO CID support
        {
            var data = await ipfs.DownloadBytesAsync("block/get", hash);

            return(new Block
            {
                DataBytes = data,
                Hash = hash
            });
        }