public async Task<List<CryptoDto>> GetCryptoList() { var service = new InvokeWebService($"{BASE_URL}/map"); service.AddQueryString("sort", "cmc_rank"); service.AddQueryString("limit", "110"); service.AddHeader("X-CMC_PRO_API_KEY", API_KEY); service.AddHeader("Accepts", "application/json"); var result = await service.Invoke(); var data = result["data"]; return data?.Select(ConvertToCrypto).ToList(); }
public async Task<CryptoDto> GetCryptoRate(string symbol) { var service = new InvokeWebService($"{BASE_URL}/quotes/latest"); service.AddQueryString("symbol", symbol); service.AddQueryString("convert", "EUR"); service.AddHeader("X-CMC_PRO_API_KEY", API_KEY); service.AddHeader("Accepts", "application/json"); var result = await service.Invoke(); var cryptoInformation = result?["data"]?[symbol]; return ConvertToCrypto(cryptoInformation); }