listDerivativeExchangesShort method

Future<CoinGeckoResult<List<DerivativeExchangeShort>>> listDerivativeExchangesShort()

List all derivative exchanges name and identifier.

Query: /derivatives/exchanges/list

Implementation

Future<CoinGeckoResult<List<DerivativeExchangeShort>>>
    listDerivativeExchangesShort() async {
  final response = await _dio.get(
    '/derivatives/exchanges/list',
  );
  if (response.statusCode == 200) {
    final data = Convert.toList(response.data, []);
    final list =
        data.map((e) => DerivativeExchangeShort.fromJson(e)).toList();
    return CoinGeckoResult(list);
  } else {
    return CoinGeckoResult(
      [],
      errorCode: response.statusCode ?? null,
      errorMessage: '${response.statusMessage} - ${response.data.toString()}',
      isError: true,
    );
  }
}