Skip to content

Commit 1b377be

Browse files
chore: throw on new API methods
1 parent 60e4b2f commit 1b377be

File tree

4 files changed

+37
-7
lines changed

4 files changed

+37
-7
lines changed

src/CoreApi/DhtApi.cs

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,33 @@ internal DhtApi(IpfsClient ipfs)
2929
return ipfs.IdAsync(id, cancel);
3030
}
3131

32-
public async Task<IEnumerable<Peer>> FindProvidersAsync(Cid id, int limit = 20, CancellationToken cancel = default(CancellationToken))
33-
{
32+
public async Task<IEnumerable<Peer>> FindProvidersAsync(Cid id, int limit = 20, Action<Peer> providerFound = null, CancellationToken cancel = default(CancellationToken))
33+
{
34+
// TODO: providerFound action
3435
var stream = await ipfs.PostDownloadAsync("dht/findprovs", cancel, id, $"num-providers={limit}");
3536
return ProviderFromStream(stream, limit);
36-
}
37-
37+
}
38+
39+
public Task<byte[]> GetAsync(byte[] key, CancellationToken cancel = default(CancellationToken))
40+
{
41+
throw new NotImplementedException();
42+
}
43+
44+
public Task ProvideAsync(Cid cid, bool advertise = true, CancellationToken cancel = default(CancellationToken))
45+
{
46+
throw new NotImplementedException();
47+
}
48+
49+
public Task PutAsync(byte[] key, out byte[] value, CancellationToken cancel = default(CancellationToken))
50+
{
51+
throw new NotImplementedException();
52+
}
53+
54+
public Task<bool> TryGetAsync(byte[] key, out byte[] value, CancellationToken cancel = default(CancellationToken))
55+
{
56+
throw new NotImplementedException();
57+
}
58+
3859
IEnumerable<Peer> ProviderFromStream(Stream stream, int limit = int.MaxValue)
3960
{
4061
using (var sr = new StreamReader(stream))

src/CoreApi/PubSubApi.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,15 @@ void ProcessMessages(string topic, Action<PublishedMessage> handler, StreamReade
102102
log.DebugFormat("Stop listening for '{0}' messages", topic);
103103
}
104104

105+
public Task PublishAsync(string topic, byte[] message, CancellationToken cancel = default(CancellationToken))
106+
{
107+
throw new NotImplementedException();
108+
}
109+
110+
public Task PublishAsync(string topic, Stream message, CancellationToken cancel = default(CancellationToken))
111+
{
112+
throw new NotImplementedException();
113+
}
105114
}
106115

107116
}

src/IpfsHttpClient.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
</PropertyGroup>
2828

2929
<ItemGroup>
30-
<PackageReference Include="Ipfs.Core" Version="0.40.0" />
31-
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
30+
<PackageReference Include="Ipfs.Core" Version="0.50.0" />
31+
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
3232
<PackageReference Include="System.Net.Http" Version="4.3.3" Condition="'$(TargetFramework)' == 'netstandard14'" />
3333
<PackageReference Include="System.Net.Http" Version="4.3.3" Condition="'$(TargetFramework)' == 'net45'" />
3434
</ItemGroup>

test/CoreApi/DhtApiTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public async Task FindProviders()
2828
{
2929
var ipfs = TestFixture.Ipfs;
3030
var cts = new CancellationTokenSource(TimeSpan.FromMinutes(2));
31-
var providers = await ipfs.Dht.FindProvidersAsync(helloWorldID, 1, cts.Token);
31+
var providers = await ipfs.Dht.FindProvidersAsync(helloWorldID, 1, cancel: cts.Token);
3232
Assert.AreNotEqual(0, providers.Count());
3333
}
3434

0 commit comments

Comments
 (0)