mirror of
https://github.com/Suwayomi/Tachidesk.git
synced 2026-01-28 06:24:25 +01:00
Docs improvements (#359)
* Use Array since Javalin OpenAPI requires it to read the list generics * Use custom Pager class for documentation
This commit is contained in:
@@ -30,7 +30,7 @@ object CategoryController {
|
||||
ctx.json(Category.getCategoryList())
|
||||
},
|
||||
withResults = {
|
||||
json<List<CategoryDataClass>>(HttpCode.OK)
|
||||
json<Array<CategoryDataClass>>(HttpCode.OK)
|
||||
}
|
||||
)
|
||||
|
||||
@@ -107,7 +107,7 @@ object CategoryController {
|
||||
ctx.json(CategoryManga.getCategoryMangaList(categoryId))
|
||||
},
|
||||
withResults = {
|
||||
json<List<MangaDataClass>>(HttpCode.OK)
|
||||
json<Array<MangaDataClass>>(HttpCode.OK)
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ object ExtensionController {
|
||||
)
|
||||
},
|
||||
withResults = {
|
||||
json<List<ExtensionDataClass>>(HttpCode.OK)
|
||||
json<Array<ExtensionDataClass>>(HttpCode.OK)
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ object MangaController {
|
||||
ctx.json(CategoryManga.getMangaCategories(mangaId))
|
||||
},
|
||||
withResults = {
|
||||
json<List<CategoryDataClass>>(HttpCode.OK)
|
||||
json<Array<CategoryDataClass>>(HttpCode.OK)
|
||||
}
|
||||
)
|
||||
|
||||
@@ -205,7 +205,7 @@ object MangaController {
|
||||
ctx.future(future { Chapter.getChapterList(mangaId, onlineFetch) })
|
||||
},
|
||||
withResults = {
|
||||
json<List<ChapterDataClass>>(HttpCode.OK)
|
||||
json<Array<ChapterDataClass>>(HttpCode.OK)
|
||||
httpCode(HttpCode.NOT_FOUND)
|
||||
}
|
||||
)
|
||||
|
||||
@@ -39,7 +39,7 @@ object SourceController {
|
||||
ctx.json(Source.getSourceList())
|
||||
},
|
||||
withResults = {
|
||||
json<List<SourceDataClass>>(HttpCode.OK)
|
||||
json<Array<SourceDataClass>>(HttpCode.OK)
|
||||
}
|
||||
)
|
||||
|
||||
@@ -118,7 +118,7 @@ object SourceController {
|
||||
ctx.json(Source.getSourcePreferences(sourceId))
|
||||
},
|
||||
withResults = {
|
||||
json<List<Source.PreferenceObject>>(HttpCode.OK)
|
||||
json<Array<Source.PreferenceObject>>(HttpCode.OK)
|
||||
}
|
||||
)
|
||||
|
||||
@@ -154,7 +154,7 @@ object SourceController {
|
||||
ctx.json(Search.getFilterList(sourceId, reset))
|
||||
},
|
||||
withResults = {
|
||||
json<List<Search.FilterObject>>(HttpCode.OK)
|
||||
json<Array<Search.FilterObject>>(HttpCode.OK)
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import suwayomi.tachidesk.manga.impl.update.IUpdater
|
||||
import suwayomi.tachidesk.manga.impl.update.UpdateStatus
|
||||
import suwayomi.tachidesk.manga.impl.update.UpdaterSocket
|
||||
import suwayomi.tachidesk.manga.model.dataclass.CategoryDataClass
|
||||
import suwayomi.tachidesk.manga.model.dataclass.MangaDataClass
|
||||
import suwayomi.tachidesk.manga.model.dataclass.MangaChapterDataClass
|
||||
import suwayomi.tachidesk.manga.model.dataclass.PaginatedList
|
||||
import suwayomi.tachidesk.server.JavalinSetup.future
|
||||
import suwayomi.tachidesk.server.util.formParam
|
||||
@@ -49,10 +49,16 @@ object UpdateController {
|
||||
)
|
||||
},
|
||||
withResults = {
|
||||
json<PaginatedList<MangaDataClass>>(HttpCode.OK)
|
||||
json<PagedMangaChapterListDataClass>(HttpCode.OK)
|
||||
}
|
||||
)
|
||||
|
||||
/**
|
||||
* Class made for handling return type in the documentation for [recentChapters],
|
||||
* since OpenApi cannot handle runtime generics.
|
||||
*/
|
||||
private class PagedMangaChapterListDataClass : PaginatedList<MangaChapterDataClass>(emptyList(), false)
|
||||
|
||||
val categoryUpdate = handler(
|
||||
formParam<Int?>("categoryId"),
|
||||
documentWith = {
|
||||
|
||||
@@ -9,7 +9,7 @@ package suwayomi.tachidesk.manga.model.dataclass
|
||||
|
||||
import kotlin.math.min
|
||||
|
||||
data class PaginatedList<T>(
|
||||
open class PaginatedList<T>(
|
||||
val page: List<T>,
|
||||
val hasNextPage: Boolean,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user