From 4fe88d253a0852cb3daca2db1a7ecb6c24f1dc69 Mon Sep 17 00:00:00 2001 From: Rodrigo Varela Date: Wed, 11 Dec 2024 13:23:31 +1100 Subject: [PATCH] - rollback websocket api request/response naming cause the server expect that class naming --- .../network/bisq/mobile/client/di/ClientModule.kt | 8 ++++---- .../client/websocket/api_proxy/WebSocketApiClient.kt | 12 ++++++------ ...ocketApiRequest.kt => WebSocketRestApiRequest.kt} | 2 +- ...ketApiResponse.kt => WebSocketRestApiResponse.kt} | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) rename shared/domain/src/commonMain/kotlin/network/bisq/mobile/client/websocket/messages/{WebSocketApiRequest.kt => WebSocketRestApiRequest.kt} (88%) rename shared/domain/src/commonMain/kotlin/network/bisq/mobile/client/websocket/messages/{WebSocketApiResponse.kt => WebSocketRestApiResponse.kt} (85%) diff --git a/shared/domain/src/commonMain/kotlin/network/bisq/mobile/client/di/ClientModule.kt b/shared/domain/src/commonMain/kotlin/network/bisq/mobile/client/di/ClientModule.kt index e87257d8..bf1a5d8d 100644 --- a/shared/domain/src/commonMain/kotlin/network/bisq/mobile/client/di/ClientModule.kt +++ b/shared/domain/src/commonMain/kotlin/network/bisq/mobile/client/di/ClientModule.kt @@ -23,8 +23,8 @@ import network.bisq.mobile.client.websocket.messages.WebSocketEvent import network.bisq.mobile.client.websocket.messages.WebSocketMessage import network.bisq.mobile.client.websocket.messages.WebSocketRequest import network.bisq.mobile.client.websocket.messages.WebSocketResponse -import network.bisq.mobile.client.websocket.messages.WebSocketApiRequest -import network.bisq.mobile.client.websocket.messages.WebSocketApiResponse +import network.bisq.mobile.client.websocket.messages.WebSocketRestApiRequest +import network.bisq.mobile.client.websocket.messages.WebSocketRestApiResponse import network.bisq.mobile.client.user_profile.ClientUserProfileServiceFacade import network.bisq.mobile.client.user_profile.UserProfileApiGateway import network.bisq.mobile.domain.data.repository.main.bootstrap.ApplicationBootstrapFacade @@ -43,11 +43,11 @@ val clientModule = module { polymorphic(WebSocketMessage::class) { subclass(WebSocketEvent::class, WebSocketEvent.serializer()) polymorphic(WebSocketRequest::class) { - subclass(WebSocketApiRequest::class, WebSocketApiRequest.serializer()) + subclass(WebSocketRestApiRequest::class, WebSocketRestApiRequest.serializer()) subclass(SubscriptionRequest::class, SubscriptionRequest.serializer()) } polymorphic(WebSocketResponse::class) { - subclass(WebSocketApiResponse::class, WebSocketApiResponse.serializer()) + subclass(WebSocketRestApiResponse::class, WebSocketRestApiResponse.serializer()) subclass(SubscriptionResponse::class, SubscriptionResponse.serializer()) } } diff --git a/shared/domain/src/commonMain/kotlin/network/bisq/mobile/client/websocket/api_proxy/WebSocketApiClient.kt b/shared/domain/src/commonMain/kotlin/network/bisq/mobile/client/websocket/api_proxy/WebSocketApiClient.kt index 280c8b79..292878c1 100644 --- a/shared/domain/src/commonMain/kotlin/network/bisq/mobile/client/websocket/api_proxy/WebSocketApiClient.kt +++ b/shared/domain/src/commonMain/kotlin/network/bisq/mobile/client/websocket/api_proxy/WebSocketApiClient.kt @@ -9,8 +9,8 @@ import io.ktor.http.contentType import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json import network.bisq.mobile.client.websocket.WebSocketClient -import network.bisq.mobile.client.websocket.messages.WebSocketApiRequest -import network.bisq.mobile.client.websocket.messages.WebSocketApiResponse +import network.bisq.mobile.client.websocket.messages.WebSocketRestApiRequest +import network.bisq.mobile.client.websocket.messages.WebSocketRestApiResponse import network.bisq.mobile.utils.Logging import kotlin.uuid.ExperimentalUuidApi import kotlin.uuid.Uuid @@ -55,16 +55,16 @@ class WebSocketApiClient( ): T { val requestId = Uuid.random().toString() val fullPath = apiPath + path - val responseClassName = WebSocketApiResponse::class.qualifiedName!! - val webSocketApiRequest = WebSocketApiRequest( + val responseClassName = WebSocketRestApiResponse::class.qualifiedName!! + val webSocketRestApiRequest = WebSocketRestApiRequest( responseClassName, requestId, method, fullPath, bodyAsJson ) - val response = webSocketClient.sendRequestAndAwaitResponse(webSocketApiRequest) - require(response is WebSocketApiResponse) { "Response not of expected type. response=$response" } + val response = webSocketClient.sendRequestAndAwaitResponse(webSocketRestApiRequest) + require(response is WebSocketRestApiResponse) { "Response not of expected type. response=$response" } val body = response.body val decodeFromString = json.decodeFromString(body) return decodeFromString diff --git a/shared/domain/src/commonMain/kotlin/network/bisq/mobile/client/websocket/messages/WebSocketApiRequest.kt b/shared/domain/src/commonMain/kotlin/network/bisq/mobile/client/websocket/messages/WebSocketRestApiRequest.kt similarity index 88% rename from shared/domain/src/commonMain/kotlin/network/bisq/mobile/client/websocket/messages/WebSocketApiRequest.kt rename to shared/domain/src/commonMain/kotlin/network/bisq/mobile/client/websocket/messages/WebSocketRestApiRequest.kt index f6016fca..355ef9f2 100644 --- a/shared/domain/src/commonMain/kotlin/network/bisq/mobile/client/websocket/messages/WebSocketApiRequest.kt +++ b/shared/domain/src/commonMain/kotlin/network/bisq/mobile/client/websocket/messages/WebSocketRestApiRequest.kt @@ -3,7 +3,7 @@ package network.bisq.mobile.client.websocket.messages import kotlinx.serialization.Serializable @Serializable -data class WebSocketApiRequest( +data class WebSocketRestApiRequest( val responseClassName: String, override val requestId: String, val method: String, diff --git a/shared/domain/src/commonMain/kotlin/network/bisq/mobile/client/websocket/messages/WebSocketApiResponse.kt b/shared/domain/src/commonMain/kotlin/network/bisq/mobile/client/websocket/messages/WebSocketRestApiResponse.kt similarity index 85% rename from shared/domain/src/commonMain/kotlin/network/bisq/mobile/client/websocket/messages/WebSocketApiResponse.kt rename to shared/domain/src/commonMain/kotlin/network/bisq/mobile/client/websocket/messages/WebSocketRestApiResponse.kt index 8a110897..9c6596b8 100644 --- a/shared/domain/src/commonMain/kotlin/network/bisq/mobile/client/websocket/messages/WebSocketApiResponse.kt +++ b/shared/domain/src/commonMain/kotlin/network/bisq/mobile/client/websocket/messages/WebSocketRestApiResponse.kt @@ -3,7 +3,7 @@ package network.bisq.mobile.client.websocket.messages import kotlinx.serialization.Serializable @Serializable -data class WebSocketApiResponse( +data class WebSocketRestApiResponse( override val requestId: String, val statusCode: Int, val body: String