getSessionById method
Gets details of a specific session.
token JWT authentication token.
websiteId Website ID.
sessionId Session ID.
Returns a Map with the session data or null on error.
Implementation
Future<Map<String, dynamic>?> getSessionById({
required String token,
required String websiteId,
required String sessionId,
}) async {
final uri = Uri.parse('$endpoint/api/websites/$websiteId/sessions/$sessionId');
final response = await http.get(
uri,
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer $token',
},
);
if (response.statusCode == 200) {
return jsonDecode(response.body);
}
debugPrint('Failed to fetch session: ${response.statusCode} ${response.body}');
return null;
}