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 SourceGetAsync(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. |
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. |
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 |
Type Parameters
Name | Description |
---|---|
T | The object's type. |
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 |
String | multiHash | |
String | encoding | |
Boolean | pin | If true the |
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. |
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 |
String | multiHash | |
String | encoding | |
Boolean | pin | If true the |
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. |
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 |
String | multiHash | |
String | encoding | |
Boolean | pin | If true the |
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. |