Skip to content

Commit

Permalink
fix(DagApi): use JObject as linked data
Browse files Browse the repository at this point in the history
  • Loading branch information
richardschneider committed May 13, 2018
1 parent 02ad8f0 commit 10d8d91
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions src/CoreApi/IDagApi.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
Expand All @@ -7,11 +8,11 @@
namespace Ipfs.CoreApi
{
/// <summary>
/// Manages the IPLD Directed Acrylic Graph.
/// Manages the IPLD (linked data) Directed Acrylic Graph.
/// </summary>
/// <remarks>
/// The dag API is a replacement of the <see cref="IObjectApi"/>, which only supported 'dag-pb'.
/// This API supports other IPLD formats, such as dag-cbor, ethereum-block, git, ...
/// The DAG API is a replacement of the <see cref="IObjectApi"/>, which only supported 'dag-pb'.
/// This API supports other IPLD formats, such as cbor, ethereum-block, git, ...
/// </remarks>
/// <seealso cref="IObjectApi"/>
/// <seealso cref="ILinkedNode"/>
Expand All @@ -22,11 +23,11 @@ public interface IDagApi
/// Put an IPLD node.
/// </summary>
/// <param name="data">
/// The data to send to the network.
/// The JSON data to send to the network.
/// </param>
/// <param name="contentType">
/// The content type or format of the <paramref name="data"/>; such as "raw" or "dag-db".
/// See <see cref="MultiCodec"/> for more details.
/// The content type or format of the <paramref name="data"/>; such as "raw" or "cbor".
/// See <see cref="MultiCodec"/> for more details. Defaults to "cbor".
/// </param>
/// <param name="multiHash">
/// The <see cref="MultiHash"/> algorithm name used to produce the <see cref="Cid"/>.
Expand All @@ -35,28 +36,28 @@ public interface IDagApi
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
/// </param>
/// <returns>
/// A task that represents the asynchronous put operation. The task's value is
/// the data's <see cref="Cid"/>.
/// A task that represents the asynchronous put operation. The task's value is
/// the data's <see cref="Cid"/>.
/// </returns>
Task<Cid> PutAsync(
ILinkedNode data,
string contentType,
JObject data,
string contentType = "cbor",
string multiHash = MultiHash.DefaultAlgorithmName,
CancellationToken cancel = default(CancellationToken));

/// <summary>
/// Get an IPLD node.
/// </summary>
/// <param name="path">
/// The CID or path to an IPLD node.
/// </param>
/// <param name="id">
/// The <see cref="Cid"/> of the IPLD node.
/// </param>
/// <param name="cancel">
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
/// </param>
/// <returns>
/// A task that represents the asynchronous get operation. The task's value
/// contains the node's content.
/// contains the node's content as JSON.
/// </returns>
Task<ILinkedNode> GetAsync(string path, CancellationToken cancel = default(CancellationToken));
Task<JObject> GetAsync(Cid id, CancellationToken cancel = default(CancellationToken));
}
}

1 comment on commit 10d8d91

@richardschneider
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #41

Please sign in to comment.