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(
    allOfTypeMetadata: AppFunctionAllOfTypeMetadata,
    componentMetadata: AppFunctionComponentsMetadata
)

Constructs a Builder to create AppFunctionData representing an all-of object.

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.

Builder(
    responseMetadata: AppFunctionResponseMetadata,
    componentMetadata: AppFunctionComponentsMetadata
)

Constructs a Builder to create AppFunctionData representing a response.

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
<T : Parcelable> setParcelable(key: String, value: T)

Sets a Parcelable value of type T for the given key.

AppFunctionData.Builder
<T : Parcelable> setParcelableList(key: String, value: List<T>)

Sets a List of Parcelable values of type T 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-alpha06
Builder(
    allOfTypeMetadata: AppFunctionAllOfTypeMetadata,
    componentMetadata: AppFunctionComponentsMetadata
)

Constructs a Builder to create AppFunctionData representing an all-of object.

The caller can use this to construct the AppFunctionData that conforms with the provided allOfTypeMetadata.

Parameters
allOfTypeMetadata: AppFunctionAllOfTypeMetadata

AppFunctionAllOfTypeMetadata defining the object structure.

componentMetadata: AppFunctionComponentsMetadata

AppFunctionComponentsMetadata that has the shared data types.

Builder

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

Constructs a Builder to create AppFunctionData representing an object.

The caller can use this to construct the AppFunctionData that conforms with the provided objectTypeMetadata.

Parameters
objectTypeMetadata: AppFunctionObjectTypeMetadata

AppFunctionObjectTypeMetadata defining the object structure.

componentMetadata: AppFunctionComponentsMetadata

AppFunctionComponentsMetadata that has the shared data types.

Builder

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

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

The caller can use this to construct the AppFunctionData for ExecuteAppFunctionRequest.functionParameters.

Parameters
parameterMetadataList: List<AppFunctionParameterMetadata>

List of AppFunctionParameterMetadata defining the input parameters.

componentMetadata: AppFunctionComponentsMetadata

AppFunctionComponentsMetadata that has the shared data types.

Builder

Added in 1.0.0-alpha06
Builder(
    responseMetadata: AppFunctionResponseMetadata,
    componentMetadata: AppFunctionComponentsMetadata
)

Constructs a Builder to create AppFunctionData representing a response.

The caller can use this to construct the AppFunctionData for ExecuteAppFunctionResponse.Success.returnValue.

Parameters
responseMetadata: AppFunctionResponseMetadata

AppFunctionResponseMetadata defining the response structure.

componentMetadata: AppFunctionComponentsMetadata

AppFunctionComponentsMetadata that has the shared data types.

Public functions

build

Added in 1.0.0-alpha06
fun build(): AppFunctionData

Builds AppFunctionData

Throws
kotlin.IllegalArgumentException

if any required property, as defined by the metadata specification, is missing.

setAppFunctionData

Added in 1.0.0-alpha06
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-alpha06
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-alpha06
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-alpha06
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-alpha06
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-alpha06
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-alpha06
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-alpha06
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-alpha06
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-alpha06
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-alpha06
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-alpha06
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-alpha06
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.

setParcelable

Added in 1.0.0-alpha06
fun <T : Parcelable> setParcelable(key: String, value: T): AppFunctionData.Builder

Sets a Parcelable value of type T for the given key.

For Parcelable types not defined by the Android platform (e.g., custom classes shared between agents and apps), forward and backward compatibility is not guaranteed by this library. The sender and receiver of the Parcelable are responsible for managing any compatibility and versioning concerns.

Parameters
key: String

The key to set the value for.

value: T

The Parcelable value of type T to set.

setParcelableList

fun <T : Parcelable> setParcelableList(key: String, value: List<T>): AppFunctionData.Builder

Sets a List of Parcelable values of type T for the given key.

For Parcelable types not defined by the Android platform (e.g., custom classes shared between agents and apps), forward and backward compatibility is not guaranteed by this framework. The sender and receiver of the Parcelable are responsible for managing any compatibility and versioning concerns.

Parameters
key: String

The key to set the list for.

value: List<T>

The List of Parcelable values of type T to set.

setPendingIntent

Added in 1.0.0-alpha06
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-alpha06
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-alpha06
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-alpha06
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.