Table of Contents

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

objectKey string

S3 object key for the resume to delete

cancellationToken CancellationToken

Cancellation token

Returns

Task<bool>

True if the file was deleted successfully, false if it didn't exist

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

objectKey string

S3 object key (e.g., "profile-photos/{userId}/{uuid}.jpg")

expiresIn TimeSpan?

Time until the URL expires (default: 15 minutes)

cancellationToken CancellationToken

Cancellation token

Returns

Task<string>

Pre-signed GET URL for accessing the photo

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

userId Guid

The ID of the user uploading the photo

fileExtension string

File extension (e.g., "jpg", "png")

contentType string

MIME type of the file (e.g., "image/jpeg")

cancellationToken CancellationToken

Cancellation token

Returns

Task<(string UploadUrl, string ObjectKey)>

Pre-signed upload URL and the S3 object key

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

objectKey string

S3 object key for the resume

expiresIn TimeSpan?

Time until the URL expires (default: 5 minutes)

cancellationToken CancellationToken

Cancellation token

Returns

Task<string>

Pre-signed GET URL for accessing the resume

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

objectKey string

S3 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

roleId Guid

The ID of the volunteer role

applicationId Guid

The ID of the volunteer application

fileStream Stream

The file stream to upload

fileName string

Original file name

contentType string

MIME type of the file

cancellationToken CancellationToken

Cancellation token

Returns

Task<string>

S3 object key where the file was stored