mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-04 03:14:40 -05:00
POST variant for /{sourceId}/search endpoint (#434)
* Add POST variant for `/{sourceId}/search` endpoint which handles body data as list of FilterChanges
* Revert changes to existing endpoint and create new route and change the interface
* Update doc
* Rename api endpoint
This commit is contained in:
@@ -16,6 +16,7 @@ import org.kodein.di.instance
|
||||
import suwayomi.tachidesk.manga.impl.MangaList
|
||||
import suwayomi.tachidesk.manga.impl.Search
|
||||
import suwayomi.tachidesk.manga.impl.Search.FilterChange
|
||||
import suwayomi.tachidesk.manga.impl.Search.FilterData
|
||||
import suwayomi.tachidesk.manga.impl.Source
|
||||
import suwayomi.tachidesk.manga.impl.Source.SourcePreferenceChange
|
||||
import suwayomi.tachidesk.manga.model.dataclass.PagedMangaListDataClass
|
||||
@@ -202,6 +203,25 @@ object SourceController {
|
||||
}
|
||||
)
|
||||
|
||||
/** quick search single source filter */
|
||||
val quickSearchSingle = handler(
|
||||
pathParam<Long>("sourceId"),
|
||||
queryParam("pageNum", 1),
|
||||
documentWith = {
|
||||
withOperation {
|
||||
summary("Source manga quick search")
|
||||
description("Returns list of manga from source matching posted searchTerm and filter")
|
||||
}
|
||||
},
|
||||
behaviorOf = { ctx, sourceId, pageNum ->
|
||||
var filter = json.decodeFromString<FilterData>(ctx.body())
|
||||
ctx.future(future { Search.sourceFilter(sourceId, pageNum, filter) })
|
||||
},
|
||||
withResults = {
|
||||
json<PagedMangaListDataClass>(HttpCode.OK)
|
||||
}
|
||||
)
|
||||
|
||||
/** all source search */
|
||||
val searchAll = handler(
|
||||
pathParam<String>("searchTerm"),
|
||||
|
||||
Reference in New Issue
Block a user