[store] Basic content store implementation.

- Bump Telegram Bot Framework to 0.6.9-gf1e77653ff
This commit is contained in:
West14
2022-02-16 17:07:30 +02:00
parent 67d0e81953
commit e815deba58
15 changed files with 376 additions and 2 deletions
@@ -0,0 +1,24 @@
using Newtonsoft.Json;
using West.TelegramBot.ContentStore.Model;
namespace West.TelegramBot.ContentStore.Service;
public abstract class AnimalAsAService : IRandomMediaService
{
private readonly HttpClient _httpClient;
protected AnimalAsAService(Uri baseAddress)
{
_httpClient = new HttpClient
{
BaseAddress = baseAddress
};
}
public async Task<RandomMedia> GetRandomMediaAsync()
{
var resp = await _httpClient.GetAsync("images/search");
var catImage = JsonConvert.DeserializeObject<List<AnimalImage>>(await resp.Content.ReadAsStringAsync())[0];
return new RandomMedia(catImage.Url);
}
}