@@ -17,17 +17,26 @@ import kotlin.time.Duration.Companion.days
17
17
import org.koin.ktor.ext.get as koinGet
18
18
19
19
internal fun Route.patchesRoute () = route(" patches" ) {
20
+ configure()
21
+
22
+ // TODO: Remove this deprecated route eventually.
23
+ route(" latest" ) {
24
+ configure(deprecated = true )
25
+ }
26
+ }
27
+
28
+ private fun Route.configure (deprecated : Boolean = false) {
20
29
val patchesService = koinGet<PatchesService >()
21
30
22
- installPatchesRouteDocumentation()
31
+ installPatchesRouteDocumentation(deprecated )
23
32
24
33
rateLimit(RateLimitName (" weak" )) {
25
34
get {
26
35
call.respond(patchesService.latestRelease())
27
36
}
28
37
29
38
route(" version" ) {
30
- installPatchesVersionRouteDocumentation()
39
+ installPatchesVersionRouteDocumentation(deprecated )
31
40
32
41
get {
33
42
call.respond(patchesService.latestVersion())
@@ -37,7 +46,7 @@ internal fun Route.patchesRoute() = route("patches") {
37
46
38
47
rateLimit(RateLimitName (" strong" )) {
39
48
route(" list" ) {
40
- installPatchesListRouteDocumentation()
49
+ installPatchesListRouteDocumentation(deprecated )
41
50
42
51
get {
43
52
call.respondBytes(ContentType .Application .Json ) { patchesService.list() }
@@ -49,7 +58,7 @@ internal fun Route.patchesRoute() = route("patches") {
49
58
route(" keys" ) {
50
59
installCache(356 .days)
51
60
52
- installPatchesPublicKeyRouteDocumentation()
61
+ installPatchesPublicKeyRouteDocumentation(deprecated )
53
62
54
63
get {
55
64
call.respond(patchesService.publicKeys())
@@ -58,10 +67,11 @@ internal fun Route.patchesRoute() = route("patches") {
58
67
}
59
68
}
60
69
61
- private fun Route.installPatchesRouteDocumentation () = installNotarizedRoute {
70
+ private fun Route.installPatchesRouteDocumentation (deprecated : Boolean ) = installNotarizedRoute {
62
71
tags = setOf (" Patches" )
63
72
64
73
get = GetInfo .builder {
74
+ if (deprecated) isDeprecated()
65
75
description(" Get the current patches release" )
66
76
summary(" Get current patches release" )
67
77
response {
@@ -73,10 +83,11 @@ private fun Route.installPatchesRouteDocumentation() = installNotarizedRoute {
73
83
}
74
84
}
75
85
76
- private fun Route.installPatchesVersionRouteDocumentation () = installNotarizedRoute {
86
+ private fun Route.installPatchesVersionRouteDocumentation (deprecated : Boolean ) = installNotarizedRoute {
77
87
tags = setOf (" Patches" )
78
88
79
89
get = GetInfo .builder {
90
+ if (deprecated) isDeprecated()
80
91
description(" Get the current patches release version" )
81
92
summary(" Get current patches release version" )
82
93
response {
@@ -88,10 +99,11 @@ private fun Route.installPatchesVersionRouteDocumentation() = installNotarizedRo
88
99
}
89
100
}
90
101
91
- private fun Route.installPatchesListRouteDocumentation () = installNotarizedRoute {
102
+ private fun Route.installPatchesListRouteDocumentation (deprecated : Boolean ) = installNotarizedRoute {
92
103
tags = setOf (" Patches" )
93
104
94
105
get = GetInfo .builder {
106
+ if (deprecated) isDeprecated()
95
107
description(" Get the list of patches from the current patches release" )
96
108
summary(" Get list of patches from current patches release" )
97
109
response {
@@ -103,10 +115,11 @@ private fun Route.installPatchesListRouteDocumentation() = installNotarizedRoute
103
115
}
104
116
}
105
117
106
- private fun Route.installPatchesPublicKeyRouteDocumentation () = installNotarizedRoute {
118
+ private fun Route.installPatchesPublicKeyRouteDocumentation (deprecated : Boolean ) = installNotarizedRoute {
107
119
tags = setOf (" Patches" )
108
120
109
121
get = GetInfo .builder {
122
+ if (deprecated) isDeprecated()
110
123
description(" Get the public keys for verifying patches and integrations assets" )
111
124
summary(" Get patches and integrations public keys" )
112
125
response {
0 commit comments