Save My Wave settings as JSON

settings3 now answers a form body with 415 unsupported-media-type,
so every choice reverted to Any.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
yuriy.pandClaude Opus 5.5 committed 2026-11-04 15:00:57 +06:00
1 parent d65db50bd6
commit 5597c4c235
1 file changed
+8 -8
@@ -239,15 +239,15 @@ class YmClient private constructor(
return WaveSettings.from(first["settings2"] ?: first["settings"]) return WaveSettings.from(first["settings2"] ?: first["settings"])
} }
/** `settings3` takes JSON only: a form body gets `415 unsupported-media-type`. */
suspend fun setWaveSettings(station: String, settings: WaveSettings) { suspend fun setWaveSettings(station: String, settings: WaveSettings) {
val result = http.postForm( val body = buildJsonObject {
"/rotor/station/$station/settings3", put("moodEnergy", settings.mood.api ?: "all")
Params() put("diversity", settings.character.api ?: "default")
.add("moodEnergy", settings.mood.api ?: "all") put("language", settings.language.api ?: "any")
.add("diversity", settings.character.api ?: "default") put("type", "rotor")
.add("type", "rotor") }
.add("language", settings.language.api ?: "any"), val result = http.postJson("/rotor/station/$station/settings3", body)
)
requireAck(result, "station settings") requireAck(result, "station settings")
} }