SharpRSS/SharpRss/RssService.cs
Max Holleman fcda58d30f Push
2023-05-12 15:48:14 +02:00

53 lines
1.3 KiB
C#

using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CodeHollow.FeedReader;
using SharpRss.Models;
namespace SharpRss
{
/// <summary>
/// Managing RSS feeds and categories.
/// </summary>
public class RssService
{
public RssService()
{
/// Storage options:
/// - Database
/// - File
/// - Memory
}
public async Task<HashSet<CategoryModel>> GetCategories()
{
return new HashSet<CategoryModel>();
}
public async Task<HashSet<FeedModel>> GetAllFeeds()
{
return new HashSet<FeedModel>();
}
/// Old
public async Task<Feed> GetFeed(string feedUrl)
{
var urls = await FeedReader.GetFeedUrlsFromUrlAsync(feedUrl);
string url;
if (urls.Count() < 1)
url = _feeds[0];
else
url = urls.First().Url;
return await FeedReader.ReadAsync(url);
}
public async Task<HashSet<Feed>> GetFeedsFromCatAsync(CategoryModel category)
{
return new HashSet<Feed>();
}
private readonly string[] _feeds = { "https://www.reddit.com/r/freshrss/.rss", "http://fedoramagazine.org/" };
}
}