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

divkit.dsl.Data.kt Maven / Gradle / Ivy

Go to download

DivKit is an open source Server-Driven UI (SDUI) framework. SDUI is a an emerging technique that leverage the server to build the user interfaces of their mobile app.

There is a newer version: 30.19.0
Show newest version
@file:Suppress(
    "unused",
    "UNUSED_PARAMETER",
)

package divkit.dsl

import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonIgnore
import com.fasterxml.jackson.annotation.JsonValue
import divkit.dsl.annotation.*
import divkit.dsl.core.*
import divkit.dsl.scope.*
import kotlin.Any
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.collections.Map

/**
 * Root structure.
 * 
 * Can be created using the method [data].
 * 
 * Required parameters: `states, log_id`.
 */
@Generated
class Data internal constructor(
    @JsonIgnore
    val properties: Properties,
) {
    @JsonAnyGetter
    internal fun getJsonProperties(): Map = properties.mergeWith(emptyMap())

    class Properties internal constructor(
        /**
         * Logging ID.
         */
        val logId: Property?,
        /**
         * A set of visual element states. Each element can have a few states with a different layout. The states are displayed strictly one by one and switched using [action](div-action.md).
         */
        val states: Property>?,
        /**
         * List of timers.
         */
        val timers: Property>?,
        /**
         * Events that trigger transition animations.
         * Default value: `none`.
         */
        @Deprecated("Marked as deprecated in the JSON schema ")
        val transitionAnimationSelector: Property?,
        /**
         * Triggers for changing variables.
         */
        val variableTriggers: Property>?,
        /**
         * Declaration of variables that can be used in an element.
         */
        val variables: Property>?,
    ) {
        internal fun mergeWith(properties: Map): Map {
            val result = mutableMapOf()
            result.putAll(properties)
            result.tryPutProperty("log_id", logId)
            result.tryPutProperty("states", states)
            result.tryPutProperty("timers", timers)
            result.tryPutProperty("transition_animation_selector", transitionAnimationSelector)
            result.tryPutProperty("variable_triggers", variableTriggers)
            result.tryPutProperty("variables", variables)
            return result
        }
    }

    /**
     * Can be created using the method [root].
     * 
     * Required parameters: `state_id, div`.
     */
    @Generated
    class State internal constructor(
        @JsonIgnore
        val properties: Properties,
    ) {
        @JsonAnyGetter
        internal fun getJsonProperties(): Map = properties.mergeWith(emptyMap())

        operator fun plus(additive: Properties): State = State(
            Properties(
                stateId = additive.stateId ?: properties.stateId,
                div = additive.div ?: properties.div,
            )
        )

        class Properties internal constructor(
            /**
             * State ID.
             */
            val stateId: Property?,
            /**
             * Contents.
             */
            val div: Property
?, ) { internal fun mergeWith(properties: Map): Map { val result = mutableMapOf() result.putAll(properties) result.tryPutProperty("state_id", stateId) result.tryPutProperty("div", div) return result } } } } /** * @param logId Logging ID. * @param states A set of visual element states. Each element can have a few states with a different layout. The states are displayed strictly one by one and switched using [action](div-action.md). * @param timers List of timers. * @param transitionAnimationSelector Events that trigger transition animations. * @param variableTriggers Triggers for changing variables. * @param variables Declaration of variables that can be used in an element. */ @Generated fun DivScope.data( logId: String, states: List, `use named arguments`: Guard = Guard.instance, timers: List? = null, transitionAnimationSelector: TransitionSelector? = null, variableTriggers: List? = null, variables: List? = null, ): Data = Data( Data.Properties( logId = valueOrNull(logId), states = valueOrNull(states), timers = valueOrNull(timers), transitionAnimationSelector = valueOrNull(transitionAnimationSelector), variableTriggers = valueOrNull(variableTriggers), variables = valueOrNull(variables), ) ) /** * @param logId Logging ID. * @param states A set of visual element states. Each element can have a few states with a different layout. The states are displayed strictly one by one and switched using [action](div-action.md). * @param timers List of timers. * @param transitionAnimationSelector Events that trigger transition animations. * @param variableTriggers Triggers for changing variables. * @param variables Declaration of variables that can be used in an element. */ @Generated fun DivScope.dataProps( `use named arguments`: Guard = Guard.instance, logId: String? = null, states: List? = null, timers: List? = null, transitionAnimationSelector: TransitionSelector? = null, variableTriggers: List? = null, variables: List? = null, ) = Data.Properties( logId = valueOrNull(logId), states = valueOrNull(states), timers = valueOrNull(timers), transitionAnimationSelector = valueOrNull(transitionAnimationSelector), variableTriggers = valueOrNull(variableTriggers), variables = valueOrNull(variables), ) /** * @param logId Logging ID. * @param states A set of visual element states. Each element can have a few states with a different layout. The states are displayed strictly one by one and switched using [action](div-action.md). * @param timers List of timers. * @param transitionAnimationSelector Events that trigger transition animations. * @param variableTriggers Triggers for changing variables. * @param variables Declaration of variables that can be used in an element. */ @Generated fun TemplateScope.dataRefs( `use named arguments`: Guard = Guard.instance, logId: ReferenceProperty? = null, states: ReferenceProperty>? = null, timers: ReferenceProperty>? = null, transitionAnimationSelector: ReferenceProperty? = null, variableTriggers: ReferenceProperty>? = null, variables: ReferenceProperty>? = null, ) = Data.Properties( logId = logId, states = states, timers = timers, transitionAnimationSelector = transitionAnimationSelector, variableTriggers = variableTriggers, variables = variables, ) /** * @param logId Logging ID. * @param states A set of visual element states. Each element can have a few states with a different layout. The states are displayed strictly one by one and switched using [action](div-action.md). * @param timers List of timers. * @param transitionAnimationSelector Events that trigger transition animations. * @param variableTriggers Triggers for changing variables. * @param variables Declaration of variables that can be used in an element. */ @Generated fun Data.override( `use named arguments`: Guard = Guard.instance, logId: String? = null, states: List? = null, timers: List? = null, transitionAnimationSelector: TransitionSelector? = null, variableTriggers: List? = null, variables: List? = null, ): Data = Data( Data.Properties( logId = valueOrNull(logId) ?: properties.logId, states = valueOrNull(states) ?: properties.states, timers = valueOrNull(timers) ?: properties.timers, transitionAnimationSelector = valueOrNull(transitionAnimationSelector) ?: properties.transitionAnimationSelector, variableTriggers = valueOrNull(variableTriggers) ?: properties.variableTriggers, variables = valueOrNull(variables) ?: properties.variables, ) ) /** * @param logId Logging ID. * @param states A set of visual element states. Each element can have a few states with a different layout. The states are displayed strictly one by one and switched using [action](div-action.md). * @param timers List of timers. * @param transitionAnimationSelector Events that trigger transition animations. * @param variableTriggers Triggers for changing variables. * @param variables Declaration of variables that can be used in an element. */ @Generated fun Data.defer( `use named arguments`: Guard = Guard.instance, logId: ReferenceProperty? = null, states: ReferenceProperty>? = null, timers: ReferenceProperty>? = null, transitionAnimationSelector: ReferenceProperty? = null, variableTriggers: ReferenceProperty>? = null, variables: ReferenceProperty>? = null, ): Data = Data( Data.Properties( logId = logId ?: properties.logId, states = states ?: properties.states, timers = timers ?: properties.timers, transitionAnimationSelector = transitionAnimationSelector ?: properties.transitionAnimationSelector, variableTriggers = variableTriggers ?: properties.variableTriggers, variables = variables ?: properties.variables, ) ) /** * @param transitionAnimationSelector Events that trigger transition animations. */ @Generated fun Data.evaluate( `use named arguments`: Guard = Guard.instance, transitionAnimationSelector: ExpressionProperty? = null, ): Data = Data( Data.Properties( logId = properties.logId, states = properties.states, timers = properties.timers, transitionAnimationSelector = transitionAnimationSelector ?: properties.transitionAnimationSelector, variableTriggers = properties.variableTriggers, variables = properties.variables, ) ) @Generated fun Data.asList() = listOf(this) /** * @param stateId State ID. * @param div Contents. */ @Generated fun DivScope.root( stateId: Int, div: Div, ): Data.State = Data.State( Data.State.Properties( stateId = valueOrNull(stateId), div = valueOrNull(div), ) ) /** * @param stateId State ID. * @param div Contents. */ @Generated fun DivScope.rootProps( `use named arguments`: Guard = Guard.instance, stateId: Int? = null, div: Div? = null, ) = Data.State.Properties( stateId = valueOrNull(stateId), div = valueOrNull(div), ) /** * @param stateId State ID. * @param div Contents. */ @Generated fun TemplateScope.rootRefs( `use named arguments`: Guard = Guard.instance, stateId: ReferenceProperty? = null, div: ReferenceProperty
? = null, ) = Data.State.Properties( stateId = stateId, div = div, ) /** * @param stateId State ID. * @param div Contents. */ @Generated fun Data.State.override( `use named arguments`: Guard = Guard.instance, stateId: Int? = null, div: Div? = null, ): Data.State = Data.State( Data.State.Properties( stateId = valueOrNull(stateId) ?: properties.stateId, div = valueOrNull(div) ?: properties.div, ) ) /** * @param stateId State ID. * @param div Contents. */ @Generated fun Data.State.defer( `use named arguments`: Guard = Guard.instance, stateId: ReferenceProperty? = null, div: ReferenceProperty
? = null, ): Data.State = Data.State( Data.State.Properties( stateId = stateId ?: properties.stateId, div = div ?: properties.div, ) ) @Generated fun Data.State.asList() = listOf(this)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy