From 472bfec6bf70e32ede96b3e3d5198989cec715e1 Mon Sep 17 00:00:00 2001 From: Aria Moradi Date: Sun, 14 Mar 2021 01:26:52 +0330 Subject: [PATCH] improve docs --- server/src/main/kotlin/ir/armor/tachidesk/Main.kt | 10 +++++++++- .../src/main/kotlin/ir/armor/tachidesk/util/Search.kt | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/server/src/main/kotlin/ir/armor/tachidesk/Main.kt b/server/src/main/kotlin/ir/armor/tachidesk/Main.kt index 8206f8f..f160e3d 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/Main.kt +++ b/server/src/main/kotlin/ir/armor/tachidesk/Main.kt @@ -78,6 +78,7 @@ class Main { ctx.status(200) } + // icon for extension named `apkName` app.get("/api/v1/extension/icon/:apkName") { ctx -> val apkName = ctx.pathParam("apkName") val result = getExtensionIcon(apkName) @@ -86,31 +87,38 @@ class Main { ctx.header("content-type", result.second) } + // list of sources app.get("/api/v1/source/list") { ctx -> ctx.json(getSourceList()) } + // fetch source with id `sourceId` app.get("/api/v1/source/:sourceId") { ctx -> val sourceId = ctx.pathParam("sourceId").toLong() ctx.json(getSource(sourceId)) } + // popular mangas from source with id `sourceId` app.get("/api/v1/source/:sourceId/popular/:pageNum") { ctx -> val sourceId = ctx.pathParam("sourceId").toLong() val pageNum = ctx.pathParam("pageNum").toInt() ctx.json(getMangaList(sourceId, pageNum, popular = true)) } + + // latest mangas from source with id `sourceId` app.get("/api/v1/source/:sourceId/latest/:pageNum") { ctx -> val sourceId = ctx.pathParam("sourceId").toLong() val pageNum = ctx.pathParam("pageNum").toInt() ctx.json(getMangaList(sourceId, pageNum, popular = false)) } + // get manga info app.get("/api/v1/manga/:mangaId/") { ctx -> val mangaId = ctx.pathParam("mangaId").toInt() ctx.json(getManga(mangaId)) } + // manga thumbnail app.get("api/v1/manga/:mangaId/thumbnail") { ctx -> val mangaId = ctx.pathParam("mangaId").toInt() val result = getThumbnail(mangaId) @@ -133,7 +141,7 @@ class Main { ctx.status(200) } - // adds the manga to category + // list manga's categories app.get("api/v1/manga/:mangaId/category/") { ctx -> val mangaId = ctx.pathParam("mangaId").toInt() ctx.json(getMangaCategories(mangaId)) diff --git a/server/src/main/kotlin/ir/armor/tachidesk/util/Search.kt b/server/src/main/kotlin/ir/armor/tachidesk/util/Search.kt index ed0057a..69b7b20 100644 --- a/server/src/main/kotlin/ir/armor/tachidesk/util/Search.kt +++ b/server/src/main/kotlin/ir/armor/tachidesk/util/Search.kt @@ -18,6 +18,7 @@ fun sourceSearch(sourceId: Long, searchTerm: String, pageNum: Int): PagedMangaLi } fun sourceGlobalSearch(searchTerm: String) { + // TODO } data class FilterWrapper(