getSessionTranscripts method

Future<ChatTranscript> getSessionTranscripts({
  1. required String agentId,
  2. required String sessionId,
})

Implementation

Future<ChatTranscript> getSessionTranscripts({
  required String agentId,
  required String sessionId,
}) async {
  try {
    final response = await http.get(
      Uri.parse(
          '$baseUrlProduction/getSessionTranscripts?agentId=$agentId&sessionId=$sessionId'
      ),
    );

    if (response.statusCode == 200) {
      final List<dynamic> jsonData = json.decode(response.body);
      return ChatTranscript.fromJson(jsonData);
    } else {
      throw Exception('Failed to load transcripts: ${response.statusCode}');
    }
  } catch (e) {
    throw Exception('Error fetching transcripts: $e');
  }
}