makeRequest method
Implementation
Future<Map<String, dynamic>> makeRequest(
String endpoint, Map<String, dynamic> payload) async {
try {
final uri = Uri.parse('$baseUrl$endpoint');
final response = await http.post(
uri,
headers: getHeaders(),
body: jsonEncode(payload),
);
if (response.statusCode >= 400) {
throw Exception('HTTP error! status: ${response.statusCode}');
}
return jsonDecode(response.body);
} catch (error) {
throw Exception('YouTube API Error: $error');
}
}