Skip to content

Commit 3d9db3b

Browse files
committed
add items to diag api
1 parent 4ec3c7b commit 3d9db3b

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -707,12 +707,20 @@ public Map stat(Cid cid) throws IOException {
707707
}
708708

709709
public class Diag {
710-
public String cmds() throws IOException {
711-
return new String(retrieve("diag/cmds?stream-channels=true"));
710+
public List<Map> cmds() throws IOException {
711+
return (List)retrieveAndParse("diag/cmds");
712712
}
713713

714-
public String sys() throws IOException {
715-
return new String(retrieve("diag/sys?stream-channels=true"));
714+
public List<Map> cmds(boolean verbose) throws IOException {
715+
return (List)retrieveAndParse("diag/cmds?verbose=" + verbose);
716+
}
717+
718+
public String clearCmds() throws IOException {
719+
return retrieveString("diag/cmds/clear");
720+
}
721+
722+
public Map sys() throws IOException {
723+
return retrieveMap("diag/sys?stream-channels=true");
716724
}
717725
}
718726

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -763,9 +763,10 @@ public void diagTest() throws IOException {
763763
Map setResult = ipfs.config.set("Datastore.GCPeriod", val);
764764
ipfs.config.replace(new NamedStreamable.ByteArrayWrapper(JSONParser.toString(config).getBytes()));
765765
// Object log = ipfs.log();
766-
String sys = ipfs.diag.sys();
767-
String cmds = ipfs.diag.cmds();
768-
766+
Map sys = ipfs.diag.sys();
767+
List<Map> cmds = ipfs.diag.cmds(true);
768+
String res = ipfs.diag.clearCmds();
769+
List<Map> cmds2 = ipfs.diag.cmds(true);
769770
//String profile = "default";
770771
//ipfs.config.profileApply(profile, true);
771772
//Map entry = ipfs.config("Addresses.API", Optional.of("/ip4/127.0.0.1/tcp/5001"), Optional.empty());

0 commit comments

Comments
 (0)