listHistory method
Implementation
Future<List<HistoryItem>> listHistory() async {
Map<String, String> headers = {
'xi-api-key': ElevenLabs.apiKey,
'accept': 'application/json',
};
try {
final response = await ElevenLabsEndpoints.client.get(
Uri.parse(ElevenLabsEndpoints.historyUrl),
headers: headers,
);
final json = jsonDecode(response.body);
final list = json["history"] as List;
List<HistoryItem> voices =
list.map((e) => HistoryItem.fromJson(e)).toList();
return voices;
} catch (e) {
throw (e);
}
}