All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.http4k.connect.mattermost.MattermostMoshi.kt Maven / Gradle / Ivy

There is a newer version: 5.25.0.0
Show newest version
package org.http4k.connect.mattermost

import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.Moshi
import org.http4k.connect.mattermost.model.EmojiName
import org.http4k.connect.mattermost.model.HexColour
import org.http4k.connect.mattermost.model.PostActionCookie
import org.http4k.connect.mattermost.model.PostActionId
import org.http4k.connect.mattermost.model.PostActionName
import org.http4k.connect.mattermost.model.PostActionOptionText
import org.http4k.connect.mattermost.model.PostActionOptionValue
import org.http4k.connect.mattermost.model.PostActionStyle
import org.http4k.format.ConfigurableMoshi
import org.http4k.format.asConfigurable
import org.http4k.format.value
import org.http4k.format.withStandardMappings
import se.ansman.kotshi.KotshiJsonAdapterFactory

object MattermostMoshi : ConfigurableMoshi(
    Moshi.Builder()
        .add(MattermostJsonAdapterFactory)
        .asConfigurable()
        .withStandardMappings()
        .value(EmojiName)
        .value(HexColour)
        .value(PostActionId)
        .value(PostActionName)
        .value(PostActionStyle)
        .value(PostActionOptionText)
        .value(PostActionOptionValue)
        .value(PostActionCookie)
        .done()
)

@KotshiJsonAdapterFactory
object MattermostJsonAdapterFactory : JsonAdapter.Factory by KotshiMattermostJsonAdapterFactory




© 2015 - 2024 Weber Informatics LLC | Privacy Policy