using System.Net.Http.Json; using West.TelegramBot.CodeWatcher.Dto; namespace West.TelegramBot.CodeWatcher.Service; public class HasteService : IHasteService { private readonly HttpClient _client; public HasteService(HttpClient client) { _client = client; } public async Task PostDocumentAsync(string data) { var response = await (await _client.PostAsync("documents", new StringContent(data))) .Content.ReadFromJsonAsync(); if (response == null) { throw new Exception("Haste returned some shit"); } return response; } public Uri GetHasteUri() { return _client.BaseAddress!; } }