From 497d652aa83ed81e04f9400ae84362642585dfca Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 6 Oct 2024 22:48:31 +0200 Subject: code cleanup in the chat error repo logic --- .../skyhanni/data/jsonobjects/repo/RepoErrorData.kt | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/data') diff --git a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/RepoErrorData.kt b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/RepoErrorData.kt index 486617651..3ec529db3 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/RepoErrorData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/RepoErrorData.kt @@ -1,10 +1,18 @@ package at.hannibal2.skyhanni.data.jsonobjects.repo import com.google.gson.annotations.Expose +import com.google.gson.annotations.SerializedName -data class RepoErrorData( - @Expose var messageExact: List?, - @Expose var messageStartsWith: List?, - @Expose var replaceMessage: String?, - @Expose var affectedVersions: List = listOf(), +data class RepoErrorJson( + @Expose @SerializedName("changed_error_messages") val changedErrorMessages: List, ) + +data class RepoErrorData( + @Expose @SerializedName("message_exact") private var rawMessageExact: List?, + @Expose @SerializedName("message_starts_with") private var rawMessageStartsWith: List?, + @Expose @SerializedName("replace_message") var replaceMessage: String?, + @Expose @SerializedName("affected_versions") var affectedVersions: List = listOf(), +) { + val messageExact by lazy { rawMessageExact ?: emptyList() } + val messageStartsWith by lazy { rawMessageStartsWith ?: emptyList() } +} -- cgit