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

divkit.dsl.DisappearAction.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

/**
 * Actions performed when an element is no longer visible.
 * 
 * Can be created using the method [disappearAction].
 * 
 * Required parameters: `log_id`.
 */
@Generated
class DisappearAction internal constructor(
    @JsonIgnore
    val properties: Properties,
) {
    @JsonAnyGetter
    internal fun getJsonProperties(): Map = properties.mergeWith(emptyMap())

    operator fun plus(additive: Properties): DisappearAction = DisappearAction(
        Properties(
            disappearDuration = additive.disappearDuration ?: properties.disappearDuration,
            downloadCallbacks = additive.downloadCallbacks ?: properties.downloadCallbacks,
            isEnabled = additive.isEnabled ?: properties.isEnabled,
            logId = additive.logId ?: properties.logId,
            logLimit = additive.logLimit ?: properties.logLimit,
            payload = additive.payload ?: properties.payload,
            referer = additive.referer ?: properties.referer,
            typed = additive.typed ?: properties.typed,
            url = additive.url ?: properties.url,
            visibilityPercentage = additive.visibilityPercentage ?: properties.visibilityPercentage,
        )
    )

    class Properties internal constructor(
        /**
         * Time in milliseconds during which an element must be outside the visible area to trigger `disappear-action`.
         * Default value: `800`.
         */
        val disappearDuration: Property?,
        /**
         * Callbacks that are called after [data loading](../../interaction#loading-data).
         */
        val downloadCallbacks: Property?,
        /**
         * The parameter disables the action. Disabled actions stop listening to their associated event (clicks, changes in visibility, and so on).
         * Default value: `true`.
         */
        val isEnabled: Property?,
        /**
         * Logging ID.
         */
        val logId: Property?,
        /**
         * Limit on the number of loggings. If `0`, the limit is removed.
         * Default value: `1`.
         */
        val logLimit: Property?,
        /**
         * Additional parameters, passed to the host application.
         */
        val payload: Property>?,
        /**
         * Referer URL for logging.
         */
        val referer: Property?,
        val typed: Property?,
        /**
         * URL. Possible values: `url` or `div-action://`. To learn more, see [Interaction with elements](../../interaction).
         */
        val url: Property?,
        /**
         * Percentage of the visible part of an element that triggers `disappear-action`.
         * Default value: `0`.
         */
        val visibilityPercentage: Property?,
    ) {
        internal fun mergeWith(properties: Map): Map {
            val result = mutableMapOf()
            result.putAll(properties)
            result.tryPutProperty("disappear_duration", disappearDuration)
            result.tryPutProperty("download_callbacks", downloadCallbacks)
            result.tryPutProperty("is_enabled", isEnabled)
            result.tryPutProperty("log_id", logId)
            result.tryPutProperty("log_limit", logLimit)
            result.tryPutProperty("payload", payload)
            result.tryPutProperty("referer", referer)
            result.tryPutProperty("typed", typed)
            result.tryPutProperty("url", url)
            result.tryPutProperty("visibility_percentage", visibilityPercentage)
            return result
        }
    }
}

/**
 * @param disappearDuration Time in milliseconds during which an element must be outside the visible area to trigger `disappear-action`.
 * @param downloadCallbacks Callbacks that are called after [data loading](../../interaction#loading-data).
 * @param isEnabled The parameter disables the action. Disabled actions stop listening to their associated event (clicks, changes in visibility, and so on).
 * @param logId Logging ID.
 * @param logLimit Limit on the number of loggings. If `0`, the limit is removed.
 * @param payload Additional parameters, passed to the host application.
 * @param referer Referer URL for logging.
 * @param url URL. Possible values: `url` or `div-action://`. To learn more, see [Interaction with elements](../../interaction).
 * @param visibilityPercentage Percentage of the visible part of an element that triggers `disappear-action`.
 */
@Generated
fun DivScope.disappearAction(
    `use named arguments`: Guard = Guard.instance,
    disappearDuration: Int? = null,
    downloadCallbacks: DownloadCallbacks? = null,
    isEnabled: Boolean? = null,
    logId: String? = null,
    logLimit: Int? = null,
    payload: Map? = null,
    referer: Url? = null,
    typed: ActionTyped? = null,
    url: Url? = null,
    visibilityPercentage: Int? = null,
): DisappearAction = DisappearAction(
    DisappearAction.Properties(
        disappearDuration = valueOrNull(disappearDuration),
        downloadCallbacks = valueOrNull(downloadCallbacks),
        isEnabled = valueOrNull(isEnabled),
        logId = valueOrNull(logId),
        logLimit = valueOrNull(logLimit),
        payload = valueOrNull(payload),
        referer = valueOrNull(referer),
        typed = valueOrNull(typed),
        url = valueOrNull(url),
        visibilityPercentage = valueOrNull(visibilityPercentage),
    )
)

/**
 * @param disappearDuration Time in milliseconds during which an element must be outside the visible area to trigger `disappear-action`.
 * @param downloadCallbacks Callbacks that are called after [data loading](../../interaction#loading-data).
 * @param isEnabled The parameter disables the action. Disabled actions stop listening to their associated event (clicks, changes in visibility, and so on).
 * @param logId Logging ID.
 * @param logLimit Limit on the number of loggings. If `0`, the limit is removed.
 * @param payload Additional parameters, passed to the host application.
 * @param referer Referer URL for logging.
 * @param url URL. Possible values: `url` or `div-action://`. To learn more, see [Interaction with elements](../../interaction).
 * @param visibilityPercentage Percentage of the visible part of an element that triggers `disappear-action`.
 */
@Generated
fun DivScope.disappearActionProps(
    `use named arguments`: Guard = Guard.instance,
    disappearDuration: Int? = null,
    downloadCallbacks: DownloadCallbacks? = null,
    isEnabled: Boolean? = null,
    logId: String? = null,
    logLimit: Int? = null,
    payload: Map? = null,
    referer: Url? = null,
    typed: ActionTyped? = null,
    url: Url? = null,
    visibilityPercentage: Int? = null,
) = DisappearAction.Properties(
    disappearDuration = valueOrNull(disappearDuration),
    downloadCallbacks = valueOrNull(downloadCallbacks),
    isEnabled = valueOrNull(isEnabled),
    logId = valueOrNull(logId),
    logLimit = valueOrNull(logLimit),
    payload = valueOrNull(payload),
    referer = valueOrNull(referer),
    typed = valueOrNull(typed),
    url = valueOrNull(url),
    visibilityPercentage = valueOrNull(visibilityPercentage),
)

/**
 * @param disappearDuration Time in milliseconds during which an element must be outside the visible area to trigger `disappear-action`.
 * @param downloadCallbacks Callbacks that are called after [data loading](../../interaction#loading-data).
 * @param isEnabled The parameter disables the action. Disabled actions stop listening to their associated event (clicks, changes in visibility, and so on).
 * @param logId Logging ID.
 * @param logLimit Limit on the number of loggings. If `0`, the limit is removed.
 * @param payload Additional parameters, passed to the host application.
 * @param referer Referer URL for logging.
 * @param url URL. Possible values: `url` or `div-action://`. To learn more, see [Interaction with elements](../../interaction).
 * @param visibilityPercentage Percentage of the visible part of an element that triggers `disappear-action`.
 */
@Generated
fun TemplateScope.disappearActionRefs(
    `use named arguments`: Guard = Guard.instance,
    disappearDuration: ReferenceProperty? = null,
    downloadCallbacks: ReferenceProperty? = null,
    isEnabled: ReferenceProperty? = null,
    logId: ReferenceProperty? = null,
    logLimit: ReferenceProperty? = null,
    payload: ReferenceProperty>? = null,
    referer: ReferenceProperty? = null,
    typed: ReferenceProperty? = null,
    url: ReferenceProperty? = null,
    visibilityPercentage: ReferenceProperty? = null,
) = DisappearAction.Properties(
    disappearDuration = disappearDuration,
    downloadCallbacks = downloadCallbacks,
    isEnabled = isEnabled,
    logId = logId,
    logLimit = logLimit,
    payload = payload,
    referer = referer,
    typed = typed,
    url = url,
    visibilityPercentage = visibilityPercentage,
)

/**
 * @param disappearDuration Time in milliseconds during which an element must be outside the visible area to trigger `disappear-action`.
 * @param downloadCallbacks Callbacks that are called after [data loading](../../interaction#loading-data).
 * @param isEnabled The parameter disables the action. Disabled actions stop listening to their associated event (clicks, changes in visibility, and so on).
 * @param logId Logging ID.
 * @param logLimit Limit on the number of loggings. If `0`, the limit is removed.
 * @param payload Additional parameters, passed to the host application.
 * @param referer Referer URL for logging.
 * @param url URL. Possible values: `url` or `div-action://`. To learn more, see [Interaction with elements](../../interaction).
 * @param visibilityPercentage Percentage of the visible part of an element that triggers `disappear-action`.
 */
@Generated
fun DisappearAction.override(
    `use named arguments`: Guard = Guard.instance,
    disappearDuration: Int? = null,
    downloadCallbacks: DownloadCallbacks? = null,
    isEnabled: Boolean? = null,
    logId: String? = null,
    logLimit: Int? = null,
    payload: Map? = null,
    referer: Url? = null,
    typed: ActionTyped? = null,
    url: Url? = null,
    visibilityPercentage: Int? = null,
): DisappearAction = DisappearAction(
    DisappearAction.Properties(
        disappearDuration = valueOrNull(disappearDuration) ?: properties.disappearDuration,
        downloadCallbacks = valueOrNull(downloadCallbacks) ?: properties.downloadCallbacks,
        isEnabled = valueOrNull(isEnabled) ?: properties.isEnabled,
        logId = valueOrNull(logId) ?: properties.logId,
        logLimit = valueOrNull(logLimit) ?: properties.logLimit,
        payload = valueOrNull(payload) ?: properties.payload,
        referer = valueOrNull(referer) ?: properties.referer,
        typed = valueOrNull(typed) ?: properties.typed,
        url = valueOrNull(url) ?: properties.url,
        visibilityPercentage = valueOrNull(visibilityPercentage) ?: properties.visibilityPercentage,
    )
)

/**
 * @param disappearDuration Time in milliseconds during which an element must be outside the visible area to trigger `disappear-action`.
 * @param downloadCallbacks Callbacks that are called after [data loading](../../interaction#loading-data).
 * @param isEnabled The parameter disables the action. Disabled actions stop listening to their associated event (clicks, changes in visibility, and so on).
 * @param logId Logging ID.
 * @param logLimit Limit on the number of loggings. If `0`, the limit is removed.
 * @param payload Additional parameters, passed to the host application.
 * @param referer Referer URL for logging.
 * @param url URL. Possible values: `url` or `div-action://`. To learn more, see [Interaction with elements](../../interaction).
 * @param visibilityPercentage Percentage of the visible part of an element that triggers `disappear-action`.
 */
@Generated
fun DisappearAction.defer(
    `use named arguments`: Guard = Guard.instance,
    disappearDuration: ReferenceProperty? = null,
    downloadCallbacks: ReferenceProperty? = null,
    isEnabled: ReferenceProperty? = null,
    logId: ReferenceProperty? = null,
    logLimit: ReferenceProperty? = null,
    payload: ReferenceProperty>? = null,
    referer: ReferenceProperty? = null,
    typed: ReferenceProperty? = null,
    url: ReferenceProperty? = null,
    visibilityPercentage: ReferenceProperty? = null,
): DisappearAction = DisappearAction(
    DisappearAction.Properties(
        disappearDuration = disappearDuration ?: properties.disappearDuration,
        downloadCallbacks = downloadCallbacks ?: properties.downloadCallbacks,
        isEnabled = isEnabled ?: properties.isEnabled,
        logId = logId ?: properties.logId,
        logLimit = logLimit ?: properties.logLimit,
        payload = payload ?: properties.payload,
        referer = referer ?: properties.referer,
        typed = typed ?: properties.typed,
        url = url ?: properties.url,
        visibilityPercentage = visibilityPercentage ?: properties.visibilityPercentage,
    )
)

/**
 * @param disappearDuration Time in milliseconds during which an element must be outside the visible area to trigger `disappear-action`.
 * @param isEnabled The parameter disables the action. Disabled actions stop listening to their associated event (clicks, changes in visibility, and so on).
 * @param logId Logging ID.
 * @param logLimit Limit on the number of loggings. If `0`, the limit is removed.
 * @param referer Referer URL for logging.
 * @param url URL. Possible values: `url` or `div-action://`. To learn more, see [Interaction with elements](../../interaction).
 * @param visibilityPercentage Percentage of the visible part of an element that triggers `disappear-action`.
 */
@Generated
fun DisappearAction.evaluate(
    `use named arguments`: Guard = Guard.instance,
    disappearDuration: ExpressionProperty? = null,
    isEnabled: ExpressionProperty? = null,
    logId: ExpressionProperty? = null,
    logLimit: ExpressionProperty? = null,
    referer: ExpressionProperty? = null,
    url: ExpressionProperty? = null,
    visibilityPercentage: ExpressionProperty? = null,
): DisappearAction = DisappearAction(
    DisappearAction.Properties(
        disappearDuration = disappearDuration ?: properties.disappearDuration,
        downloadCallbacks = properties.downloadCallbacks,
        isEnabled = isEnabled ?: properties.isEnabled,
        logId = logId ?: properties.logId,
        logLimit = logLimit ?: properties.logLimit,
        payload = properties.payload,
        referer = referer ?: properties.referer,
        typed = properties.typed,
        url = url ?: properties.url,
        visibilityPercentage = visibilityPercentage ?: properties.visibilityPercentage,
    )
)

@Generated
fun DisappearAction.asList() = listOf(this)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy