Skip to content

Commit

Permalink
- rollback websocket api request/response naming cause the server ex…
Browse files Browse the repository at this point in the history
…pect that class naming
  • Loading branch information
rodvar committed Dec 11, 2024
1 parent d7e3a7e commit 4fe88d2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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())
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<T>(body)
return decodeFromString
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4fe88d2

Please sign in to comment.