| tags |
|
|---|
Tất cả các API được thiết kế theo chuẩn RESTful và phân nhóm theo 5 Controller tương ứng với tính năng của hệ thống. Prefix đường dẫn mặc định là: api/v1/[controller]
Route Base: api/v1/file
Quản lý luồng tải lên và tải xuống các asset (Cover, Content Images) lưu tại Storage.
Tải ảnh/asset lên hệ thống. Tự động kiểm tra trùng lặp thông qua Hash (MD5/SHA256) của file để tối ưu bộ nhớ.
- Endpoint:
POST /api/v1/file/upload/{seriesId} - Request Type:
multipart/form-data - Path Parameter:
seriesId(string, required): Mã định danh series (dạngser_...).
- Query Parameter:
refType(string, optional): Loại tham chiếu asset ("Content"hoặc"Cover"). Mặc định là"Content".
- Response (200 OK): Trả về DTO thông tin asset chứa
AssetKey(Path trong S3).
Tải/Lấy nội dung file ảnh để hiển thị.
- Endpoint:
GET /api/v1/file/{assetId} - Response (200 OK): Stream nhị phân của file cùng với
ContentTypetương ứng.
Xóa asset ra khỏi hệ thống.
- Endpoint:
DELETE /api/v1/file/{assetId} - Response (204 No Content): Xóa thành công.
Route Base: api/v1/series
- Endpoint:
GET /api/v1/series - Query Parameters:
pageIndex,pageSize. - Response (200 OK): Danh sách Series kèm thông tin phân trang.
- Endpoint:
GET /api/v1/series/{id} - Query Parameter:
timestamp(bool, optional): Hiển thị ngày tạo/sửa. Mặc địnhfalse.
Lấy tóm tắt bộ truyện đã qua render định dạng.
- Endpoint:
GET /api/v1/series/{id}/content - Query Parameter:
format(string, optional):"markdown"hoặc"html". Mặc định"markdown".
Lấy toàn bộ cấu trúc cây thư mục (Canonical Book Tree) của Series.
- Endpoint:
GET /api/v1/series/{id}/tree - Response (200 OK): Trả về cấu trúc cây
BookTreeDtogồm danh sách các volume và chapter con được sắp xếp theo thứ tự chuẩn.
Tạo mới series (hoặc trả về series hiện có nếu trùng tiêu đề).
- Endpoint:
POST /api/v1/series - Body:
CreateSeriesRequestDto - Response (201 Created / 200 OK): Series detail DTO.
- Endpoint:
PATCH /api/v1/series/{id} - Body:
UpdateSeriesRequestDto
- Endpoint:
DELETE /api/v1/series/{id}
- Endpoint:
GET /api/v1/series/{id}/volumes
Đồng bộ hóa thứ tự và liên kết cấu trúc cây từ phía Client.
- Endpoint:
POST /api/v1/series/{id}/sync - Body:
SyncSeriesRequestDto
Route Base: api/v1/volume
- Endpoint:
POST /api/v1/volume - Body:
CreateVolumeRequestDto
- Endpoint:
PATCH /api/v1/volume/{id} - Body:
UpdateVolumeRequestDto
- Endpoint:
DELETE /api/v1/volume/{id}
- Endpoint:
GET /api/v1/volume/{id}/chapters
Route Base: api/v1/chapter
- Endpoint:
GET /api/v1/chapter/{id}
Lấy nội dung chi tiết của chương đã render sang HTML hoặc Markdown.
- Endpoint:
GET /api/v1/chapter/{id}/content - Query Parameter:
format(string):"html"hoặc"markdown". Mặc định là"markdown". - Response (200 OK):
{ "data": "nội dung đã render...", "type": "text/markdown", "assets": [] }
Nhận dữ liệu từ Tool Scraper để tạo mới chương kèm nội dung segments.
- Endpoint:
POST /api/v1/chapter - Body:
CreateChapterRequestDto
Cập nhật thông tin tiêu đề, thứ tự hoặc cập nhật mảng segments mới.
- Endpoint:
PATCH /api/v1/chapter/{id} - Body:
UpdateChapterRequestDto
Chia một chương thành nhiều chương con dựa vào vị trí segment chỉ định.
- Endpoint:
POST /api/v1/chapter/{id}/split - Body:
{ "splitPoints": [ { "segmentIndex": 25, "newChapterTitle": "Phần II" } ] }
Gộp nhiều chương lại thành một chương duy nhất.
- Endpoint:
POST /api/v1/chapter/merge - Body:
MergeChaptersRequestDto
Route Base: api/v1/publish
Hệ thống xử lý xuất/nhập sách dưới nền (Background Job) thông qua Hangfire Worker.
Tạo task đóng gói bộ truyện hoặc tập truyện thành EPUB hoặc các định dạng khác.
- Endpoint:
POST /api/v1/publish/export?seriesId={seriesId} - Body:
{ "format": "Epub", "mode": "Anthology", "targetVolumeIds": [], "structure": null } - Response (202 Accepted): Trả về ID của Background Job và URL theo dõi trạng thái.
Nhập và phân tách tự động file EPUB tải lên thành Series/Volume/Chapter tương ứng trong DB.
- Endpoint:
POST /api/v1/publish/import - Request Type:
multipart/form-data - Body (Form):
series: Metadata JSON string của Series.volumes: (Optional) Metadata JSON string ghi đè cho các Volume.file: File.epubcần import.
- Response (202 Accepted): Trả về ID của Import Background Job.
- Endpoint:
GET /api/v1/publish/jobs/{jobId}
Tải xuống thành phẩm (EPUB/ZIP) sau khi Job đóng gói hoàn thành.
- Endpoint:
GET /api/v1/publish/jobs/{jobId}/download - Response (200 OK): File Stream kết quả tải xuống.