Interface IBlogService
- Namespace
- Builvero.Application.Interfaces.Services
- Assembly
- Builvero.Application.dll
Defines the contract for blog post management operations including CRUD operations and image upload URL generation.
public interface IBlogService
Methods
CreatePostAsync(CreateBlogPostRequest, Guid, CancellationToken)
Creates a new blog post.
Task<BlogPostDetailsDto> CreatePostAsync(CreateBlogPostRequest request, Guid createdByUserId, CancellationToken cancellationToken = default)
Parameters
requestCreateBlogPostRequestThe blog post creation request.
createdByUserIdGuidThe unique identifier of the user creating the post.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<BlogPostDetailsDto>
The created blog post details.
DeletePostAsync(Guid, CancellationToken)
Deletes a blog post.
Task<bool> DeletePostAsync(Guid id, CancellationToken cancellationToken = default)
Parameters
idGuidThe unique identifier of the blog post to delete.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
GenerateImageUploadUrlAsync(string, string, CancellationToken)
Generates a presigned URL for uploading a blog image to S3.
Task<BlogImageUploadResponse> GenerateImageUploadUrlAsync(string fileExtension, string contentType, CancellationToken cancellationToken = default)
Parameters
fileExtensionstringThe file extension of the image (e.g., "jpg", "png").
contentTypestringThe MIME type of the image (e.g., "image/jpeg", "image/png").
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<BlogImageUploadResponse>
The upload URL, object key, and read URL for the image.
GetAllPostsAsync(bool, CancellationToken)
Retrieves all blog posts, optionally filtered by publication status.
Task<List<BlogPostSummaryDto>> GetAllPostsAsync(bool publishedOnly = false, CancellationToken cancellationToken = default)
Parameters
publishedOnlyboolIf true, returns only published posts; otherwise returns all posts.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<List<BlogPostSummaryDto>>
A list of blog post summaries ordered by creation date (newest first).
GetPostByIdAsync(Guid, CancellationToken)
Retrieves a blog post by its unique identifier.
Task<BlogPostDetailsDto?> GetPostByIdAsync(Guid id, CancellationToken cancellationToken = default)
Parameters
idGuidThe unique identifier of the blog post to retrieve.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<BlogPostDetailsDto>
The blog post details if found; otherwise, null.
GetPostBySlugAsync(string, CancellationToken)
Retrieves a published blog post by its slug.
Task<BlogPostDetailsDto?> GetPostBySlugAsync(string slug, CancellationToken cancellationToken = default)
Parameters
slugstringThe slug of the blog post to retrieve.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<BlogPostDetailsDto>
The blog post details if found and published; otherwise, null.
UpdatePostAsync(Guid, UpdateBlogPostRequest, CancellationToken)
Updates an existing blog post.
Task<BlogPostDetailsDto?> UpdatePostAsync(Guid id, UpdateBlogPostRequest request, CancellationToken cancellationToken = default)
Parameters
idGuidThe unique identifier of the blog post to update.
requestUpdateBlogPostRequestThe blog post update request.
cancellationTokenCancellationTokenCancellation token to cancel the operation.
Returns
- Task<BlogPostDetailsDto>
The updated blog post details if found; otherwise, null.