aboutsummaryrefslogtreecommitdiffstats
path: root/src/Services/NrkRadioService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Services/NrkRadioService.cs')
-rw-r--r--src/Services/NrkRadioService.cs31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/Services/NrkRadioService.cs b/src/Services/NrkRadioService.cs
new file mode 100644
index 0000000..a2889ce
--- /dev/null
+++ b/src/Services/NrkRadioService.cs
@@ -0,0 +1,31 @@
+using Microsoft.Extensions.Caching.Memory;
+
+namespace I2R.LightNews.Services;
+
+public class NrkRadioService
+{
+ private readonly IMemoryCache _cache;
+ private readonly HttpClient _http;
+ private const string CATEGORY_SEARCH_CACHE_KEY = "category_search";
+
+ public NrkRadioService(IMemoryCache cache, HttpClient http) {
+ _cache = cache;
+ http.BaseAddress = new Uri("https://psapi.nrk.no");
+ _http = http;
+ }
+
+ public async Task GetEverythingAsync() {
+ var path = "/radio/search/categories/alt-innhold";
+ var everything = new List<RadioSeries>();
+ while (path.HasValue()) {
+ var response = await _http.GetFromJsonAsync<RadioCategorySearchResult>(path);
+
+ }
+ }
+
+ public async Task<RadioCategorySearchResult> SearchCategoriesAsync(string query, int take = 50, int skip = 50) {
+ return await _http.GetFromJsonAsync<RadioCategorySearchResult>(
+ "/radio/search/categories/alt-innhold?q=" + query + "&take=" + take + "&skip=" + skip
+ );
+ }
+} \ No newline at end of file