You can not select more than 25 topics
Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- using System.IO;
- using System.Net.Http;
- using System.Threading.Tasks;
-
- namespace TextCommandFramework.Services
- {
- public class PictureService
- {
- private readonly HttpClient _http;
-
- public PictureService(HttpClient http)
- => _http = http;
-
- public async Task<Stream> GetCatPictureAsync()
- {
- var resp = await _http.GetAsync("https://cataas.com/cat");
- return await resp.Content.ReadAsStreamAsync();
- }
- }
- }
|