mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
[core] client factory for SomeRandomApi
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
using System.Net.Http.Json;
|
||||
using West.TelegramBot.ContentStore.Model;
|
||||
|
||||
namespace West.TelegramBot.ContentStore.API;
|
||||
|
||||
public class SomeRandomApi : ISomeRandomApi
|
||||
{
|
||||
private readonly HttpClient _client;
|
||||
|
||||
public SomeRandomApi(HttpClient client)
|
||||
{
|
||||
_client = client;
|
||||
}
|
||||
|
||||
public async Task<SomeRandomApiAnimalResponse> GetAnimalAsync(string animalId)
|
||||
{
|
||||
return (await _client.GetFromJsonAsync<SomeRandomApiAnimalResponse>(
|
||||
$"animal/{animalId}"
|
||||
))!;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user