File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 1- using Ipfs . CoreApi ;
1+ using Google . Protobuf ;
2+ using Ipfs . CoreApi ;
23using Newtonsoft . Json . Linq ;
34using System . Collections . Generic ;
45using System . Linq ;
@@ -33,6 +34,18 @@ internal PinApi(IpfsClient ipfs)
3334 . Select ( p => ( Cid ) p . Name ) ;
3435 }
3536
37+ public async Task < IEnumerable < Cid > > ListAsync ( PinType type , CancellationToken cancel = default ( CancellationToken ) )
38+ {
39+ var typeOpt = type . ToString ( ) . ToLowerInvariant ( ) ;
40+ var json = await ipfs . DoCommandAsync ( "pin/ls" , cancel ,
41+ null ,
42+ $ "type={ typeOpt } ") ;
43+ var keys = ( JObject ) ( JObject . Parse ( json ) [ "Keys" ] ) ;
44+ return keys
45+ . Properties ( )
46+ . Select ( p => ( Cid ) p . Name ) ;
47+ }
48+
3649 public async Task < IEnumerable < Cid > > RemoveAsync ( Cid id , bool recursive = true , CancellationToken cancel = default ( CancellationToken ) )
3750 {
3851 var opts = "recursive=" + recursive . ToString ( ) . ToLowerInvariant ( ) ;
You can’t perform that action at this time.
0 commit comments