mirrored_repositories/beecontrol/lib/services
// 📦 Package imports:
import 'package:http/http.dart' as http;
import 'package:webfeed/webfeed.dart';

// 🌎 Project imports:
import '../http/http_exception.dart';

const String apiculture =
    'https://news.google.com/rss/topics/CAAqJggKIiBDQkFTRWdvSkwyMHZNREYyYmpNMUVnVndkQzFDVWlnQVAB?hl=pt-BR&gl=BR&ceid=BR:pt-419';

class FeedRepository {
  Future getFeed({String url = apiculture}) async {
    final client = http.Client();
    Uri uri = Uri.parse(url);

    final response = await client.get(uri);
    if (response.statusCode != 200) {
      throw HTTPException(response.statusCode, 'unable to fetch feed data');
    }
    return RssFeed.parse(response.body);
  }
}
