BITFALL/Assets/BITKit/Core/Net/IWebProvider.cs

16 lines
586 B
C#
Raw Normal View History

2023-08-12 01:43:24 +08:00
using System.Threading;
using Cysharp.Threading.Tasks;
namespace BITKit.HttpNet
{
public interface IWebProvider
{
UniTask<string> GetAsync(string url, CancellationToken cancellationToken = default);
async UniTask<T> GetAsync<T>(string url, CancellationToken cancellationToken = default)
{
var json = await GetAsync(url, cancellationToken);
return Newtonsoft.Json.JsonConvert.DeserializeObject<T>(json);
}
UniTask<string> PostAsync<T>(string url, T value, CancellationToken cancellationToken = default);
}
}