Skip to content

Commit 4ec3c7b

Browse files
committed
add items to dag api
1 parent 75adf58 commit 4ec3c7b

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/main/java/io/ipfs/api/IPFS.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,14 @@ public MerkleNode put(String inputFormat, byte[] object, String outputFormat) th
696696
String res = m.finish();
697697
return MerkleNode.fromJSON(JSONParser.parse(res));
698698
}
699+
700+
public Map resolve(String path) throws IOException {
701+
return retrieveMap("dag/resolve?&arg=" + path);
702+
}
703+
704+
public Map stat(Cid cid) throws IOException {
705+
return retrieveMap("dag/stat?&arg=" + cid);
706+
}
699707
}
700708

701709
public class Diag {

src/test/java/io/ipfs/api/APITest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ public void dag() throws IOException {
3333

3434
byte[] get = ipfs.dag.get(expected);
3535
Assert.assertTrue("Raw data equal", original.equals(new String(get).trim()));
36+
Map res = ipfs.dag.resolve("bafyreidbm2zncsc3j25zn7lofgd4woeh6eygdy73thfosuni2rwr3bhcvu");
37+
Assert.assertTrue("not resolved", res != null);
38+
res = ipfs.dag.stat(expected);
39+
Assert.assertTrue("not found", res != null);
3640
}
3741

3842
@Test

0 commit comments

Comments
 (0)