refactor(#1375): type profiles.list and profiles.configure RPC params (#1392)

This commit is contained in:
m57 authored and GitHub committed 2026-09-29 23:42:01 +03:00
1 parent 445da9fe14
commit cb0463aefc
7 files changed
+164 -82

No files matched your search

@@ -0,0 +1,16 @@
package com.m57.hermescontrol.data.ws.contract
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.JsonObject
/**
* `profiles.configure` params for the sections the app writes: `ui_meta` and the bot `soul`.
* `profile` is not a field: WsProfileParams injects it when the method is profile scoped.
*/
@Serializable
data class ProfilesConfigureParams(
@SerialName("name") val name: String? = null,
@SerialName("ui_meta") val uiMeta: JsonObject? = null,
@SerialName("soul") val soul: String? = null,
)
@@ -0,0 +1,7 @@
package com.m57.hermescontrol.data.ws.contract
import kotlinx.serialization.Serializable
/** `profiles.list` takes no explicit params here; the active profile is injected by WsProfileParams. */
@Serializable
data object ProfilesListParams
@@ -379,6 +379,22 @@ object RpcMethods {
JsonElement.serializer(),
)
// Passthrough JsonElement results: callers keep their existing legacy decoders.
val PROFILES_LIST: RpcMethod<ProfilesListParams, JsonElement> =
RpcMethod(
WsMethods.PROFILES_LIST,
ProfilesListParams.serializer(),
JsonElement.serializer(),
)
// Passthrough JsonElement results: callers keep their existing legacy decoders.
val PROFILES_CONFIGURE: RpcMethod<ProfilesConfigureParams, JsonElement> =
RpcMethod(
WsMethods.PROFILES_CONFIGURE,
ProfilesConfigureParams.serializer(),
JsonElement.serializer(),
)
/** Every typed method. GatewayContractTest iterates this; future migrations append here. */
val all: List<RpcMethod<*, *>> =
listOf(
@@ -428,5 +444,7 @@ object RpcMethods {
PROCESS_KILL,
PLUGINS_MANAGE,
PROJECTS_LIST,
PROFILES_LIST,
PROFILES_CONFIGURE,
)
}