mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-10-14 17:54:42 +00:00
30 lines
1.3 KiB
C#
30 lines
1.3 KiB
C#
namespace Infrastructure.FileUpload;
|
|
|
|
/// <summary>
|
|
/// Service for storing and retrieving uploaded files in S3-compatible object storage.
|
|
/// </summary>
|
|
public interface IFileStorageProvider
|
|
{
|
|
/// <summary>Uploads a file to the configured bucket.</summary>
|
|
/// <param name="key">The object key (path) to store the file under.</param>
|
|
/// <param name="content">The file content.</param>
|
|
/// <param name="contentType">The MIME type of the file.</param>
|
|
/// <param name="cancellationToken">A token to cancel the upload.</param>
|
|
Task UploadAsync(
|
|
string key,
|
|
Stream content,
|
|
string contentType,
|
|
CancellationToken cancellationToken = default
|
|
);
|
|
|
|
/// <summary>Deletes a file from the configured bucket.</summary>
|
|
/// <param name="key">The object key of the file to delete.</param>
|
|
/// <param name="cancellationToken">A token to cancel the deletion.</param>
|
|
Task DeleteAsync(string key, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>Generates a time-limited URL for retrieving a file directly from storage.</summary>
|
|
/// <param name="key">The object key of the file.</param>
|
|
/// <param name="expiresIn">How long the URL remains valid.</param>
|
|
string GetPresignedUrl(string key, TimeSpan expiresIn);
|
|
}
|