You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
498 B
20 lines
498 B
|
|
namespace Admin.NET.Core.Service;
|
|
|
|
public class ApiService
|
|
{
|
|
private readonly HttpClient _httpClient;
|
|
|
|
public ApiService()
|
|
{
|
|
_httpClient = new HttpClient();
|
|
}
|
|
|
|
public async Task<string> GetApiResponseAsync(string url)
|
|
{
|
|
HttpResponseMessage response = await _httpClient.GetAsync(url);
|
|
response.EnsureSuccessStatusCode();
|
|
string responseBody = await response.Content.ReadAsStringAsync();
|
|
return responseBody;
|
|
}
|
|
}
|