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"]
}
}Content copied to clipboard
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 } }
]Content copied to clipboard
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
Functions
Inherited functions
Link copied to clipboard
Called after the action performs.
Link copied to clipboard
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.