Interface IS3Service
- Namespace
- Builvero.Application.Interfaces.Services
- Assembly
- Builvero.Application.dll
Service for generating pre-signed S3 URLs for profile photo uploads and retrievals
public interface IS3Service
Methods
DeleteResumeAsync(string, CancellationToken)
Deletes a resume file from S3
Task<bool> DeleteResumeAsync(string objectKey, CancellationToken cancellationToken = default)
Parameters
objectKeystringS3 object key for the resume to delete
cancellationTokenCancellationTokenCancellation token
Returns
GeneratePresignedGetUrlAsync(string, TimeSpan?, CancellationToken)
Generates a pre-signed GET URL for retrieving a profile photo from S3
Task<string> GeneratePresignedGetUrlAsync(string objectKey, TimeSpan? expiresIn = null, CancellationToken cancellationToken = default)
Parameters
objectKeystringS3 object key (e.g., "profile-photos/{userId}/{uuid}.jpg")
expiresInTimeSpan?Time until the URL expires (default: 15 minutes)
cancellationTokenCancellationTokenCancellation token
Returns
GenerateProfilePhotoUploadUrlAsync(Guid, string, string, CancellationToken)
Generates a pre-signed URL for uploading a profile photo to S3
Task<(string UploadUrl, string ObjectKey)> GenerateProfilePhotoUploadUrlAsync(Guid userId, string fileExtension, string contentType, CancellationToken cancellationToken = default)
Parameters
userIdGuidThe ID of the user uploading the photo
fileExtensionstringFile extension (e.g., "jpg", "png")
contentTypestringMIME type of the file (e.g., "image/jpeg")
cancellationTokenCancellationTokenCancellation token
Returns
GenerateResumeDownloadUrlAsync(string, TimeSpan?, CancellationToken)
Generates a pre-signed GET URL for downloading a resume from S3
Task<string> GenerateResumeDownloadUrlAsync(string objectKey, TimeSpan? expiresIn = null, CancellationToken cancellationToken = default)
Parameters
objectKeystringS3 object key for the resume
expiresInTimeSpan?Time until the URL expires (default: 5 minutes)
cancellationTokenCancellationTokenCancellation token
Returns
GetProfilePhotoUrl(string)
Gets the public URL for a profile photo stored in S3
[Obsolete("Use GeneratePresignedGetUrlAsync instead for private buckets")]
string GetProfilePhotoUrl(string objectKey)
Parameters
objectKeystringS3 object key
Returns
- string
Public URL to access the photo
Remarks
DEPRECATED: Use GeneratePresignedGetUrlAsync instead for private buckets. This method is kept for backward compatibility but should not be used for new implementations.
UploadResumeAsync(Guid, Guid, Stream, string, string, CancellationToken)
Uploads a resume file directly to S3 (server-side upload)
Task<string> UploadResumeAsync(Guid roleId, Guid applicationId, Stream fileStream, string fileName, string contentType, CancellationToken cancellationToken = default)
Parameters
roleIdGuidThe ID of the volunteer role
applicationIdGuidThe ID of the volunteer application
fileStreamStreamThe file stream to upload
fileNamestringOriginal file name
contentTypestringMIME type of the file
cancellationTokenCancellationTokenCancellation token