Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0226b1b
commit 7c3bf33
Showing
4 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using Common.Logging; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Linq; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Ipfs.CoreApi; | ||
|
||
namespace Ipfs.Http | ||
{ | ||
|
||
class StatApi : IStatsApi | ||
{ | ||
IpfsClient ipfs; | ||
|
||
internal StatApi(IpfsClient ipfs) | ||
{ | ||
this.ipfs = ipfs; | ||
} | ||
|
||
public Task<BandwidthData> BandwidthAsync(CancellationToken cancel = default(CancellationToken)) | ||
{ | ||
return ipfs.DoCommandAsync<BandwidthData>("stats/bw", cancel); | ||
} | ||
|
||
public Task<BitswapData> BitswapAsync(CancellationToken cancel = default(CancellationToken)) | ||
{ | ||
return ipfs.DoCommandAsync<BitswapData>("stats/bitswap", cancel); | ||
} | ||
|
||
public Task<RepositoryData> RepositoryAsync(CancellationToken cancel = default(CancellationToken)) | ||
{ | ||
return ipfs.DoCommandAsync<RepositoryData>("stats/repo", cancel); | ||
} | ||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using Newtonsoft.Json.Linq; | ||
using System; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Ipfs.Http | ||
{ | ||
|
||
[TestClass] | ||
public class StatsApiTest | ||
{ | ||
|
||
[TestMethod] | ||
public async Task SmokeTest() | ||
{ | ||
var ipfs = TestFixture.Ipfs; | ||
var bandwidth = await ipfs.Stats.BandwidthAsync(); | ||
var bitswap = await ipfs.Stats.BitswapAsync(); | ||
var repository = await ipfs.Stats.RepositoryAsync(); | ||
} | ||
|
||
} | ||
} |