getMarketIndex method
Get market index by market id and index id.
marketId
sets the market id.
indexId
sets the index id.
Query path: /indexes/{market_id}/{id}
Implementation
Future<CoinGeckoResult<MarketIndex?>> getMarketIndex({
required String marketId,
required String indexId,
}) async {
final response = await _client.dio.get(
'/indexes/$marketId/$indexId',
);
if (response.statusCode == 200) {
final data = MarketIndex.fromJson(response.data);
return CoinGeckoResult(data);
} else {
return CoinGeckoResult(
null,
errorCode: response.statusCode ?? null,
errorMessage: '${response.statusMessage} - ${response.data.toString()}',
isError: true,
);
}
}