fix(#201): fix platforms endpoint response shape mismatch

GET /api/messaging/platforms returns a JSON object with a platforms
array inside, but the app expected a bare array. Wraps the response
in a new MessagingPlatformResponse model.

- Adds MessagingPlatformResponse.kt wrapper model
- Updates HermesApiService.kt return type + adds profile query param
- Updates ChannelsViewModel.kt to unwrap .platforms
- Updates E2eIntegrationTest.kt mock to match new response shape
This commit is contained in:
M57 committed 2026-06-21 16:03:36 +03:00
1 parent a89b932a0e
commit 35c608b2bf
4 files changed
+19 -4

No files matched your search

@@ -0,0 +1,7 @@
package com.m57.hermescontrol.data.model
data class MessagingPlatformResponse(
val env_path: String,
val gateway_start_command: String,
val platforms: List<MessagingPlatform>,
)
@@ -16,7 +16,7 @@ import com.m57.hermescontrol.data.model.KanbanTask
import com.m57.hermescontrol.data.model.LogResponse
import com.m57.hermescontrol.data.model.McpServerToggleRequest
import com.m57.hermescontrol.data.model.McpServersResponse
import com.m57.hermescontrol.data.model.MessagingPlatform
import com.m57.hermescontrol.data.model.MessagingPlatformResponse
import com.m57.hermescontrol.data.model.MessagingPlatformUpdate
import com.m57.hermescontrol.data.model.ModelOptionsResponse
import com.m57.hermescontrol.data.model.PairingApproveRequest
@@ -253,7 +253,7 @@ interface HermesApiService {
): Response<Unit>
@GET("api/messaging/platforms")
suspend fun getMessagingPlatforms(): Response<List<MessagingPlatform>>
suspend fun getMessagingPlatforms(@Query("profile") profile: String? = null): Response<MessagingPlatformResponse>
@PUT("api/messaging/platforms/{platform_id}")
suspend fun configurePlatform(
@@ -35,7 +35,7 @@ class ChannelsViewModel : ViewModel() {
}
when (result) {
is NetworkResult.Success -> {
_uiState.update { it.copy(isLoading = false, platforms = result.data.orEmpty()) }
_uiState.update { it.copy(isLoading = false, platforms = result.data?.platforms.orEmpty()) }
}
is NetworkResult.Failure -> {