Show / Hide Table of Contents

Interface IDagApi

Manages the IPLD (linked data) Directed Acrylic Graph.

Namespace: Ipfs.CoreApi
Assembly: Ipfs.Core.dll
Syntax
public interface IDagApi
Remarks

The DAG API is a replacement of the IObjectApi, which only supported 'dag-pb'. This API supports other IPLD formats, such as cbor, ethereum-block, git, ...

Methods

| Improve this Doc View Source

GetAsync(Cid, CancellationToken)

Get an IPLD node.

Declaration
Task<JObject> GetAsync(Cid id, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
Cid id

The Cid of the IPLD node.

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task<Newtonsoft.Json.Linq.JObject>

A task that represents the asynchronous get operation. The task's value contains the node's content as JSON.

| Improve this Doc View Source

GetAsync(String, CancellationToken)

Gets the content of an IPLD node.

Declaration
Task<JToken> GetAsync(string path, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
String path

A path, such as "cid", "/ipfs/cid/" or "cid/a".

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task<Newtonsoft.Json.Linq.JToken>

A task that represents the asynchronous get operation. The task's value contains the path's value.

| Improve this Doc View Source

GetAsync<T>(Cid, CancellationToken)

Get an IPLD node of the specific type.

Declaration
Task<T> GetAsync<T>(Cid id, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
Cid id

The Cid of the IPLD node.

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task<T>

A task that represents the asynchronous get operation. The task's value is a new instance of the T class.

Type Parameters
Name Description
T

The object's type.

| Improve this Doc View Source

PutAsync(JObject, String, String, String, Boolean, CancellationToken)

Put JSON data as an IPLD node.

Declaration
Task<Cid> PutAsync(JObject data, string contentType = "dag-cbor", string multiHash = "sha2-256", string encoding = "base58btc", bool pin = true, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
Newtonsoft.Json.Linq.JObject data

The JSON data to send to the network.

String contentType

The content type or format of the data; such as "dag-pb" or "dag-cbor". See MultiCodec for more details. Defaults to "dag-cbor".

String multiHash

The MultiHash algorithm name used to produce the Cid.

String encoding

The MultiBase algorithm name used to produce the Cid.

Boolean pin

If true the data is pinned to local storage and will not be garbage collected. The default is true.

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task<Cid>

A task that represents the asynchronous put operation. The task's value is the data's Cid.

| Improve this Doc View Source

PutAsync(Stream, String, String, String, Boolean, CancellationToken)

Put a stream of JSON as an IPLD node.

Declaration
Task<Cid> PutAsync(Stream data, string contentType = "dag-cbor", string multiHash = "sha2-256", string encoding = "base58btc", bool pin = true, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
Stream data

The stream of JSON.

String contentType

The content type or format of the data; such as "dag-pb" or "dag-cbor". See MultiCodec for more details. Defaults to "dag-cbor".

String multiHash

The MultiHash algorithm name used to produce the Cid.

String encoding

The MultiBase algorithm name used to produce the Cid.

Boolean pin

If true the data is pinned to local storage and will not be garbage collected. The default is true.

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task<Cid>

A task that represents the asynchronous put operation. The task's value is the data's Cid.

| Improve this Doc View Source

PutAsync(Object, String, String, String, Boolean, CancellationToken)

Put an object as an IPLD node.

Declaration
Task<Cid> PutAsync(object data, string contentType = "dag-cbor", string multiHash = "sha2-256", string encoding = "base58btc", bool pin = true, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
Object data

The object to add.

String contentType

The content type or format of the data; such as "dag-pb" or "dag-cbor". See MultiCodec for more details. Defaults to "dag-cbor".

String multiHash

The MultiHash algorithm name used to produce the Cid.

String encoding

The MultiBase algorithm name used to produce the Cid.

Boolean pin

If true the data is pinned to local storage and will not be garbage collected. The default is true.

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task<Cid>

A task that represents the asynchronous put operation. The task's value is the data's Cid.

See Also

IObjectApi
ILinkedNode
Dag API spec
  • Improve this Doc
  • View Source
Back to top Generated by DocFX