Add Koreader API endpoints

This commit is contained in:
Tyler Kenney 2025-05-19 16:51:14 -04:00
parent 6288d89651
commit e84aed357a
19 changed files with 4079 additions and 1 deletions

View file

@ -0,0 +1,42 @@
using API.DTOs.Koreader;
namespace API.Helpers.Builders;
public class KoreaderBookDtoBuilder : IEntityBuilder<KoreaderBookDto>
{
private readonly KoreaderBookDto _dto;
public KoreaderBookDto Build() => _dto;
public KoreaderBookDtoBuilder(string documentHash)
{
_dto = new KoreaderBookDto()
{
Document = documentHash,
Device = "Kavita"
};
}
public KoreaderBookDtoBuilder WithDocument(string documentHash)
{
_dto.Document = documentHash;
return this;
}
public KoreaderBookDtoBuilder WithProgress(string progress)
{
_dto.Progress = progress;
return this;
}
public KoreaderBookDtoBuilder WithPercentage(int? pageNum, int pages)
{
_dto.Percentage = (pageNum ?? 0) / (float) pages;
return this;
}
public KoreaderBookDtoBuilder WithDeviceId(string installId, int userId)
{
_dto.Device_id = installId;
return this;
}
}