mirror of
https://github.com/revanced/revanced-api.git
synced 2025-04-29 22:24:31 +02:00
feat: Move /latest routes to parent
There is only ever current releases, so a latest route doesn't make sense.
This commit is contained in:
parent
e113daa089
commit
4e8e83db1a
@ -16,31 +16,29 @@ import org.koin.ktor.ext.get as koinGet
|
||||
internal fun Route.managerRoute() = route("manager") {
|
||||
val managerService = koinGet<ManagerService>()
|
||||
|
||||
route("latest") {
|
||||
installLatestManagerRouteDocumentation()
|
||||
installManagerRouteDocumentation()
|
||||
|
||||
rateLimit(RateLimitName("weak")) {
|
||||
get {
|
||||
call.respond(managerService.latestRelease())
|
||||
}
|
||||
|
||||
route("version") {
|
||||
installManagerVersionRouteDocumentation()
|
||||
|
||||
rateLimit(RateLimitName("weak")) {
|
||||
get {
|
||||
call.respond(managerService.latestRelease())
|
||||
}
|
||||
|
||||
route("version") {
|
||||
installLatestManagerVersionRouteDocumentation()
|
||||
|
||||
get {
|
||||
call.respond(managerService.latestVersion())
|
||||
}
|
||||
call.respond(managerService.latestVersion())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun Route.installLatestManagerRouteDocumentation() = installNotarizedRoute {
|
||||
private fun Route.installManagerRouteDocumentation() = installNotarizedRoute {
|
||||
tags = setOf("Manager")
|
||||
|
||||
get = GetInfo.builder {
|
||||
description("Get the latest manager release")
|
||||
summary("Get latest manager release")
|
||||
description("Get the current manager release")
|
||||
summary("Get current manager release")
|
||||
response {
|
||||
description("The latest manager release")
|
||||
mediaTypes("application/json")
|
||||
@ -50,14 +48,14 @@ private fun Route.installLatestManagerRouteDocumentation() = installNotarizedRou
|
||||
}
|
||||
}
|
||||
|
||||
private fun Route.installLatestManagerVersionRouteDocumentation() = installNotarizedRoute {
|
||||
private fun Route.installManagerVersionRouteDocumentation() = installNotarizedRoute {
|
||||
tags = setOf("Manager")
|
||||
|
||||
get = GetInfo.builder {
|
||||
description("Get the latest manager release version")
|
||||
summary("Get latest manager release version")
|
||||
description("Get the current manager release version")
|
||||
summary("Get current manager release version")
|
||||
response {
|
||||
description("The latest manager release version")
|
||||
description("The current manager release version")
|
||||
mediaTypes("application/json")
|
||||
responseCode(HttpStatusCode.OK)
|
||||
responseType<APIReleaseVersion>()
|
||||
|
@ -19,30 +19,28 @@ import org.koin.ktor.ext.get as koinGet
|
||||
internal fun Route.patchesRoute() = route("patches") {
|
||||
val patchesService = koinGet<PatchesService>()
|
||||
|
||||
route("latest") {
|
||||
installLatestPatchesRouteDocumentation()
|
||||
installPatchesRouteDocumentation()
|
||||
|
||||
rateLimit(RateLimitName("weak")) {
|
||||
get {
|
||||
call.respond(patchesService.latestRelease())
|
||||
}
|
||||
|
||||
route("version") {
|
||||
installLatestPatchesVersionRouteDocumentation()
|
||||
|
||||
get {
|
||||
call.respond(patchesService.latestVersion())
|
||||
}
|
||||
}
|
||||
rateLimit(RateLimitName("weak")) {
|
||||
get {
|
||||
call.respond(patchesService.latestRelease())
|
||||
}
|
||||
|
||||
rateLimit(RateLimitName("strong")) {
|
||||
route("list") {
|
||||
installLatestPatchesListRouteDocumentation()
|
||||
route("version") {
|
||||
installPatchesVersionRouteDocumentation()
|
||||
|
||||
get {
|
||||
call.respondBytes(ContentType.Application.Json) { patchesService.list() }
|
||||
}
|
||||
get {
|
||||
call.respond(patchesService.latestVersion())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rateLimit(RateLimitName("strong")) {
|
||||
route("list") {
|
||||
installPatchesListRouteDocumentation()
|
||||
|
||||
get {
|
||||
call.respondBytes(ContentType.Application.Json) { patchesService.list() }
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -60,14 +58,14 @@ internal fun Route.patchesRoute() = route("patches") {
|
||||
}
|
||||
}
|
||||
|
||||
private fun Route.installLatestPatchesRouteDocumentation() = installNotarizedRoute {
|
||||
private fun Route.installPatchesRouteDocumentation() = installNotarizedRoute {
|
||||
tags = setOf("Patches")
|
||||
|
||||
get = GetInfo.builder {
|
||||
description("Get the latest patches release")
|
||||
summary("Get latest patches release")
|
||||
description("Get the current patches release")
|
||||
summary("Get current patches release")
|
||||
response {
|
||||
description("The latest patches release")
|
||||
description("The current patches release")
|
||||
mediaTypes("application/json")
|
||||
responseCode(HttpStatusCode.OK)
|
||||
responseType<APIRelease<APIPatchesAsset>>()
|
||||
@ -75,14 +73,14 @@ private fun Route.installLatestPatchesRouteDocumentation() = installNotarizedRou
|
||||
}
|
||||
}
|
||||
|
||||
private fun Route.installLatestPatchesVersionRouteDocumentation() = installNotarizedRoute {
|
||||
private fun Route.installPatchesVersionRouteDocumentation() = installNotarizedRoute {
|
||||
tags = setOf("Patches")
|
||||
|
||||
get = GetInfo.builder {
|
||||
description("Get the latest patches release version")
|
||||
summary("Get latest patches release version")
|
||||
description("Get the current patches release version")
|
||||
summary("Get current patches release version")
|
||||
response {
|
||||
description("The latest patches release version")
|
||||
description("The current patches release version")
|
||||
mediaTypes("application/json")
|
||||
responseCode(HttpStatusCode.OK)
|
||||
responseType<APIReleaseVersion>()
|
||||
@ -90,12 +88,12 @@ private fun Route.installLatestPatchesVersionRouteDocumentation() = installNotar
|
||||
}
|
||||
}
|
||||
|
||||
private fun Route.installLatestPatchesListRouteDocumentation() = installNotarizedRoute {
|
||||
private fun Route.installPatchesListRouteDocumentation() = installNotarizedRoute {
|
||||
tags = setOf("Patches")
|
||||
|
||||
get = GetInfo.builder {
|
||||
description("Get the list of patches from the latest patches release")
|
||||
summary("Get list of patches from latest patches release")
|
||||
description("Get the list of patches from the current patches release")
|
||||
summary("Get list of patches from current patches release")
|
||||
response {
|
||||
description("The list of patches")
|
||||
mediaTypes("application/json")
|
||||
|
Loading…
x
Reference in New Issue
Block a user