optimization request http

This commit is contained in:
Aigio Liu
2021-03-03 23:57:59 +08:00
parent 4024236000
commit ef8afedab1
18 changed files with 541 additions and 152 deletions
@@ -0,0 +1,40 @@
using System.Application;
using System.Application.Services;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace System.Application
{
/// <summary>
/// 图片下载渠道类型
/// </summary>
public enum ImageChannelType
{
/// <summary>
/// Steam 头像图片
/// </summary>
SteamAvatars,
/// <summary>
/// Steam 游戏图片
/// </summary>
SteamGames,
}
}
namespace System
{
public static class ImageChannelTypeEnumExtensions
{
/// <inheritdoc cref="IHttpService.GetImageAsync(string, string, CancellationToken)"/>
public static Task<Stream?> GetImageAsync(this IHttpService httpService,
string requestUri,
ImageChannelType channelType,
CancellationToken cancellationToken = default)
{
var channelType_ = channelType.ToString();
return httpService.GetImageAsync(requestUri, channelType_, cancellationToken);
}
}
}