Skip to content

Commit 9643d9b

Browse files
committed
Extended the ICryptoStatsSource with a new method that allows the caller to list all available cryptocurrencies.
Implemented the new method in the Coingecko source.
1 parent cbbde47 commit 9643d9b

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

CryptoStatsSource/CoingeckoSource.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,8 @@ public CoingeckoSource()
2323
public async Task<List<MarketEntry>> GetMarketEntries(string currency, params string[] ids) => await _client
2424
.GetRequest("coins/markets").AddQueryParameter("vs_currency", currency)
2525
.AddQueryParameter("ids", String.Join(",", ids)).ExecuteAsync<List<MarketEntry>>();
26+
27+
public async Task<List<Cryptocurrency>> GetAvailableCryptocurrencies() => await _client
28+
.GetRequest("coins/list").ExecuteAsync<List<Cryptocurrency>>();
2629
}
2730
}

CryptoStatsSource/CryptoStatsSource.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@ namespace CryptoStatsSource
77
public interface ICryptoStatsSource
88
{
99
public Task<List<MarketEntry>> GetMarketEntries(string currency, params string[] ids);
10+
11+
public Task<List<Cryptocurrency>> GetAvailableCryptocurrencies();
1012
}
1113
}

0 commit comments

Comments
 (0)