From 788559125fbcfff126a875c31d8f40f8721102c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Terje=20S=C3=B8rensen?= Date: Sun, 21 Jan 2024 16:53:00 +0100 Subject: [PATCH] Added category in CoinGeckoApiClient.getMarkets call --- .../com/litesoftwares/coingecko/CoinGeckoApiClient.java | 2 ++ .../com/litesoftwares/coingecko/CoinGeckoApiService.java | 1 + .../coingecko/impl/CoinGeckoApiClientImpl.java | 7 ++++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/litesoftwares/coingecko/CoinGeckoApiClient.java b/src/main/java/com/litesoftwares/coingecko/CoinGeckoApiClient.java index 3be0ec4..16c3d3d 100644 --- a/src/main/java/com/litesoftwares/coingecko/CoinGeckoApiClient.java +++ b/src/main/java/com/litesoftwares/coingecko/CoinGeckoApiClient.java @@ -37,6 +37,8 @@ Map> getTokenPrice(String id, String contractAddress List getCoinMarkets(String vsCurrency, String ids, String order, Integer perPage, Integer page, boolean sparkline, String priceChangePercentage); + List getCoinMarkets(String vsCurrency, String ids, String category, String order, Integer perPage, Integer page, boolean sparkline, String priceChangePercentage); + CoinFullData getCoinById(String id); CoinFullData getCoinById(String id, boolean localization, boolean tickers, boolean marketData, boolean communityData, boolean developerData, boolean sparkline); diff --git a/src/main/java/com/litesoftwares/coingecko/CoinGeckoApiService.java b/src/main/java/com/litesoftwares/coingecko/CoinGeckoApiService.java index ffaf078..dbcdab5 100644 --- a/src/main/java/com/litesoftwares/coingecko/CoinGeckoApiService.java +++ b/src/main/java/com/litesoftwares/coingecko/CoinGeckoApiService.java @@ -46,6 +46,7 @@ Call>> getTokenPrice(@Path("id") String id, @Quer @GET("coins/markets") Call> getCoinMarkets(@Query("vs_currency") String vsCurrency, @Query("ids") String ids, + @Query("category") String category, @Query("order") String order, @Query("per_page") Integer perPage, @Query("page") Integer page, @Query("sparkline") boolean sparkline, @Query("price_change_percentage") String priceChangePercentage); diff --git a/src/main/java/com/litesoftwares/coingecko/impl/CoinGeckoApiClientImpl.java b/src/main/java/com/litesoftwares/coingecko/impl/CoinGeckoApiClientImpl.java index a93ad4d..23661ed 100644 --- a/src/main/java/com/litesoftwares/coingecko/impl/CoinGeckoApiClientImpl.java +++ b/src/main/java/com/litesoftwares/coingecko/impl/CoinGeckoApiClientImpl.java @@ -83,7 +83,12 @@ public List getCoinMarkets(String vsCurrency) { @Override public List getCoinMarkets(String vsCurrency, String ids, String order, Integer perPage, Integer page, boolean sparkline, String priceChangePercentage) { - return coinGeckoApi.executeSync(coinGeckoApiService.getCoinMarkets(vsCurrency,ids,order,perPage,page,sparkline,priceChangePercentage)); + return getCoinMarkets(vsCurrency,ids,null,order,perPage,page,sparkline,priceChangePercentage); + } + + @Override + public List getCoinMarkets(String vsCurrency, String ids, String category, String order, Integer perPage, Integer page, boolean sparkline, String priceChangePercentage) { + return coinGeckoApi.executeSync(coinGeckoApiService.getCoinMarkets(vsCurrency,ids,category,order,perPage,page,sparkline,priceChangePercentage)); } @Override