Table of Contents

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

request CreateBlogPostRequest

The blog post creation request.

createdByUserId Guid

The unique identifier of the user creating the post.

cancellationToken CancellationToken

Cancellation 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

id Guid

The unique identifier of the blog post to delete.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<bool>

True if the post was deleted; otherwise, false.

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

fileExtension string

The file extension of the image (e.g., "jpg", "png").

contentType string

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

cancellationToken CancellationToken

Cancellation 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

publishedOnly bool

If true, returns only published posts; otherwise returns all posts.

cancellationToken CancellationToken

Cancellation 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

id Guid

The unique identifier of the blog post to retrieve.

cancellationToken CancellationToken

Cancellation 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

slug string

The slug of the blog post to retrieve.

cancellationToken CancellationToken

Cancellation 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

id Guid

The unique identifier of the blog post to update.

request UpdateBlogPostRequest

The blog post update request.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<BlogPostDetailsDto>

The updated blog post details if found; otherwise, null.