You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

124 lines
4.6 KiB

* TheCitadelofRicks
* Copyright 2019-2020 <>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
package org.mosad.thecitadelofricks
import org.mosad.thecitadelofricks.controller.CacheController
import org.mosad.thecitadelofricks.controller.CacheController.Companion.courseList
import org.mosad.thecitadelofricks.controller.CacheController.Companion.getLesson
import org.mosad.thecitadelofricks.controller.CacheController.Companion.getLessonSubjectList
import org.mosad.thecitadelofricks.controller.CacheController.Companion.getTimetable
import org.mosad.thecitadelofricks.controller.CacheController.Companion.mensaMenu
import org.mosad.thecitadelofricks.controller.StartupController
import org.mosad.thecitadelofricks.controller.StatusController.Companion.getStatus
import org.mosad.thecitadelofricks.controller.StatusController.Companion.updateCourseListRequests
import org.mosad.thecitadelofricks.controller.StatusController.Companion.updateMensaMenuRequests
import org.mosad.thecitadelofricks.controller.StatusController.Companion.updateTimetableRequests
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RestController
import java.time.LocalDateTime
import java.util.*
class APIController {
private val logger: Logger = LoggerFactory.getLogger(
companion object {
const val apiVersion = "1.1.4"
const val softwareVersion = "1.2.2"
val startTime = System.currentTimeMillis() / 1000
init {
// TODO remove this with API version 2.0.0
@Deprecated("courses is replaced by courseList", replaceWith = ReplaceWith("courseList()"))
fun courses(): CoursesList {
return courseList()
fun courseList(): CoursesList {"courseList request at ${}!")
return courseList
fun mensamenu(): MensaMenu {"mensamenu request at ${}!")
return mensaMenu
fun timetable(
@RequestParam(value = "courseName", defaultValue = "AI4") courseName: String,
@RequestParam(value = "week", defaultValue = "0") week: Int
): TimetableCourseWeek {"timetable request at ${}!")
return getTimetable(courseName, week)
fun lessonSubjectList(
@RequestParam(value = "courseName", defaultValue = "AI4") courseName: String,
@RequestParam(value = "week", defaultValue = "0") week: Int
): HashSet<String> {"lessonSubjectList request at ${}!")
return getLessonSubjectList(courseName, week)
fun lesson(
@RequestParam(value = "courseName", defaultValue = "AI4") courseName: String,
@RequestParam(value = "lessonSubject", defaultValue = "Mathematik 4") lessonSubject: String,
@RequestParam(value = "week", defaultValue = "0") week: Int
): ArrayList<Lesson> {"lesson request at ${}!")
return getLesson(courseName, lessonSubject, week)
fun status(): Status {"status request at ${}!")
return getStatus()
fun health(): Int {"health request at ${}!")
return 200

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close