VotingEvent
public class VotingEvent : DALIEvent
Handles all voting communications
-
The configure the voting
Declaration
Swift
public private(set) var config: Config -
Voting results have been released
Declaration
Swift
public private(set) var resultsReleased: Bool
-
Converts the data stored in the event into a JSON format that the API will understand
Declaration
Swift
public override func json() -> JSONReturn Value
JSON data describing the event
-
Parses a JSON object. May return nil if this is not a voting event or if it fails
Declaration
Swift
public override class func parse(_ object: JSON) -> VotingEvent?Parameters
objectThe JSON object to parse
-
Get if the current device and user have already voted for this event
Declaration
Swift
public func haveVoted(callback: @escaping (_ haveVoted: Bool, _ error: DALIError.General?) -> Void)Parameters
callbackFunction called when done
haveVotedFlag expressing if the user and device has voted already (default false)
errorThe error encountered, if any
-
Submit the given options as a vote
Declaration
Parameters
optionsThe options to be submitted. If the voting event is ordered then they need to be in 1st, 2nd, 3rd, …, nth choice order
callbackFunction to be called when done
-
Get the results of an event.

Declaration
Parameters
eventEvent to get the events of
callbackFunction to be called when done
resultsThe results requested
errorError encountered (if any)
-
Releases the results

Declaration
Swift
public func release(callback: @escaping DALIapi.SuccessCallback)Parameters
callbackFunction called when done
-
Adds an option to the event

Declaration
Swift
public func addOption(option: String, callback: @escaping DALIapi.SuccessCallback)Parameters
optionThe option to be added
callbackFunction called when done
-
Get the current voting event
Declaration
Swift
public static func getCurrent(callback: @escaping (_ events: [VotingEvent], _ error: DALIError.General?) -> Void)Parameters
callbackFunction called when done
eventEvent found (if any)
errorError encountered (if any)
-
Get all events that have results released
Declaration
Swift
public static func getReleasedEvents(callback: @escaping (_ events: [VotingEvent]?, _ error: DALIError.General?) -> Void)Parameters
callbackFunction called when done
eventsList of events retrieved
errorError encountered (if any)
-
Get voting events as an admin. The signed in user must be an admin, otherwise will exit immediately

Declaration
Swift
public static func get(callback: @escaping (_ events: [VotingEvent]?, _ error: DALIError.General?) -> Void)Parameters
callbackFunction called when done
eventsList of events retrieved
errorError encountered (if any)
-
Undocumented
Declaration
Swift
public static func observe() -> Event<[VotingEvent]>
View on GitHub
VotingEvent Class Reference