divkit.dsl.ActionArrayInsertValue.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-json-builder Show documentation
Show all versions of kotlin-json-builder Show documentation
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.
@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
/**
* Adds a value to the array
*
* Can be created using the method [actionArrayInsertValue].
*
* Required parameters: `variable_name, value, type`.
*/
@Generated
class ActionArrayInsertValue internal constructor(
@JsonIgnore
val properties: Properties,
) : ActionTyped {
@JsonAnyGetter
internal fun getJsonProperties(): Map = properties.mergeWith(
mapOf("type" to "array_insert_value")
)
operator fun plus(additive: Properties): ActionArrayInsertValue = ActionArrayInsertValue(
Properties(
index = additive.index ?: properties.index,
value = additive.value ?: properties.value,
variableName = additive.variableName ?: properties.variableName,
)
)
class Properties internal constructor(
val index: Property?,
val value: Property?,
val variableName: Property?,
) {
internal fun mergeWith(properties: Map): Map {
val result = mutableMapOf()
result.putAll(properties)
result.tryPutProperty("index", index)
result.tryPutProperty("value", value)
result.tryPutProperty("variable_name", variableName)
return result
}
}
}
@Generated
fun DivScope.actionArrayInsertValue(
`use named arguments`: Guard = Guard.instance,
index: Int? = null,
value: TypedValue? = null,
variableName: String? = null,
): ActionArrayInsertValue = ActionArrayInsertValue(
ActionArrayInsertValue.Properties(
index = valueOrNull(index),
value = valueOrNull(value),
variableName = valueOrNull(variableName),
)
)
@Generated
fun DivScope.actionArrayInsertValueProps(
`use named arguments`: Guard = Guard.instance,
index: Int? = null,
value: TypedValue? = null,
variableName: String? = null,
) = ActionArrayInsertValue.Properties(
index = valueOrNull(index),
value = valueOrNull(value),
variableName = valueOrNull(variableName),
)
@Generated
fun TemplateScope.actionArrayInsertValueRefs(
`use named arguments`: Guard = Guard.instance,
index: ReferenceProperty? = null,
value: ReferenceProperty? = null,
variableName: ReferenceProperty? = null,
) = ActionArrayInsertValue.Properties(
index = index,
value = value,
variableName = variableName,
)
@Generated
fun ActionArrayInsertValue.override(
`use named arguments`: Guard = Guard.instance,
index: Int? = null,
value: TypedValue? = null,
variableName: String? = null,
): ActionArrayInsertValue = ActionArrayInsertValue(
ActionArrayInsertValue.Properties(
index = valueOrNull(index) ?: properties.index,
value = valueOrNull(value) ?: properties.value,
variableName = valueOrNull(variableName) ?: properties.variableName,
)
)
@Generated
fun ActionArrayInsertValue.defer(
`use named arguments`: Guard = Guard.instance,
index: ReferenceProperty? = null,
value: ReferenceProperty? = null,
variableName: ReferenceProperty? = null,
): ActionArrayInsertValue = ActionArrayInsertValue(
ActionArrayInsertValue.Properties(
index = index ?: properties.index,
value = value ?: properties.value,
variableName = variableName ?: properties.variableName,
)
)
@Generated
fun ActionArrayInsertValue.evaluate(
`use named arguments`: Guard = Guard.instance,
index: ExpressionProperty? = null,
variableName: ExpressionProperty? = null,
): ActionArrayInsertValue = ActionArrayInsertValue(
ActionArrayInsertValue.Properties(
index = index ?: properties.index,
value = properties.value,
variableName = variableName ?: properties.variableName,
)
)
@Generated
fun ActionArrayInsertValue.asList() = listOf(this)