![JAR search and dependency download from the Maven repository](/logo.png)
divkit.dsl.ActionDownload.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
/**
* Loads more data in the form of a `div-patch` and updates current element,
*
* Can be created using the method [actionDownload].
*
* Required parameters: `url, type`.
*/
@Generated
class ActionDownload internal constructor(
@JsonIgnore
val properties: Properties,
) : ActionTyped {
@JsonAnyGetter
internal fun getJsonProperties(): Map = properties.mergeWith(
mapOf("type" to "download")
)
operator fun plus(additive: Properties): ActionDownload = ActionDownload(
Properties(
onFailActions = additive.onFailActions ?: properties.onFailActions,
onSuccessActions = additive.onSuccessActions ?: properties.onSuccessActions,
url = additive.url ?: properties.url,
)
)
class Properties internal constructor(
/**
* Actions in case of unsuccessful loading if the host reported it or the waiting time expired.
*/
val onFailActions: Property>?,
/**
* Actions in case of successful loading.
*/
val onSuccessActions: Property>?,
/**
* URL to get the patch.
*/
val url: Property?,
) {
internal fun mergeWith(properties: Map): Map {
val result = mutableMapOf()
result.putAll(properties)
result.tryPutProperty("on_fail_actions", onFailActions)
result.tryPutProperty("on_success_actions", onSuccessActions)
result.tryPutProperty("url", url)
return result
}
}
}
/**
* @param onFailActions Actions in case of unsuccessful loading if the host reported it or the waiting time expired.
* @param onSuccessActions Actions in case of successful loading.
* @param url URL to get the patch.
*/
@Generated
fun DivScope.actionDownload(
`use named arguments`: Guard = Guard.instance,
onFailActions: List? = null,
onSuccessActions: List? = null,
url: String? = null,
): ActionDownload = ActionDownload(
ActionDownload.Properties(
onFailActions = valueOrNull(onFailActions),
onSuccessActions = valueOrNull(onSuccessActions),
url = valueOrNull(url),
)
)
/**
* @param onFailActions Actions in case of unsuccessful loading if the host reported it or the waiting time expired.
* @param onSuccessActions Actions in case of successful loading.
* @param url URL to get the patch.
*/
@Generated
fun DivScope.actionDownloadProps(
`use named arguments`: Guard = Guard.instance,
onFailActions: List? = null,
onSuccessActions: List? = null,
url: String? = null,
) = ActionDownload.Properties(
onFailActions = valueOrNull(onFailActions),
onSuccessActions = valueOrNull(onSuccessActions),
url = valueOrNull(url),
)
/**
* @param onFailActions Actions in case of unsuccessful loading if the host reported it or the waiting time expired.
* @param onSuccessActions Actions in case of successful loading.
* @param url URL to get the patch.
*/
@Generated
fun TemplateScope.actionDownloadRefs(
`use named arguments`: Guard = Guard.instance,
onFailActions: ReferenceProperty>? = null,
onSuccessActions: ReferenceProperty>? = null,
url: ReferenceProperty? = null,
) = ActionDownload.Properties(
onFailActions = onFailActions,
onSuccessActions = onSuccessActions,
url = url,
)
/**
* @param onFailActions Actions in case of unsuccessful loading if the host reported it or the waiting time expired.
* @param onSuccessActions Actions in case of successful loading.
* @param url URL to get the patch.
*/
@Generated
fun ActionDownload.override(
`use named arguments`: Guard = Guard.instance,
onFailActions: List? = null,
onSuccessActions: List? = null,
url: String? = null,
): ActionDownload = ActionDownload(
ActionDownload.Properties(
onFailActions = valueOrNull(onFailActions) ?: properties.onFailActions,
onSuccessActions = valueOrNull(onSuccessActions) ?: properties.onSuccessActions,
url = valueOrNull(url) ?: properties.url,
)
)
/**
* @param onFailActions Actions in case of unsuccessful loading if the host reported it or the waiting time expired.
* @param onSuccessActions Actions in case of successful loading.
* @param url URL to get the patch.
*/
@Generated
fun ActionDownload.defer(
`use named arguments`: Guard = Guard.instance,
onFailActions: ReferenceProperty>? = null,
onSuccessActions: ReferenceProperty>? = null,
url: ReferenceProperty? = null,
): ActionDownload = ActionDownload(
ActionDownload.Properties(
onFailActions = onFailActions ?: properties.onFailActions,
onSuccessActions = onSuccessActions ?: properties.onSuccessActions,
url = url ?: properties.url,
)
)
/**
* @param url URL to get the patch.
*/
@Generated
fun ActionDownload.evaluate(
`use named arguments`: Guard = Guard.instance,
url: ExpressionProperty? = null,
): ActionDownload = ActionDownload(
ActionDownload.Properties(
onFailActions = properties.onFailActions,
onSuccessActions = properties.onSuccessActions,
url = url ?: properties.url,
)
)
@Generated
fun ActionDownload.asList() = listOf(this)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy