From f5d84fc7963b5a411b8dc7b16331d319bc001d9d Mon Sep 17 00:00:00 2001 From: Kinnera Priya Putti Date: Mon, 30 Dec 2024 09:31:38 +0100 Subject: [PATCH 01/12] Make DesiredState an enum --- .../api/models/ApiUnlockDoorRequest.kt | 38 ++++++++++++++++++- .../api/models/ApiUnlockDoorRequestTest.kt | 6 +-- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/library/src/commonMain/kotlin/com/ioki/passenger/api/models/ApiUnlockDoorRequest.kt b/library/src/commonMain/kotlin/com/ioki/passenger/api/models/ApiUnlockDoorRequest.kt index f05b9e0..e38991a 100644 --- a/library/src/commonMain/kotlin/com/ioki/passenger/api/models/ApiUnlockDoorRequest.kt +++ b/library/src/commonMain/kotlin/com/ioki/passenger/api/models/ApiUnlockDoorRequest.kt @@ -1,9 +1,43 @@ package com.ioki.passenger.api.models +import kotlinx.serialization.KSerializer import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable +import kotlinx.serialization.descriptors.PrimitiveKind +import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor +import kotlinx.serialization.descriptors.SerialDescriptor +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder @Serializable public data class ApiUnlockDoorRequest( - @SerialName(value = "desired_state") val desiredState: String, -) + @SerialName(value = "desired_state") val desiredState: DesiredState, +) { + @Serializable(with = DesiredStateSerializer::class) + public enum class DesiredState { + @SerialName(value = "unlocked") + UNLOCKED, + UNSUPPORTED, + } +} + +internal object DesiredStateSerializer : KSerializer { + override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("DesiredState", PrimitiveKind.STRING) + + override fun serialize(encoder: Encoder, value: ApiUnlockDoorRequest.DesiredState) { + encoder.encodeString( + when (value) { + ApiUnlockDoorRequest.DesiredState.UNLOCKED -> "unlocked" + ApiUnlockDoorRequest.DesiredState.UNSUPPORTED -> "unsupported" + } + ) + } + + override fun deserialize(decoder: Decoder): ApiUnlockDoorRequest.DesiredState { + return when (decoder.decodeString()) { + "unlocked" -> ApiUnlockDoorRequest.DesiredState.UNLOCKED + else -> ApiUnlockDoorRequest.DesiredState.UNSUPPORTED + } + } +} + diff --git a/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiUnlockDoorRequestTest.kt b/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiUnlockDoorRequestTest.kt index d63623e..df6f393 100644 --- a/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiUnlockDoorRequestTest.kt +++ b/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiUnlockDoorRequestTest.kt @@ -7,7 +7,7 @@ internal class ApiUnlockDoorRequestTest : IokiApiModelTest() { fun serialization() { testSerializationWithJsonString( ApiUnlockDoorRequest( - desiredState = "unlocked", + desiredState = ApiUnlockDoorRequest.DesiredState.UNLOCKED, ), unlockDoorRequest, ) @@ -17,7 +17,7 @@ internal class ApiUnlockDoorRequestTest : IokiApiModelTest() { fun serializationMinimal() { testSerializationWithJsonString( ApiUnlockDoorRequest( - desiredState = "locked", + desiredState = ApiUnlockDoorRequest.DesiredState.UNSUPPORTED, ), unlockDoorRequestMinimal, ) @@ -34,6 +34,6 @@ private val unlockDoorRequest = private val unlockDoorRequestMinimal = """ { - "desired_state": "locked" + "desired_state": "unsupported" } """ From b57cab5a0570be2f7905220295f256349a7eb864 Mon Sep 17 00:00:00 2001 From: Kinnera Priya Putti Date: Mon, 30 Dec 2024 09:31:56 +0100 Subject: [PATCH 02/12] Make doorControlAvailable non nullable --- .../kotlin/com/ioki/passenger/api/models/ApiVehicle.kt | 2 +- .../kotlin/com/ioki/passenger/api/models/ModelsHelper.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/src/commonMain/kotlin/com/ioki/passenger/api/models/ApiVehicle.kt b/library/src/commonMain/kotlin/com/ioki/passenger/api/models/ApiVehicle.kt index 4ac9262..51be6bf 100644 --- a/library/src/commonMain/kotlin/com/ioki/passenger/api/models/ApiVehicle.kt +++ b/library/src/commonMain/kotlin/com/ioki/passenger/api/models/ApiVehicle.kt @@ -19,5 +19,5 @@ public data class ApiVehicle( @SerialName(value = "storage_spaces") val storageSpaces: Int, val autonomous: Boolean, @SerialName(value = "supports_door_open_requests") val supportsDoorOpenRequests: Boolean?, - @SerialName(value = "door_control_available") val doorControlAvailable: Boolean?, + @SerialName(value = "door_control_available") val doorControlAvailable: Boolean, ) diff --git a/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ModelsHelper.kt b/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ModelsHelper.kt index 9365701..c5f1f88 100644 --- a/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ModelsHelper.kt +++ b/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ModelsHelper.kt @@ -280,7 +280,7 @@ fun createApiVehicle( storageSpace: Int = 0, autonomous: Boolean = false, supportsDoorOpenRequests: Boolean? = null, - doorControlAvailable: Boolean? = null, + doorControlAvailable: Boolean = false, ): ApiVehicle = ApiVehicle( licensePlate = licensePlate, nickname = nickname, From 7b824d947d4eb6435b87ca583c9ea59944e0f7ba Mon Sep 17 00:00:00 2001 From: Kinnera Priya Putti Date: Mon, 30 Dec 2024 09:39:41 +0100 Subject: [PATCH 03/12] Replace other with custom urls in ApiProvider --- .../kotlin/com/ioki/passenger/api/models/ApiProvider.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/library/src/commonMain/kotlin/com/ioki/passenger/api/models/ApiProvider.kt b/library/src/commonMain/kotlin/com/ioki/passenger/api/models/ApiProvider.kt index 23f684d..065ee6b 100644 --- a/library/src/commonMain/kotlin/com/ioki/passenger/api/models/ApiProvider.kt +++ b/library/src/commonMain/kotlin/com/ioki/passenger/api/models/ApiProvider.kt @@ -28,8 +28,15 @@ public data class ApiProvider( val avatar: ApiAvatar?, @SerialName(value = "avatar_darkmode") val avatarDarkmode: ApiAvatar?, - @SerialName(value = "other_url") val otherUrl: String?, + @SerialName(value = "custom_urls") val customUrls: List, ) { + @Serializable + public data class CustomUrl( + val name: String, + val url: String, + @SerialName(value = "sort_key") val sortKey: Int, + ) + @Serializable public data class CreditOptions( val packages: List, From cd08b68d414a7a43ca91bdfe1ed0e7709fb4ad98 Mon Sep 17 00:00:00 2001 From: Kinnera Priya Putti Date: Mon, 30 Dec 2024 09:39:47 +0100 Subject: [PATCH 04/12] Fix tests --- .../api/models/ApiBootstrapResponseTest.kt | 1 + .../passenger/api/models/ApiProviderTest.kt | 18 ++++++++++++++++-- .../ioki/passenger/api/models/ModelsHelper.kt | 4 ++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiBootstrapResponseTest.kt b/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiBootstrapResponseTest.kt index ea310e7..b80bdbd 100644 --- a/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiBootstrapResponseTest.kt +++ b/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiBootstrapResponseTest.kt @@ -39,6 +39,7 @@ private val bootstrap = "service_credit_payment_method_types": [], "personal_discount_payment_method_types": [], "tip_payment_method_types": [], + "custom_urls": [], "features": { "non_purchasable_personal_discounts" : false, "payment":false, diff --git a/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiProviderTest.kt b/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiProviderTest.kt index 826c3b6..9daa8a7 100644 --- a/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiProviderTest.kt +++ b/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiProviderTest.kt @@ -34,7 +34,13 @@ internal class ApiProviderTest : IokiApiModelTest() { features = ApiProvider.Features.NONE, avatar = null, avatarDarkmode = null, - otherUrl = "otherUrl", + customUrls = listOf( + ApiProvider.CustomUrl( + name = "other", + url = "otherUrl", + sortKey = 0, + ), + ) ), provider, ) @@ -92,7 +98,13 @@ private val provider = ] }, "stripe_account_id": "AccountId", - "other_url": "otherUrl", + "custom_urls": [ + { + "name": "other", + "url": "otherUrl", + "sort_key": 0 + } + ], "features": { "non_purchasable_personal_discounts": false, "payment": false, @@ -120,6 +132,7 @@ private val providerMinimal = "service_credit_payment_method_types": [], "personal_discount_payment_method_types": [], "tip_payment_method_types": [], + "custom_urls": [], "features": { "non_purchasable_personal_discounts": false, "payment": false, @@ -148,6 +161,7 @@ private val providerStripeTypesWithWrongTypeMinimal = "personal_discount_payment_method_types": [], "tip_payment_method_types": [], "stripe_payment_method_types": ["undefined", "card", "sepa_debit"], + "custom_urls": [], "features": { "non_purchasable_personal_discounts": false, "payment": false, diff --git a/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ModelsHelper.kt b/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ModelsHelper.kt index 9365701..0d74155 100644 --- a/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ModelsHelper.kt +++ b/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ModelsHelper.kt @@ -19,7 +19,7 @@ fun createApiProvider( stripeAccountId: String? = null, avatar: ApiAvatar? = null, avatarDarkmode: ApiAvatar? = null, - otherUrl: String? = null, + customUrls: List = emptyList(), ): ApiProvider = ApiProvider( name = name, paymentServiceProvider = paymentServiceProvider, @@ -35,7 +35,7 @@ fun createApiProvider( stripeAccountId = stripeAccountId, avatar = avatar, avatarDarkmode = avatarDarkmode, - otherUrl = otherUrl, + customUrls = customUrls, ) fun createApiClientInfo( From 83cc51a05f03b4957dc68a63612d7a54abe5505f Mon Sep 17 00:00:00 2001 From: Kinnera Priya Putti Date: Mon, 30 Dec 2024 09:43:27 +0100 Subject: [PATCH 05/12] fix test --- .../com/ioki/passenger/api/models/ApiRideResponseTest.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiRideResponseTest.kt b/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiRideResponseTest.kt index 9450777..b3893f8 100644 --- a/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiRideResponseTest.kt +++ b/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiRideResponseTest.kt @@ -395,7 +395,8 @@ private val rideResponse = "operator_information":"Operated by Ioki", "seats": 5, "storage_spaces": 3, - "autonomous": false + "autonomous": false, + "door_control_available": false }, "driver": { "display_name": "John Doe", From 8c8a83df80a96ac8526da1c3a356092706247db2 Mon Sep 17 00:00:00 2001 From: Kinnera Priya Putti Date: Mon, 30 Dec 2024 09:44:25 +0100 Subject: [PATCH 06/12] fix lint --- .../kotlin/com/ioki/passenger/api/models/ApiProviderTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiProviderTest.kt b/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiProviderTest.kt index 9daa8a7..8cabb23 100644 --- a/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiProviderTest.kt +++ b/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiProviderTest.kt @@ -40,7 +40,7 @@ internal class ApiProviderTest : IokiApiModelTest() { url = "otherUrl", sortKey = 0, ), - ) + ), ), provider, ) From c94609ede89c2224a05b348bc9f813480424696c Mon Sep 17 00:00:00 2001 From: Kinnera Priya Putti Date: Mon, 30 Dec 2024 09:46:43 +0100 Subject: [PATCH 07/12] fix lint --- .../com/ioki/passenger/api/models/ApiUnlockDoorRequest.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/library/src/commonMain/kotlin/com/ioki/passenger/api/models/ApiUnlockDoorRequest.kt b/library/src/commonMain/kotlin/com/ioki/passenger/api/models/ApiUnlockDoorRequest.kt index e38991a..a839e09 100644 --- a/library/src/commonMain/kotlin/com/ioki/passenger/api/models/ApiUnlockDoorRequest.kt +++ b/library/src/commonMain/kotlin/com/ioki/passenger/api/models/ApiUnlockDoorRequest.kt @@ -29,7 +29,7 @@ internal object DesiredStateSerializer : KSerializer "unlocked" ApiUnlockDoorRequest.DesiredState.UNSUPPORTED -> "unsupported" - } + }, ) } @@ -40,4 +40,3 @@ internal object DesiredStateSerializer : KSerializer Date: Wed, 8 Jan 2025 15:39:00 +0100 Subject: [PATCH 08/12] Rename to ApiDoorRequest --- .../kotlin/com/ioki/passenger/api/IokiService.kt | 7 +++---- .../ioki/passenger/api/internal/api/IokiApi.kt | 4 ++-- ...ApiUnlockDoorRequest.kt => ApiDoorRequest.kt} | 16 ++++++++-------- .../api/models/ApiUnlockDoorRequestTest.kt | 8 ++++---- 4 files changed, 17 insertions(+), 18 deletions(-) rename library/src/commonMain/kotlin/com/ioki/passenger/api/models/{ApiUnlockDoorRequest.kt => ApiDoorRequest.kt} (62%) diff --git a/library/src/commonMain/kotlin/com/ioki/passenger/api/IokiService.kt b/library/src/commonMain/kotlin/com/ioki/passenger/api/IokiService.kt index 871de46..1d12aea 100644 --- a/library/src/commonMain/kotlin/com/ioki/passenger/api/IokiService.kt +++ b/library/src/commonMain/kotlin/com/ioki/passenger/api/IokiService.kt @@ -68,7 +68,7 @@ import com.ioki.passenger.api.models.ApiTicketingProductFilterType import com.ioki.passenger.api.models.ApiTicketingProductResponse import com.ioki.passenger.api.models.ApiTicketingVoucherResponse import com.ioki.passenger.api.models.ApiTipResponse -import com.ioki.passenger.api.models.ApiUnlockDoorRequest +import com.ioki.passenger.api.models.ApiDoorRequest import com.ioki.passenger.api.models.ApiUpdatePassengersForRideRequest import com.ioki.passenger.api.models.ApiUpdatePhoneNumberRequest import com.ioki.passenger.api.models.ApiUpdateUserNotificationSettingsRequest @@ -80,7 +80,6 @@ import com.ioki.passenger.api.result.ApiResult import com.ioki.passenger.api.result.Error import com.ioki.passenger.api.result.HttpStatusCode import com.ioki.passenger.api.result.SuccessData -import com.ioki.result.Result import io.ktor.client.call.body import io.ktor.client.statement.HttpResponse import io.ktor.http.isSuccess @@ -242,7 +241,7 @@ public interface RideService { public suspend fun inquireRide(request: ApiRideInquiryRequest): ApiResult - public suspend fun unlockDoor(rideId: String, request: ApiUnlockDoorRequest): ApiResult + public suspend fun unlockDoor(rideId: String, request: ApiDoorRequest): ApiResult } public interface RideSeriesService { @@ -526,7 +525,7 @@ private class DefaultIokiService( ) } - override suspend fun unlockDoor(rideId: String, request: ApiUnlockDoorRequest): ApiResult = + override suspend fun unlockDoor(rideId: String, request: ApiDoorRequest): ApiResult = apiCall { unlockDoor(accessToken, rideId, ApiBody(request)) } override suspend fun inquireRide(request: ApiRideInquiryRequest): ApiResult = diff --git a/library/src/commonMain/kotlin/com/ioki/passenger/api/internal/api/IokiApi.kt b/library/src/commonMain/kotlin/com/ioki/passenger/api/internal/api/IokiApi.kt index ac732d3..f8731db 100644 --- a/library/src/commonMain/kotlin/com/ioki/passenger/api/internal/api/IokiApi.kt +++ b/library/src/commonMain/kotlin/com/ioki/passenger/api/internal/api/IokiApi.kt @@ -28,7 +28,7 @@ import com.ioki.passenger.api.models.ApiRideInquiryRequest import com.ioki.passenger.api.models.ApiRideRequest import com.ioki.passenger.api.models.ApiRideSeriesRequest import com.ioki.passenger.api.models.ApiSignUpRequest -import com.ioki.passenger.api.models.ApiUnlockDoorRequest +import com.ioki.passenger.api.models.ApiDoorRequest import com.ioki.passenger.api.models.ApiUpdatePassengersForRideRequest import com.ioki.passenger.api.models.ApiUpdatePhoneNumberRequest import com.ioki.passenger.api.models.ApiUpdateUserNotificationSettingsRequest @@ -311,7 +311,7 @@ internal class IokiApi(private val client: IokiHttpClient) { setBody(body) } - suspend fun unlockDoor(accessToken: String, rideId: String, body: ApiBody): HttpResponse = + suspend fun unlockDoor(accessToken: String, rideId: String, body: ApiBody): HttpResponse = client.post("/api/passenger/rides/$rideId/vehicle/hardware/door_state_change_request") { header("Authorization", accessToken) setBody(body) diff --git a/library/src/commonMain/kotlin/com/ioki/passenger/api/models/ApiUnlockDoorRequest.kt b/library/src/commonMain/kotlin/com/ioki/passenger/api/models/ApiDoorRequest.kt similarity index 62% rename from library/src/commonMain/kotlin/com/ioki/passenger/api/models/ApiUnlockDoorRequest.kt rename to library/src/commonMain/kotlin/com/ioki/passenger/api/models/ApiDoorRequest.kt index a839e09..b660cd1 100644 --- a/library/src/commonMain/kotlin/com/ioki/passenger/api/models/ApiUnlockDoorRequest.kt +++ b/library/src/commonMain/kotlin/com/ioki/passenger/api/models/ApiDoorRequest.kt @@ -10,7 +10,7 @@ import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder @Serializable -public data class ApiUnlockDoorRequest( +public data class ApiDoorRequest( @SerialName(value = "desired_state") val desiredState: DesiredState, ) { @Serializable(with = DesiredStateSerializer::class) @@ -21,22 +21,22 @@ public data class ApiUnlockDoorRequest( } } -internal object DesiredStateSerializer : KSerializer { +internal object DesiredStateSerializer : KSerializer { override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("DesiredState", PrimitiveKind.STRING) - override fun serialize(encoder: Encoder, value: ApiUnlockDoorRequest.DesiredState) { + override fun serialize(encoder: Encoder, value: ApiDoorRequest.DesiredState) { encoder.encodeString( when (value) { - ApiUnlockDoorRequest.DesiredState.UNLOCKED -> "unlocked" - ApiUnlockDoorRequest.DesiredState.UNSUPPORTED -> "unsupported" + ApiDoorRequest.DesiredState.UNLOCKED -> "unlocked" + ApiDoorRequest.DesiredState.UNSUPPORTED -> "unsupported" }, ) } - override fun deserialize(decoder: Decoder): ApiUnlockDoorRequest.DesiredState { + override fun deserialize(decoder: Decoder): ApiDoorRequest.DesiredState { return when (decoder.decodeString()) { - "unlocked" -> ApiUnlockDoorRequest.DesiredState.UNLOCKED - else -> ApiUnlockDoorRequest.DesiredState.UNSUPPORTED + "unlocked" -> ApiDoorRequest.DesiredState.UNLOCKED + else -> ApiDoorRequest.DesiredState.UNSUPPORTED } } } diff --git a/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiUnlockDoorRequestTest.kt b/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiUnlockDoorRequestTest.kt index df6f393..2d49563 100644 --- a/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiUnlockDoorRequestTest.kt +++ b/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiUnlockDoorRequestTest.kt @@ -6,8 +6,8 @@ internal class ApiUnlockDoorRequestTest : IokiApiModelTest() { @Test fun serialization() { testSerializationWithJsonString( - ApiUnlockDoorRequest( - desiredState = ApiUnlockDoorRequest.DesiredState.UNLOCKED, + ApiDoorRequest( + desiredState = ApiDoorRequest.DesiredState.UNLOCKED, ), unlockDoorRequest, ) @@ -16,8 +16,8 @@ internal class ApiUnlockDoorRequestTest : IokiApiModelTest() { @Test fun serializationMinimal() { testSerializationWithJsonString( - ApiUnlockDoorRequest( - desiredState = ApiUnlockDoorRequest.DesiredState.UNSUPPORTED, + ApiDoorRequest( + desiredState = ApiDoorRequest.DesiredState.UNSUPPORTED, ), unlockDoorRequestMinimal, ) From e75d0664633f8e28a924ae3b2407cd56e7e37de8 Mon Sep 17 00:00:00 2001 From: Kinnera Priya Putti Date: Wed, 8 Jan 2025 15:41:56 +0100 Subject: [PATCH 09/12] Make supportsOpenDoorRequests non-nullable and rename --- .../kotlin/com/ioki/passenger/api/models/ApiVehicle.kt | 2 +- .../com/ioki/passenger/api/models/ApiRideResponseTest.kt | 8 ++++---- .../com/ioki/passenger/api/models/ApiVehicleTest.kt | 8 ++++---- .../kotlin/com/ioki/passenger/api/models/ModelsHelper.kt | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/library/src/commonMain/kotlin/com/ioki/passenger/api/models/ApiVehicle.kt b/library/src/commonMain/kotlin/com/ioki/passenger/api/models/ApiVehicle.kt index 51be6bf..cae591a 100644 --- a/library/src/commonMain/kotlin/com/ioki/passenger/api/models/ApiVehicle.kt +++ b/library/src/commonMain/kotlin/com/ioki/passenger/api/models/ApiVehicle.kt @@ -18,6 +18,6 @@ public data class ApiVehicle( val seats: Int, @SerialName(value = "storage_spaces") val storageSpaces: Int, val autonomous: Boolean, - @SerialName(value = "supports_door_open_requests") val supportsDoorOpenRequests: Boolean?, + @SerialName(value = "supports_open_door_requests") val supportsOpenDoorRequests: Boolean, @SerialName(value = "door_control_available") val doorControlAvailable: Boolean, ) diff --git a/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiRideResponseTest.kt b/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiRideResponseTest.kt index b3893f8..138c7e0 100644 --- a/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiRideResponseTest.kt +++ b/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiRideResponseTest.kt @@ -160,7 +160,7 @@ internal class ApiRideResponseTest : IokiApiModelTest() { seats = 5, storageSpaces = 3, autonomous = false, - supportsDoorOpenRequests = false, + supportsOpenDoorRequests = false, doorControlAvailable = false, ), from = createApiLocation( @@ -201,7 +201,7 @@ internal class ApiRideResponseTest : IokiApiModelTest() { seats = 5, storageSpaces = 3, autonomous = false, - supportsDoorOpenRequests = false, + supportsOpenDoorRequests = false, doorControlAvailable = false, ), from = createApiLocation( @@ -503,7 +503,7 @@ private val rideResponse = "seats": 5, "storage_spaces": 3, "autonomous": false, - "supports_door_open_requests": false, + "supports_open_door_requests": false, "door_control_available": false } } @@ -549,7 +549,7 @@ private val rideResponse = "seats": 5, "storage_spaces": 3, "autonomous": false, - "supports_door_open_requests": false, + "supports_open_door_requests": false, "door_control_available": false } } diff --git a/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiVehicleTest.kt b/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiVehicleTest.kt index 6cd34eb..e7f6fb2 100644 --- a/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiVehicleTest.kt +++ b/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiVehicleTest.kt @@ -24,7 +24,7 @@ internal class ApiVehicleTest : IokiApiModelTest() { seats = 5, storageSpaces = 3, autonomous = false, - supportsDoorOpenRequests = false, + supportsOpenDoorRequests = false, doorControlAvailable = false, ), vehicle, @@ -45,7 +45,7 @@ internal class ApiVehicleTest : IokiApiModelTest() { seats = 5, storageSpaces = 3, autonomous = true, - supportsDoorOpenRequests = true, + supportsOpenDoorRequests = true, doorControlAvailable = true, ), vehicleMinimal, @@ -89,7 +89,7 @@ private val vehicle = "seats": 5, "storage_spaces": 3, "autonomous": false, - "supports_door_open_requests": false, + "supports_open_door_requests": false, "door_control_available": false } """ @@ -105,7 +105,7 @@ private val vehicleMinimal = "seats": 5, "storage_spaces": 3, "autonomous": true, - "supports_door_open_requests": true, + "supports_open_door_requests": true, "door_control_available": true } """ diff --git a/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ModelsHelper.kt b/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ModelsHelper.kt index c5f1f88..d09f6c6 100644 --- a/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ModelsHelper.kt +++ b/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ModelsHelper.kt @@ -279,7 +279,7 @@ fun createApiVehicle( seats: Int = 0, storageSpace: Int = 0, autonomous: Boolean = false, - supportsDoorOpenRequests: Boolean? = null, + supportsOpenDoorRequests: Boolean = false, doorControlAvailable: Boolean = false, ): ApiVehicle = ApiVehicle( licensePlate = licensePlate, @@ -292,7 +292,7 @@ fun createApiVehicle( seats = seats, storageSpaces = storageSpace, autonomous = autonomous, - supportsDoorOpenRequests = supportsDoorOpenRequests, + supportsOpenDoorRequests = supportsOpenDoorRequests, doorControlAvailable = doorControlAvailable, ) From 0d73f40375a579256c482fe86561ec14749c5258 Mon Sep 17 00:00:00 2001 From: Kinnera Priya Putti Date: Wed, 8 Jan 2025 15:47:38 +0100 Subject: [PATCH 10/12] fix test --- .../com/ioki/passenger/api/models/ApiRideResponseTest.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiRideResponseTest.kt b/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiRideResponseTest.kt index 138c7e0..5bd363b 100644 --- a/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiRideResponseTest.kt +++ b/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiRideResponseTest.kt @@ -396,7 +396,8 @@ private val rideResponse = "seats": 5, "storage_spaces": 3, "autonomous": false, - "door_control_available": false + "door_control_available": false, + "supports_open_door_requests": false }, "driver": { "display_name": "John Doe", @@ -504,7 +505,7 @@ private val rideResponse = "storage_spaces": 3, "autonomous": false, "supports_open_door_requests": false, - "door_control_available": false + "door_control_available": false, } } ] From 41188949edd60defb16b763ccaece065071d1e15 Mon Sep 17 00:00:00 2001 From: Kinnera Priya Putti Date: Wed, 8 Jan 2025 16:12:20 +0100 Subject: [PATCH 11/12] Add back Result import --- .../commonMain/kotlin/com/ioki/passenger/api/IokiService.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/src/commonMain/kotlin/com/ioki/passenger/api/IokiService.kt b/library/src/commonMain/kotlin/com/ioki/passenger/api/IokiService.kt index 1d12aea..cfa482d 100644 --- a/library/src/commonMain/kotlin/com/ioki/passenger/api/IokiService.kt +++ b/library/src/commonMain/kotlin/com/ioki/passenger/api/IokiService.kt @@ -21,6 +21,7 @@ import com.ioki.passenger.api.models.ApiCreateLogPayPaymentMethodRequest import com.ioki.passenger.api.models.ApiCreateTipRequest import com.ioki.passenger.api.models.ApiDeviceRequest import com.ioki.passenger.api.models.ApiDeviceResponse +import com.ioki.passenger.api.models.ApiDoorRequest import com.ioki.passenger.api.models.ApiErrorBody import com.ioki.passenger.api.models.ApiFailedPaymentRequest import com.ioki.passenger.api.models.ApiFailedPaymentResponse @@ -68,7 +69,6 @@ import com.ioki.passenger.api.models.ApiTicketingProductFilterType import com.ioki.passenger.api.models.ApiTicketingProductResponse import com.ioki.passenger.api.models.ApiTicketingVoucherResponse import com.ioki.passenger.api.models.ApiTipResponse -import com.ioki.passenger.api.models.ApiDoorRequest import com.ioki.passenger.api.models.ApiUpdatePassengersForRideRequest import com.ioki.passenger.api.models.ApiUpdatePhoneNumberRequest import com.ioki.passenger.api.models.ApiUpdateUserNotificationSettingsRequest @@ -80,6 +80,7 @@ import com.ioki.passenger.api.result.ApiResult import com.ioki.passenger.api.result.Error import com.ioki.passenger.api.result.HttpStatusCode import com.ioki.passenger.api.result.SuccessData +import com.ioki.result.Result import io.ktor.client.call.body import io.ktor.client.statement.HttpResponse import io.ktor.http.isSuccess From 334650a70613ffa82fa3000a12fddab1e6760eba Mon Sep 17 00:00:00 2001 From: Kinnera Priya Putti Date: Wed, 8 Jan 2025 17:14:22 +0100 Subject: [PATCH 12/12] remove extra comma --- .../kotlin/com/ioki/passenger/api/models/ApiRideResponseTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiRideResponseTest.kt b/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiRideResponseTest.kt index 5bd363b..a6362a2 100644 --- a/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiRideResponseTest.kt +++ b/library/src/commonTest/kotlin/com/ioki/passenger/api/models/ApiRideResponseTest.kt @@ -505,7 +505,7 @@ private val rideResponse = "storage_spaces": 3, "autonomous": false, "supports_open_door_requests": false, - "door_control_available": false, + "door_control_available": false } } ]