Alert
public protocol Alert
An Alert to be sent to the server. The alert is sent by calling the
raise() method. The time of the alert is set when raise()
is called, allowing raise() to be called more than once.
The set method returns the Alert instance to allow
the fields of the alert to be set in fluent style.
-
Set the value of a field in the
Alert. The fields are determined by the format given when the Alert is created. The value is validated according to the constraints in the format. If the value is not valid, aClientError.argumentis raised.All fields defined in the format that are “optional” must be set before calling
raise().Throws
ClientError.argumentiffieldNameis not a valid field name orvalueis not the field type.Declaration
Swift
func set(fieldName: String, value: AnyObject) throws -> AlertParameters
fieldNamethe name of a field from the alert format
valuethe value to set
Return Value
Alert object that can be used for function chaining
-
Send the alert. The event time is set when this method is called.
The
onErrorhandler of the parent virtual device will be called if there is error sending the alert.All fields defined in the format that are “optional” must be set before calling
raise(). Ifraise()is called before setting all “optional” fields, the function will fail with a specific ErrorTypeThrows
ClientError.argumentif a required field is not setClientError.networkif aMessageDispatchercannot be obtained.
Declaration
Swift
func raise() throws -
Set a callback that is invoked if an error occurs when raising the
Alert. The callback may benil, which will un-set the callback.Declaration
Swift
func setOnError(callback: ((ErrorEvent) -> ())?)Parameters
callbacka callback to invoke, or
nil
Alert Protocol Reference