Skip to content

Commit e1a4f90

Browse files
authored
Merge pull request #47 from princessdaphie/feature/add-pin-type-to-pinlistasync
Kubo API allows listing pins by type (direct/indirect/recursive/all),…
2 parents 22ecc39 + f251610 commit e1a4f90

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

src/CoreApi/IPinApi.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,21 @@ public interface IPinApi
4242
/// </returns>
4343
Task<IEnumerable<Cid>> ListAsync(CancellationToken cancel = default);
4444

45+
/// <summary>
46+
/// List all the objects pinned to local storage.
47+
/// </summary>
48+
/// <param name="type">
49+
/// The type of pin to list.
50+
/// </param>
51+
/// <param name="cancel">
52+
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
53+
/// </param>
54+
/// <returns>
55+
/// A task that represents the asynchronous operation. The task's value
56+
/// is a sequence of <see cref="Cid"/>.
57+
/// </returns>
58+
Task<IEnumerable<Cid>> ListAsync(PinType type, CancellationToken cancel = default);
59+
4560
/// <summary>
4661
/// Unpin an object.
4762
/// </summary>

src/CoreApi/PinType.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
namespace Ipfs.CoreApi
2+
{
3+
/// <summary>
4+
/// The type of pin.
5+
/// </summary>
6+
/// <remarks>
7+
/// See <see href="https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-pin-ls">type</see>
8+
/// for more information.
9+
/// </remarks>
10+
public enum PinType
11+
{
12+
/// <summary>
13+
/// Direct pin.
14+
/// </summary>
15+
Direct,
16+
/// <summary>
17+
/// Indirect pin.
18+
/// </summary>
19+
Indirect,
20+
/// <summary>
21+
/// Recursive pin.
22+
/// </summary>
23+
Recursive,
24+
/// <summary>
25+
/// All pins.
26+
/// </summary>
27+
All
28+
}
29+
}

0 commit comments

Comments
 (0)