From a06d710f7a42047c57bbe490e450a0fc85c2df5c Mon Sep 17 00:00:00 2001 From: Kirill Kamakin Date: Sat, 29 Oct 2022 19:59:09 +0200 Subject: [PATCH] Use V1 model for authentication --- .../kirmanak/mealient/datasource/v1/MealieServiceV1.kt | 4 ++-- .../datasource/v1/models/GetTokenResponseV1.kt | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 datasource/src/main/kotlin/gq/kirmanak/mealient/datasource/v1/models/GetTokenResponseV1.kt diff --git a/datasource/src/main/kotlin/gq/kirmanak/mealient/datasource/v1/MealieServiceV1.kt b/datasource/src/main/kotlin/gq/kirmanak/mealient/datasource/v1/MealieServiceV1.kt index e9b658c..e441396 100644 --- a/datasource/src/main/kotlin/gq/kirmanak/mealient/datasource/v1/MealieServiceV1.kt +++ b/datasource/src/main/kotlin/gq/kirmanak/mealient/datasource/v1/MealieServiceV1.kt @@ -2,9 +2,9 @@ package gq.kirmanak.mealient.datasource.v1 import gq.kirmanak.mealient.datasource.DataSourceModule.Companion.AUTHORIZATION_HEADER_NAME import gq.kirmanak.mealient.datasource.v0.models.AddRecipeRequestV0 -import gq.kirmanak.mealient.datasource.v0.models.GetTokenResponseV0 import gq.kirmanak.mealient.datasource.v1.models.GetRecipeResponseV1 import gq.kirmanak.mealient.datasource.v1.models.GetRecipesResponseV1 +import gq.kirmanak.mealient.datasource.v1.models.GetTokenResponseV1 import gq.kirmanak.mealient.datasource.v1.models.VersionResponseV1 import retrofit2.http.* @@ -16,7 +16,7 @@ interface MealieServiceV1 { @Url url: String, @Field("username") username: String, @Field("password") password: String, - ): GetTokenResponseV0 + ): GetTokenResponseV1 @POST suspend fun addRecipe( diff --git a/datasource/src/main/kotlin/gq/kirmanak/mealient/datasource/v1/models/GetTokenResponseV1.kt b/datasource/src/main/kotlin/gq/kirmanak/mealient/datasource/v1/models/GetTokenResponseV1.kt new file mode 100644 index 0000000..b603283 --- /dev/null +++ b/datasource/src/main/kotlin/gq/kirmanak/mealient/datasource/v1/models/GetTokenResponseV1.kt @@ -0,0 +1,10 @@ +package gq.kirmanak.mealient.datasource.v1.models + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class GetTokenResponseV1( + @SerialName("access_token") val accessToken: String, + @SerialName("token_type") val tokenType: String, +) \ No newline at end of file