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( Constructs a |
Builder( Constructs a |
Builder( Constructs a |
Public constructors
Builder
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 |
|
componentMetadata: AppFunctionComponentsMetadata |
|
Builder
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 |
componentMetadata: AppFunctionComponentsMetadata |
|
Builder
Builder(
responseMetadata: AppFunctionResponseMetadata,
componentMetadata: AppFunctionComponentsMetadata
)
Constructs a Builder
to create AppFunctionData
representing a response.
This constructor is used when you need to create AppFunctionData
that represents a response, as defined by an AppFunctionResponseMetadata
. This metadata specifies the properties and their types for the response.
Parameters | |
---|---|
responseMetadata: AppFunctionResponseMetadata |
|
componentMetadata: AppFunctionComponentsMetadata |
|
Public functions
build
fun build(): AppFunctionData
Builds AppFunctionData
Throws | |
---|---|
kotlin.IllegalArgumentException |
if any required property, as defined by the metadata specification, is missing. |
setAppFunctionData
fun setAppFunctionData(key: String, value: AppFunctionData): AppFunctionData.Builder
Sets an AppFunctionData
value for the given key
.
Parameters | |
---|---|
key: String |
The key to set the |
value: AppFunctionData |
The |
Throws | |
---|---|
kotlin.IllegalArgumentException |
if the |
setAppFunctionDataList
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 |
value: List<AppFunctionData> |
The |
Throws | |
---|---|
kotlin.IllegalArgumentException |
if the |
setBoolean
fun setBoolean(key: String, value: Boolean): AppFunctionData.Builder
Sets a Boolean
value for the given key
.
Parameters | |
---|---|
key: String |
The key to set the |
value: Boolean |
The |
Throws | |
---|---|
kotlin.IllegalArgumentException |
if the |
setBooleanArray
fun setBooleanArray(key: String, value: BooleanArray): AppFunctionData.Builder
Sets a BooleanArray
value for the given key
.
Parameters | |
---|---|
key: String |
The key to set the |
value: BooleanArray |
The |
Throws | |
---|---|
kotlin.IllegalArgumentException |
if the |
setByteArray
fun setByteArray(key: String, value: ByteArray): AppFunctionData.Builder
Sets a ByteArray
value for the given key
.
Parameters | |
---|---|
key: String |
The key to set the |
value: ByteArray |
The |
Throws | |
---|---|
kotlin.IllegalArgumentException |
if the |
setDouble
fun setDouble(key: String, value: Double): AppFunctionData.Builder
Sets a Double
value for the given key
.
Throws | |
---|---|
kotlin.IllegalArgumentException |
if the |
setDoubleArray
fun setDoubleArray(key: String, value: DoubleArray): AppFunctionData.Builder
Sets a DoubleArray
value for the given key
.
Parameters | |
---|---|
key: String |
The key to set the |
value: DoubleArray |
The |
Throws | |
---|---|
kotlin.IllegalArgumentException |
if the |
setFloat
fun setFloat(key: String, value: Float): AppFunctionData.Builder
Sets a Float
value for the given key
.
Throws | |
---|---|
kotlin.IllegalArgumentException |
if the |
setFloatArray
fun setFloatArray(key: String, value: FloatArray): AppFunctionData.Builder
Sets a FloatArray
value for the given key
.
Parameters | |
---|---|
key: String |
The key to set the |
value: FloatArray |
The |
Throws | |
---|---|
kotlin.IllegalArgumentException |
if the |
setInt
fun setInt(key: String, value: Int): AppFunctionData.Builder
Sets an Int
value for the given key
.
Throws | |
---|---|
kotlin.IllegalArgumentException |
if the |
setIntArray
fun setIntArray(key: String, value: IntArray): AppFunctionData.Builder
Sets an IntArray
value for the given key
.
Parameters | |
---|---|
key: String |
The key to set the |
value: IntArray |
The |
Throws | |
---|---|
kotlin.IllegalArgumentException |
if the |
setLong
fun setLong(key: String, value: Long): AppFunctionData.Builder
Sets a Long
value for the given key
.
Throws | |
---|---|
kotlin.IllegalArgumentException |
if the |
setLongArray
fun setLongArray(key: String, value: LongArray): AppFunctionData.Builder
Sets a LongArray
value for the given key
.
Parameters | |
---|---|
key: String |
The key to set the |
value: LongArray |
The |
Throws | |
---|---|
kotlin.IllegalArgumentException |
if the |
setPendingIntent
fun setPendingIntent(key: String, value: PendingIntent): AppFunctionData.Builder
Sets a PendingIntent
value for the given key
.
Parameters | |
---|---|
key: String |
The key to set the |
value: PendingIntent |
The |
Throws | |
---|---|
kotlin.IllegalArgumentException |
if the |
setPendingIntentList
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 |
value: List<PendingIntent> |
The |
Throws | |
---|---|
kotlin.IllegalArgumentException |
if the |
setString
fun setString(key: String, value: String): AppFunctionData.Builder
Sets a String
value for the given key
.
Throws | |
---|---|
kotlin.IllegalArgumentException |
if the |
setStringList
fun setStringList(key: String, value: List<String>): AppFunctionData.Builder
Sets a List
of String
value for the given key
.
Throws | |
---|---|
kotlin.IllegalArgumentException |
if the |