using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Text; using System.Threading; using System.Threading.Tasks; namespace AIK.Service.IService { public interface IHttpClientService { Task GetWithTimeoutAsync(string url, TimeSpan? timeout = null, CancellationToken cancellationToken = default); Task PostWithTimeoutAsync(string url, HttpContent content, TimeSpan? timeout = null, CancellationToken cancellationToken = default); Task GetStringWithTimeoutAsync(string url, TimeSpan? timeout = null, CancellationToken cancellationToken = default); Task PostJsonWithTimeoutAsync(string url, string jsonData, TimeSpan? timeout = null, CancellationToken cancellationToken = default); Task GetByteArrayWithTimeoutAsync(string url, TimeSpan? timeout = null, CancellationToken cancellationToken = default); Task GetStringWithTimeoutAndTokenAsync(string url, string token, TimeSpan? timeout = null, CancellationToken cancellationToken = default); Task PostJsonWithTimeoutAndTokenAsync(string url, string jsonData, string token, TimeSpan? timeout = null, CancellationToken cancellationToken = default); /// /// 流式下载文件到指定路径。内部通过 BouncyCastleTlsHandler 的流式通道逐段读取, /// 每段读取带空闲超时、无总时长限制,适合大文件下载。失败抛出异常(由调用方决定重试)。 /// 支持断点续传:传入 resumeOffset(已下载字节数)时自动携带 Range 头并从文件末尾追加写入。 /// /// 文件下载地址 /// 目标文件路径(不存在则创建;resumeOffset>0 时追加写入) /// 下载进度 0-100 /// 取消令牌 /// 已下载字节数(断点续传偏移,0 表示从头下载) Task DownloadToFileWithProgressAsync(string url, string filePath, IProgress progress = null, CancellationToken cancellationToken = default, long resumeOffset = 0); } }