31 lines
725 B
C#
31 lines
725 B
C#
using RBLFeederCommon.Models.RssFeed;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Net.Http;
|
|
using System.Net.Http.Json;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace RBLNews.Shared.Services
|
|
{
|
|
public interface IFeedDataService
|
|
{
|
|
public RssVM? Feeds { get; }
|
|
Task LoadFeeds();
|
|
}
|
|
|
|
public class FeedDataService : IFeedDataService
|
|
{
|
|
private static HttpClient httpClient = new HttpClient();
|
|
|
|
private RssVM? feeds;
|
|
public RssVM? Feeds { get => this.feeds; }
|
|
|
|
public async Task LoadFeeds()
|
|
{
|
|
feeds = await httpClient.GetFromJsonAsync<RssVM>("https://rblnews.de/api/feeds");
|
|
}
|
|
}
|
|
}
|