SharpRSS/SharpRss/Services/RssService.cs

74 lines
2.0 KiB
C#
Raw Normal View History

2023-05-18 01:27:11 +02:00
using System.Collections.Generic;
using System.Threading.Tasks;
using SharpRss.Models;
namespace SharpRss.Services
{
/// <summary>
/// Managing RSS feeds and categories.
/// </summary>
public class RssService
{
public RssService()
{
_dbService = new DatabaseService();
Initialize();
}
private readonly DatabaseService _dbService;
private async void Initialize()
{
//HashSet<CategoryModel> categoryModels = await _dbService.GetCategoriesAsync();
}
public async Task<HashSet<object>> GetAllAsync()
{
HashSet<object> items = new HashSet<object>();
return items;
}
public async Task<HashSet<CategoryModel>> GetCategoriesAsync()
{
return new HashSet<CategoryModel>();
}
public async Task<HashSet<FeedModel>> GetFeedsAsync(CategoryModel? categoryModel = null)
{
HashSet<FeedModel> feeds = new HashSet<FeedModel>();
if (categoryModel != null)
{
// Get feeds from the category.
}
else
{
// Get all the feeds.
}
return feeds;
}
public async void AddCategoryAsync(string name)
{
}
public async void AddFeedAsync(string rssUrl)
{
}
/*private static HashSet<FeedModel> feedSet = new HashSet<FeedModel>()
{
new FeedModel("http://fedoramagazine.org/feed/"),
new FeedModel("https://www.nasa.gov/rss/dyn/breaking_news.rss"),
};
private static HashSet<FeedModel> feedSet2 = new HashSet<FeedModel>()
{
new FeedModel("https://journals.plos.org/plosone/feed/atom"),
new FeedModel("https://itsfoss.com/feed")
};*/
/*HashSet<CategoryModel> set = new HashSet<CategoryModel>()
{
new CategoryModel("RSS", feedSet),
new CategoryModel("Tech", feedSet2)
};*/
}
}