SetAttributesAction

class SetAttributesAction(channelProvider: () -> AirshipChannel = { Airship.channel }, contactProvider: () -> Contact = { Airship.contact }) : Action(source)

An action that sets attributes.

Accepts two argument formats:

Dictionary format

{
"channel": {
"set": { "key": "value" },
"remove": ["attribute"]
},
"named_user": {
"set": { "key": "value" },
"remove": ["attribute"]
}
}

Array format — each element describes a single operation:

[
{ "action": "set", "type": "channel", "name": "color", "value": "blue" },
{ "action": "remove", "type": "channel", "name": "color" },
{ "action": "set", "type": "named_user", "name": "score", "value": 42 },
{ "action": "set", "type": "channel", "name": "attr#id", "value": { "key": "val", "exp": 1779840000 } }
]

For JSON object values, name must be "attributeName#instanceId" with both parts non-empty. The optional "exp" key inside the object is a Unix timestamp (seconds) for the expiration date.

Accepted situations: all

Constructors

Link copied to clipboard
constructor(channelProvider: () -> AirshipChannel = { Airship.channel }, contactProvider: () -> Contact = { Airship.contact })

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun acceptsArguments(arguments: ActionArguments): Boolean

Called before an action is performed to determine if the the action can accept the arguments.

Link copied to clipboard
open override fun perform(arguments: ActionArguments): ActionResult

Performs the action.

Inherited functions

Link copied to clipboard
open fun onFinish(arguments: ActionArguments, result: ActionResult)

Called after the action performs.

Link copied to clipboard
open fun onStart(arguments: ActionArguments)

Called before an action is performed.

Link copied to clipboard

Performs the action, with pre/post execution calls, if it accepts the provided arguments.

Link copied to clipboard

Determines which thread runs the action.