-
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
12 changed files
with
203 additions
and
77 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
16 changes: 0 additions & 16 deletions
16
library/src/commonMain/kotlin/io/wellmate/api/client/app/IngredientFields.kt
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
library/src/commonMain/kotlin/io/wellmate/api/client/app/MealFields.kt
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
library/src/commonMain/kotlin/io/wellmate/api/client/entry/Entry.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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package io.wellmate.api.client.entry | ||
|
||
import kotlinx.datetime.LocalDateTime | ||
import kotlinx.datetime.serializers.LocalDateTimeIso8601Serializer | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
|
||
interface EntryBaseFieldsClient { | ||
val timestamp: LocalDateTime | ||
} | ||
|
||
|
||
interface EntryBase : EntryBaseFieldsClient { | ||
val id: Int | ||
val userId: Int | ||
|
||
val added: LocalDateTime | ||
} | ||
|
||
@Serializable | ||
enum class EntryType { | ||
@SerialName("meal") | ||
MEAL, | ||
|
||
@SerialName("timer") | ||
TIMER, | ||
} | ||
|
||
@Serializable | ||
data class Entry( | ||
val id: Int, | ||
@Serializable(with = LocalDateTimeIso8601Serializer::class) val added: LocalDateTime, | ||
@SerialName("user_id") val userId: Int, | ||
@Serializable(with = LocalDateTimeIso8601Serializer::class) val timestamp: LocalDateTime, | ||
val type: EntryType, | ||
) |
31 changes: 31 additions & 0 deletions
31
library/src/commonMain/kotlin/io/wellmate/api/client/entry/Ingredient.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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package io.wellmate.api.client.entry | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
|
||
@Serializable | ||
data class IngredientFields( | ||
val name: String, | ||
|
||
val amount: Float, | ||
|
||
val kilocalories: Int, | ||
val proteins: Float, | ||
val carbohydrates: Float, | ||
val fats: Float, | ||
val sugars: Float, | ||
) | ||
|
||
@Serializable | ||
data class Ingredient( | ||
val id: Int, | ||
|
||
val name: String, | ||
val amount: Float, | ||
|
||
val kilocalories: Int, | ||
val proteins: Float, | ||
val carbohydrates: Float, | ||
val fats: Float, | ||
val sugars: Float, | ||
) |
37 changes: 37 additions & 0 deletions
37
library/src/commonMain/kotlin/io/wellmate/api/client/entry/Meal.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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package io.wellmate.api.client.entry | ||
|
||
import kotlinx.datetime.LocalDateTime | ||
import kotlinx.datetime.serializers.LocalDateTimeIso8601Serializer | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
interface MealInterface { | ||
val name: String | ||
val ingredients: List<Any> | ||
} | ||
|
||
@Serializable | ||
data class MealFields( | ||
override val name: String, | ||
override val ingredients: List<IngredientFields>, | ||
) : MealInterface | ||
|
||
@Serializable | ||
data class MealFieldsClient( | ||
@Serializable(with = LocalDateTimeIso8601Serializer::class) override val timestamp: LocalDateTime, | ||
|
||
override val name: String, | ||
override val ingredients: List<IngredientFields>, | ||
) : EntryBaseFieldsClient, MealInterface | ||
|
||
@Serializable | ||
data class Meal( | ||
override val id: Int, | ||
@SerialName("user_id") override val userId: Int, | ||
|
||
@Serializable(with = LocalDateTimeIso8601Serializer::class) override val added: LocalDateTime, | ||
@Serializable(with = LocalDateTimeIso8601Serializer::class) override val timestamp: LocalDateTime, | ||
|
||
override val name: String, | ||
override val ingredients: List<Ingredient>, | ||
) : EntryBase, MealInterface |
29 changes: 29 additions & 0 deletions
29
library/src/commonMain/kotlin/io/wellmate/api/client/entry/Timer.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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package io.wellmate.api.client.entry | ||
|
||
import kotlinx.datetime.LocalDateTime | ||
import kotlinx.datetime.serializers.LocalDateTimeIso8601Serializer | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
interface TimerInterface { | ||
val duration: Int | ||
} | ||
|
||
@Serializable | ||
data class TimerFieldsClient( | ||
@Serializable(with = LocalDateTimeIso8601Serializer::class) override val timestamp: LocalDateTime, | ||
|
||
override val duration: Int, | ||
) : EntryBaseFieldsClient, TimerInterface | ||
|
||
|
||
@Serializable | ||
data class Timer( | ||
override val id: Int, | ||
@SerialName("user_id") override val userId: Int, | ||
|
||
@Serializable(with = LocalDateTimeIso8601Serializer::class) override val timestamp: LocalDateTime, | ||
@Serializable(with = LocalDateTimeIso8601Serializer::class) override val added: LocalDateTime, | ||
|
||
override val duration: Int, | ||
) : EntryBase, TimerInterface |
2 changes: 1 addition & 1 deletion
2
...tlin/io/wellmate/api/client/auth/Email.kt → .../io/wellmate/api/client/generics/Email.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
2 changes: 1 addition & 1 deletion
2
...lin/io/wellmate/api/client/app/Message.kt → ...o/wellmate/api/client/generics/Message.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
9 changes: 6 additions & 3 deletions
9
library/src/commonMain/kotlin/io/wellmate/api/client/userData/UserInfo.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
Oops, something went wrong.