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

divkit.dsl.VideoSource.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.28.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

/**
 * Can be created using the method [videoSource].
 * 
 * Required parameters: `url, type, mime_type`.
 */
@Generated
class VideoSource internal constructor(
    @JsonIgnore
    val properties: Properties,
) {
    @JsonAnyGetter
    internal fun getJsonProperties(): Map = properties.mergeWith(
        mapOf("type" to "video_source")
    )

    operator fun plus(additive: Properties): VideoSource = VideoSource(
        Properties(
            bitrate = additive.bitrate ?: properties.bitrate,
            mimeType = additive.mimeType ?: properties.mimeType,
            resolution = additive.resolution ?: properties.resolution,
            url = additive.url ?: properties.url,
        )
    )

    class Properties internal constructor(
        /**
         * Media file bitrate: Data transfer rate in a video stream, measured in kilobits per second (kbps).
         */
        val bitrate: Property?,
        /**
         * MIME type (Multipurpose Internet Mail Extensions): A string that defines the file type and helps process it correctly.
         */
        val mimeType: Property?,
        /**
         * Media file resolution.
         */
        val resolution: Property?,
        /**
         * Link to the media file available for playback or download.
         */
        val url: Property?,
    ) {
        internal fun mergeWith(properties: Map): Map {
            val result = mutableMapOf()
            result.putAll(properties)
            result.tryPutProperty("bitrate", bitrate)
            result.tryPutProperty("mime_type", mimeType)
            result.tryPutProperty("resolution", resolution)
            result.tryPutProperty("url", url)
            return result
        }
    }

    /**
     * Media file resolution.
     * 
     * Can be created using the method [videoSourceResolution].
     * 
     * Required parameters: `width, type, height`.
     */
    @Generated
    class Resolution internal constructor(
        @JsonIgnore
        val properties: Properties,
    ) {
        @JsonAnyGetter
        internal fun getJsonProperties(): Map = properties.mergeWith(
            mapOf("type" to "resolution")
        )

        operator fun plus(additive: Properties): Resolution = Resolution(
            Properties(
                height = additive.height ?: properties.height,
                width = additive.width ?: properties.width,
            )
        )

        class Properties internal constructor(
            /**
             * Media file frame height.
             */
            val height: Property?,
            /**
             * Media file frame width.
             */
            val width: Property?,
        ) {
            internal fun mergeWith(properties: Map): Map {
                val result = mutableMapOf()
                result.putAll(properties)
                result.tryPutProperty("height", height)
                result.tryPutProperty("width", width)
                return result
            }
        }
    }

}

/**
 * @param bitrate Media file bitrate: Data transfer rate in a video stream, measured in kilobits per second (kbps).
 * @param mimeType MIME type (Multipurpose Internet Mail Extensions): A string that defines the file type and helps process it correctly.
 * @param resolution Media file resolution.
 * @param url Link to the media file available for playback or download.
 */
@Generated
fun DivScope.videoSource(
    `use named arguments`: Guard = Guard.instance,
    bitrate: Int? = null,
    mimeType: String? = null,
    resolution: VideoSource.Resolution? = null,
    url: Url? = null,
): VideoSource = VideoSource(
    VideoSource.Properties(
        bitrate = valueOrNull(bitrate),
        mimeType = valueOrNull(mimeType),
        resolution = valueOrNull(resolution),
        url = valueOrNull(url),
    )
)

/**
 * @param bitrate Media file bitrate: Data transfer rate in a video stream, measured in kilobits per second (kbps).
 * @param mimeType MIME type (Multipurpose Internet Mail Extensions): A string that defines the file type and helps process it correctly.
 * @param resolution Media file resolution.
 * @param url Link to the media file available for playback or download.
 */
@Generated
fun DivScope.videoSourceProps(
    `use named arguments`: Guard = Guard.instance,
    bitrate: Int? = null,
    mimeType: String? = null,
    resolution: VideoSource.Resolution? = null,
    url: Url? = null,
) = VideoSource.Properties(
    bitrate = valueOrNull(bitrate),
    mimeType = valueOrNull(mimeType),
    resolution = valueOrNull(resolution),
    url = valueOrNull(url),
)

/**
 * @param bitrate Media file bitrate: Data transfer rate in a video stream, measured in kilobits per second (kbps).
 * @param mimeType MIME type (Multipurpose Internet Mail Extensions): A string that defines the file type and helps process it correctly.
 * @param resolution Media file resolution.
 * @param url Link to the media file available for playback or download.
 */
@Generated
fun TemplateScope.videoSourceRefs(
    `use named arguments`: Guard = Guard.instance,
    bitrate: ReferenceProperty? = null,
    mimeType: ReferenceProperty? = null,
    resolution: ReferenceProperty? = null,
    url: ReferenceProperty? = null,
) = VideoSource.Properties(
    bitrate = bitrate,
    mimeType = mimeType,
    resolution = resolution,
    url = url,
)

/**
 * @param bitrate Media file bitrate: Data transfer rate in a video stream, measured in kilobits per second (kbps).
 * @param mimeType MIME type (Multipurpose Internet Mail Extensions): A string that defines the file type and helps process it correctly.
 * @param resolution Media file resolution.
 * @param url Link to the media file available for playback or download.
 */
@Generated
fun VideoSource.override(
    `use named arguments`: Guard = Guard.instance,
    bitrate: Int? = null,
    mimeType: String? = null,
    resolution: VideoSource.Resolution? = null,
    url: Url? = null,
): VideoSource = VideoSource(
    VideoSource.Properties(
        bitrate = valueOrNull(bitrate) ?: properties.bitrate,
        mimeType = valueOrNull(mimeType) ?: properties.mimeType,
        resolution = valueOrNull(resolution) ?: properties.resolution,
        url = valueOrNull(url) ?: properties.url,
    )
)

/**
 * @param bitrate Media file bitrate: Data transfer rate in a video stream, measured in kilobits per second (kbps).
 * @param mimeType MIME type (Multipurpose Internet Mail Extensions): A string that defines the file type and helps process it correctly.
 * @param resolution Media file resolution.
 * @param url Link to the media file available for playback or download.
 */
@Generated
fun VideoSource.defer(
    `use named arguments`: Guard = Guard.instance,
    bitrate: ReferenceProperty? = null,
    mimeType: ReferenceProperty? = null,
    resolution: ReferenceProperty? = null,
    url: ReferenceProperty? = null,
): VideoSource = VideoSource(
    VideoSource.Properties(
        bitrate = bitrate ?: properties.bitrate,
        mimeType = mimeType ?: properties.mimeType,
        resolution = resolution ?: properties.resolution,
        url = url ?: properties.url,
    )
)

/**
 * @param bitrate Media file bitrate: Data transfer rate in a video stream, measured in kilobits per second (kbps).
 * @param mimeType MIME type (Multipurpose Internet Mail Extensions): A string that defines the file type and helps process it correctly.
 * @param url Link to the media file available for playback or download.
 */
@Generated
fun VideoSource.evaluate(
    `use named arguments`: Guard = Guard.instance,
    bitrate: ExpressionProperty? = null,
    mimeType: ExpressionProperty? = null,
    url: ExpressionProperty? = null,
): VideoSource = VideoSource(
    VideoSource.Properties(
        bitrate = bitrate ?: properties.bitrate,
        mimeType = mimeType ?: properties.mimeType,
        resolution = properties.resolution,
        url = url ?: properties.url,
    )
)

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

/**
 * @param height Media file frame height.
 * @param width Media file frame width.
 */
@Generated
fun DivScope.videoSourceResolution(
    `use named arguments`: Guard = Guard.instance,
    height: Int? = null,
    width: Int? = null,
): VideoSource.Resolution = VideoSource.Resolution(
    VideoSource.Resolution.Properties(
        height = valueOrNull(height),
        width = valueOrNull(width),
    )
)

/**
 * @param height Media file frame height.
 * @param width Media file frame width.
 */
@Generated
fun DivScope.videoSourceResolutionProps(
    `use named arguments`: Guard = Guard.instance,
    height: Int? = null,
    width: Int? = null,
) = VideoSource.Resolution.Properties(
    height = valueOrNull(height),
    width = valueOrNull(width),
)

/**
 * @param height Media file frame height.
 * @param width Media file frame width.
 */
@Generated
fun TemplateScope.videoSourceResolutionRefs(
    `use named arguments`: Guard = Guard.instance,
    height: ReferenceProperty? = null,
    width: ReferenceProperty? = null,
) = VideoSource.Resolution.Properties(
    height = height,
    width = width,
)

/**
 * @param height Media file frame height.
 * @param width Media file frame width.
 */
@Generated
fun VideoSource.Resolution.override(
    `use named arguments`: Guard = Guard.instance,
    height: Int? = null,
    width: Int? = null,
): VideoSource.Resolution = VideoSource.Resolution(
    VideoSource.Resolution.Properties(
        height = valueOrNull(height) ?: properties.height,
        width = valueOrNull(width) ?: properties.width,
    )
)

/**
 * @param height Media file frame height.
 * @param width Media file frame width.
 */
@Generated
fun VideoSource.Resolution.defer(
    `use named arguments`: Guard = Guard.instance,
    height: ReferenceProperty? = null,
    width: ReferenceProperty? = null,
): VideoSource.Resolution = VideoSource.Resolution(
    VideoSource.Resolution.Properties(
        height = height ?: properties.height,
        width = width ?: properties.width,
    )
)

/**
 * @param height Media file frame height.
 * @param width Media file frame width.
 */
@Generated
fun VideoSource.Resolution.evaluate(
    `use named arguments`: Guard = Guard.instance,
    height: ExpressionProperty? = null,
    width: ExpressionProperty? = null,
): VideoSource.Resolution = VideoSource.Resolution(
    VideoSource.Resolution.Properties(
        height = height ?: properties.height,
        width = width ?: properties.width,
    )
)

@Generated
fun VideoSource.Resolution.asList() = listOf(this)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy