using Smakolykytl2Epub.Models; using Newtonsoft.Json; using JsonSerializer = System.Text.Json.JsonSerializer; namespace Smakolykytl2Epub.Utils; public class Ranobe { private static readonly HttpClient Client = new HttpClient(); private const string ApiUrl = "https://api.smakolykytl.site/api/user/"; private const string SiteUrl = "https://smakolykytl.site/"; public static async Task GetById(int id) { var response = await Client.GetAsync(ApiUrl + "projects/" + id.ToString()); var content = await response.Content.ReadAsStringAsync(); // Console.WriteLine(content); return JsonConvert.DeserializeObject(content); } public static async Task GetChaptersById(int id) { var response = await Client.GetAsync(ApiUrl + "projects/" + id.ToString() + "/books"); var content = await response.Content.ReadAsStringAsync(); // Console.WriteLine(content); return JsonConvert.DeserializeObject(content); } public static async Task GetChapterById(int id) { var response = await Client.GetAsync(ApiUrl + "chapters/" + id.ToString()); var content = await response.Content.ReadAsStringAsync(); // Console.WriteLine(content); return JsonConvert.DeserializeObject(content); } }