using System.Collections.Generic; using System.IO; namespace TakeoutSaaS.Module.Storage.Models; /// /// 对象存储上传请求参数。 /// public sealed class StorageUploadRequest { /// /// 初始化上传请求。 /// /// 对象键(含路径)。 /// 文件流。 /// 内容类型。 /// 内容长度。 /// 是否返回签名访问链接。 /// 签名有效期。 /// 附加元数据。 public StorageUploadRequest( string objectKey, Stream content, string contentType, long contentLength, bool generateSignedUrl, TimeSpan signedUrlExpires, IDictionary? metadata = null) { ObjectKey = objectKey; Content = content; ContentType = contentType; ContentLength = contentLength; GenerateSignedUrl = generateSignedUrl; SignedUrlExpires = signedUrlExpires; Metadata = metadata == null ? new Dictionary() : new Dictionary(metadata); } /// /// 对象键。 /// public string ObjectKey { get; } /// /// 文件流。 /// public Stream Content { get; } /// /// 内容类型。 /// public string ContentType { get; } /// /// 内容长度。 /// public long ContentLength { get; } /// /// 是否需要签名访问链接。 /// public bool GenerateSignedUrl { get; } /// /// 签名有效期。 /// public TimeSpan SignedUrlExpires { get; } /// /// 元数据集合。 /// public IReadOnlyDictionary Metadata { get; } }