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 ;
2
3
using Newtonsoft . Json . Linq ;
3
4
using System . Collections . Generic ;
4
5
using System . Linq ;
@@ -33,6 +34,18 @@ internal PinApi(IpfsClient ipfs)
33
34
. Select ( p => ( Cid ) p . Name ) ;
34
35
}
35
36
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
+
36
49
public async Task < IEnumerable < Cid > > RemoveAsync ( Cid id , bool recursive = true , CancellationToken cancel = default ( CancellationToken ) )
37
50
{
38
51
var opts = "recursive=" + recursive . ToString ( ) . ToLowerInvariant ( ) ;
You can’t perform that action at this time.
0 commit comments