AppFunctionData.Builder


class AppFunctionData.Builder


Builder for constructing AppFunctionData

For example, to write an AppFunctionData for calling an AppFunction

fun callCreateNoteFunction(metadata: AppFunctionMetadata) {
val appFunctionData = AppFunctionData.Builder(
metadata.parameters,
metadata.components,
).apply {
setString("title", "Note Title")
// If the function doesn't accept "owner" as parameter, it would throw an error
setString("owner", "Me")
// If the function actually expects "content" as String, it would throw an error
setInt("content", 100)
}
.build()
}

Summary

Public constructors

Builder(
    objectTypeMetadata: AppFunctionObjectTypeMetadata,
    componentMetadata: AppFunctionComponentsMetadata
)

Constructs a Builder to create AppFunctionData representing an object.

Builder(
    parameterMetadataList: List<AppFunctionParameterMetadata>,
    componentMetadata: AppFunctionComponentsMetadata
)

Constructs a Builder to create input data for an AppFunction execution call.

Public functions

AppFunctionData

Builds AppFunctionData

AppFunctionData.Builder

Sets an AppFunctionData value for the given key.

AppFunctionData.Builder

Sets a List of AppFunctionData value for the given key.

AppFunctionData.Builder
setBoolean(key: String, value: Boolean)

Sets a Boolean value for the given key.

AppFunctionData.Builder

Sets a BooleanArray value for the given key.

AppFunctionData.Builder
setByteArray(key: String, value: ByteArray)

Sets a ByteArray value for the given key.

AppFunctionData.Builder
setDouble(key: String, value: Double)

Sets a Double value for the given key.

AppFunctionData.Builder

Sets a DoubleArray value for the given key.

AppFunctionData.Builder
setFloat(key: String, value: Float)

Sets a Float value for the given key.

AppFunctionData.Builder

Sets a FloatArray value for the given key.

AppFunctionData.Builder
setInt(key: String, value: Int)

Sets an Int value for the given key.

AppFunctionData.Builder
setIntArray(key: String, value: IntArray)

Sets an IntArray value for the given key.

AppFunctionData.Builder
setLong(key: String, value: Long)

Sets a Long value for the given key.

AppFunctionData.Builder
setLongArray(key: String, value: LongArray)

Sets a LongArray value for the given key.

AppFunctionData.Builder

Sets a PendingIntent value for the given key.

AppFunctionData.Builder

Sets a List of PendingIntent value for the given key.

AppFunctionData.Builder
setString(key: String, value: String)

Sets a String value for the given key.

AppFunctionData.Builder
setStringList(key: String, value: List<String>)

Sets a List of String value for the given key.

Public constructors

Builder

Added in 1.0.0-alpha01
Builder(
    objectTypeMetadata: AppFunctionObjectTypeMetadata,
    componentMetadata: AppFunctionComponentsMetadata
)

Constructs a Builder to create AppFunctionData representing an object.

This constructor is used when you need to create AppFunctionData that represents an object used as either function parameters or return values, as defined by an AppFunctionObjectTypeMetadata. This metadata specifies the properties and their types for the object.

Parameters
objectTypeMetadata: AppFunctionObjectTypeMetadata

AppFunctionObjectTypeMetadata defining the object structure.

componentMetadata: AppFunctionComponentsMetadata

AppFunctionComponentsMetadata that has the shared data type.

Builder

Added in 1.0.0-alpha01
Builder(
    parameterMetadataList: List<AppFunctionParameterMetadata>,
    componentMetadata: AppFunctionComponentsMetadata
)

Constructs a Builder to create input data for an AppFunction execution call.

This constructor is used when you need to write data that will be passed as input when executing an AppFunction. The parameterMetadataList defines the expected input parameters for that function.

Parameters
parameterMetadataList: List<AppFunctionParameterMetadata>

List of AppFunctionParameterMetadata defining the input parameters.

componentMetadata: AppFunctionComponentsMetadata

AppFunctionComponentsMetadata that has the shared data type.

Public functions

build

Added in 1.0.0-alpha01
fun build(): AppFunctionData

Builds AppFunctionData

setAppFunctionData

Added in 1.0.0-alpha01
fun setAppFunctionData(key: String, value: AppFunctionData): AppFunctionData.Builder

Sets an AppFunctionData value for the given key.

Parameters
key: String

The key to set the AppFunctionData value for.

value: AppFunctionData

The AppFunctionData value to set.

Throws
kotlin.IllegalArgumentException

if the key is not allowed or the value does not match the metadata specification associated with the key.

setAppFunctionDataList

Added in 1.0.0-alpha01
fun setAppFunctionDataList(key: String, value: List<AppFunctionData>): AppFunctionData.Builder

Sets a List of AppFunctionData value for the given key.

Parameters
key: String

The key to set the List of AppFunctionData value for.

value: List<AppFunctionData>

The List of AppFunctionData value to set.

Throws
kotlin.IllegalArgumentException

if the key is not allowed or the value does not match the metadata specification associated with the key.

setBoolean

Added in 1.0.0-alpha01
fun setBoolean(key: String, value: Boolean): AppFunctionData.Builder

Sets a Boolean value for the given key.

Parameters
key: String

The key to set the Boolean value for.

value: Boolean

The Boolean value to set.

Throws
kotlin.IllegalArgumentException

if the key is not allowed or the value does not match the metadata specification associated with the key.

setBooleanArray

Added in 1.0.0-alpha01
fun setBooleanArray(key: String, value: BooleanArray): AppFunctionData.Builder

Sets a BooleanArray value for the given key.

Parameters
key: String

The key to set the BooleanArray value for.

value: BooleanArray

The BooleanArray value to set.

Throws
kotlin.IllegalArgumentException

if the key is not allowed or the value does not match the metadata specification associated with the key.

setByteArray

Added in 1.0.0-alpha01
fun setByteArray(key: String, value: ByteArray): AppFunctionData.Builder

Sets a ByteArray value for the given key.

Parameters
key: String

The key to set the ByteArray value for.

value: ByteArray

The ByteArray value to set.

Throws
kotlin.IllegalArgumentException

if the key is not allowed or the value does not match the metadata specification associated with the key.

setDouble

Added in 1.0.0-alpha01
fun setDouble(key: String, value: Double): AppFunctionData.Builder

Sets a Double value for the given key.

Parameters
key: String

The key to set the Double value for.

value: Double

The Double value to set.

Throws
kotlin.IllegalArgumentException

if the key is not allowed or the value does not match the metadata specification associated with the key.

setDoubleArray

Added in 1.0.0-alpha01
fun setDoubleArray(key: String, value: DoubleArray): AppFunctionData.Builder

Sets a DoubleArray value for the given key.

Parameters
key: String

The key to set the DoubleArray value for.

value: DoubleArray

The DoubleArray value to set.

Throws
kotlin.IllegalArgumentException

if the key is not allowed or the value does not match the metadata specification associated with the key.

setFloat

Added in 1.0.0-alpha01
fun setFloat(key: String, value: Float): AppFunctionData.Builder

Sets a Float value for the given key.

Parameters
key: String

The key to set the Float value for.

value: Float

The Float value to set.

Throws
kotlin.IllegalArgumentException

if the key is not allowed or the value does not match the metadata specification associated with the key.

setFloatArray

Added in 1.0.0-alpha01
fun setFloatArray(key: String, value: FloatArray): AppFunctionData.Builder

Sets a FloatArray value for the given key.

Parameters
key: String

The key to set the DoubleArray value for.

value: FloatArray

The FloatArray value to set.

Throws
kotlin.IllegalArgumentException

if the key is not allowed or the value does not match the metadata specification associated with the key.

setInt

Added in 1.0.0-alpha01
fun setInt(key: String, value: Int): AppFunctionData.Builder

Sets an Int value for the given key.

Parameters
key: String

The key to set the Int value for.

value: Int

The Int value to set.

Throws
kotlin.IllegalArgumentException

if the key is not allowed or the value does not match the metadata specification associated with the key.

setIntArray

Added in 1.0.0-alpha01
fun setIntArray(key: String, value: IntArray): AppFunctionData.Builder

Sets an IntArray value for the given key.

Parameters
key: String

The key to set the IntArray value for.

value: IntArray

The IntArray value to set.

Throws
kotlin.IllegalArgumentException

if the key is not allowed or the value does not match the metadata specification associated with the key.

setLong

Added in 1.0.0-alpha01
fun setLong(key: String, value: Long): AppFunctionData.Builder

Sets a Long value for the given key.

Parameters
key: String

The key to set the Long value for.

value: Long

The Long value to set.

Throws
kotlin.IllegalArgumentException

if the key is not allowed or the value does not match the metadata specification associated with the key.

setLongArray

Added in 1.0.0-alpha01
fun setLongArray(key: String, value: LongArray): AppFunctionData.Builder

Sets a LongArray value for the given key.

Parameters
key: String

The key to set the LongArray value for.

value: LongArray

The LongArray value to set.

Throws
kotlin.IllegalArgumentException

if the key is not allowed or the value does not match the metadata specification associated with the key.

setPendingIntent

Added in 1.0.0-alpha01
fun setPendingIntent(key: String, value: PendingIntent): AppFunctionData.Builder

Sets a PendingIntent value for the given key.

Parameters
key: String

The key to set the AppFunctionData value for.

value: PendingIntent

The AppFunctionData value to set.

Throws
kotlin.IllegalArgumentException

if the key is not allowed or the value does not match the metadata specification associated with the key.

setPendingIntentList

Added in 1.0.0-alpha01
fun setPendingIntentList(key: String, value: List<PendingIntent>): AppFunctionData.Builder

Sets a List of PendingIntent value for the given key.

Parameters
key: String

The key to set the List of AppFunctionData value for.

value: List<PendingIntent>

The List of AppFunctionData value to set.

Throws
kotlin.IllegalArgumentException

if the key is not allowed or the value does not match the metadata specification associated with the key.

setString

Added in 1.0.0-alpha01
fun setString(key: String, value: String): AppFunctionData.Builder

Sets a String value for the given key.

Parameters
key: String

The key to set the String value for.

value: String

The String value to set.

Throws
kotlin.IllegalArgumentException

if the key is not allowed or the value does not match the metadata specification associated with the key.

setStringList

Added in 1.0.0-alpha01
fun setStringList(key: String, value: List<String>): AppFunctionData.Builder

Sets a List of String value for the given key.

Parameters
key: String

The key to set the List of String value for.

value: List<String>

The List of String value to set.

Throws
kotlin.IllegalArgumentException

if the key is not allowed or the value does not match the metadata specification associated with the key.