[+] API documentation

This commit is contained in:
Azalea
2024-02-28 20:45:38 -05:00
parent 59b52b8a47
commit 5f4a7cd7c9
3 changed files with 15 additions and 3 deletions

View File

@@ -21,6 +21,13 @@ typealias API = RequestMapping
typealias Str = String
typealias Bool = Boolean
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.RUNTIME)
annotation class Doc(
val desc: String,
val ret: String = ""
)
// Make it easier to throw a ResponseStatusException
operator fun HttpStatus.invoke(message: String? = null): Nothing = throw ApiException(value(), message ?: this.reasonPhrase)
operator fun Int.minus(message: String): Nothing = throw ApiException(this, message)