-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
51 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.fuchss.matrix.mensa.api | ||
|
||
/** | ||
* This class represents a canteen with food. | ||
* @param[id] the unique id of the canteen | ||
* @param[name] a nice readable name of the canteen | ||
*/ | ||
data class Canteen( | ||
val id: String, | ||
val name: String | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.fuchss.matrix.mensa.api | ||
|
||
import kotlinx.datetime.Clock | ||
import kotlinx.datetime.LocalDate | ||
import kotlinx.datetime.TimeZone | ||
import kotlinx.datetime.todayIn | ||
|
||
/** | ||
* This interface defines the minimum functionality that a canteen provides. | ||
*/ | ||
interface CanteenAPI { | ||
suspend fun foodToday() = foodAtDate(Clock.System.todayIn(TimeZone.currentSystemDefault())) | ||
|
||
/** | ||
* Retrieve foods of different canteens at a certain date. | ||
* @param[date] the date to consider | ||
* @return a map that contains canteens with food mapped to their lines at a certain day | ||
* (remember: the key (canteen) may contain more information than the value (list of canteen lines)) | ||
*/ | ||
suspend fun foodAtDate(date: LocalDate): Map<Canteen, List<CanteenLine>> | ||
} |
4 changes: 2 additions & 2 deletions
4
.../org/fuchss/matrix/mensa/api/MensaLine.kt → ...rg/fuchss/matrix/mensa/api/CanteenLine.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
package org.fuchss.matrix.mensa.api | ||
|
||
/** | ||
* This class defines a mensa line that serves food. | ||
* This class defines a canteen line that serves food. | ||
* @param[name] the name of the line | ||
* @param[meals] the food the line serves | ||
*/ | ||
data class MensaLine(val name: String, val meals: List<Meal>) | ||
data class CanteenLine(val name: String, val meals: List<Meal>) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters