DALIEvent
public class DALIEvent
A DALI event
-
Name of the event
Declaration
Swift
public var name: String { get set }
-
Description of the event
Declaration
Swift
public var description: String? { get set }
-
Location of the event
Declaration
Swift
public var location: String? { get set }
-
Start time of the event
Declaration
Swift
public var start: Date { get set }
-
Start time of the event
Declaration
Swift
public var end: Date { get set }
-
The identifier used by the server
Declaration
Swift
public private(set) var id: String!
-
Signifies when this event object contains information that has not been saved
Declaration
Swift
public private(set) var dirty: Bool
-
A flag that indicates if this event can be edited
Declaration
Swift
public var editable: Bool { get }
-
A flag that indicates if this event is happening now
Declaration
Swift
public var isNow: Bool { get }
-
Creates an event object
Declaration
Swift
public init(name: String, description: String?, location: String?, start: Date, end: Date)
Parameters
name
The name of the event
description
The description of the event
location
The location of the event
start
The start time
end
End time
-
Creates the event on the server
Throws
DALIError.Create
error describing some error encounteredDeclaration
Swift
public func create(callback: @escaping (Bool, DALIError.General?) -> Void) throws
Parameters
callback
A function that will be called when the job is done
-
Parses a given json object and returns an event object if it can find one
Declaration
Swift
public class func parse(_ object: JSON) -> DALIEvent?
Parameters
object
The JSON object you want parsed
Return Value
DALIEvent
that was found. Will be nil if object is not event -
Get the event in JSON form. Converts all data in the event into a form the API would use
Declaration
Swift
public func json() -> JSON
-
Pulls all the events from the server
Declaration
Swift
public static func getAll(callback: @escaping (_ events: [DALIEvent]?, _ error: DALIError.General?) -> Void)
Parameters
callback
Function called when done
events
The events returned by the API
error
The error encountered (if any)
-
Observes all events. Will call callback every time something changes
Declaration
Swift
public static func observeAll(callback: @escaping (_ events: [DALIEvent]?, _ error: DALIError.General?) -> Void) -> Observation
Parameters
callback
The function called when the updates occur
events
The updated events
error
The error, if any, encountered
-
Observes all upcoming events. Will call callback every time something changes
Declaration
Swift
public static func observeUpcoming(callback: @escaping (_ events: [DALIEvent]?, _ error: DALIError.General?) -> Void) -> Observation
Parameters
callback
The function to call when done
events
The events
error
The error, if any, encountered
-
Observe future events
Declaration
Swift
public static func observeFuture(includeHidden: Bool = false, callback: @escaping (_ events: [DALIEvent]?, _ error: DALIError.General?) -> Void) -> Observation
Parameters
includeHidden
Include events marked as hidden (admin only)
callback
The function to call when update happens
events
The updated events
error
The error, if any, encountered
-
Observes public events.
Declaration
Swift
public static func observePublicUpcoming(callback: @escaping (_ events: [DALIEvent]?, _ error: DALIError.General?) -> Void) -> Observation
Parameters
callback
The function called when the data is updated
events
The events that have been updated
error
The error, if any, encountered
-
Gets all upcoming events within a week from now
Declaration
Swift
public static func getUpcoming(callback: @escaping (_ events: [DALIEvent]?, _ error: DALIError.General?) -> Void)
Parameters
callback
Function called when done
events
The events returned by the API
error
The error encountered (if any)
-
Gets all upcoming events within a week from now that are public No authorization is needed for this route
Declaration
Swift
public static func getPublicUpcoming(callback: @escaping (_ events: [DALIEvent]?, _ error: DALIError.General?) -> Void)
Parameters
callback
Function called when done
events
The events returned by the API
error
The error encountered (if any)
-
Gets all events in the future
Declaration
Swift
public static func getFuture(includeHidden: Bool = false, callback: @escaping (_ events: [DALIEvent]?, _ error: DALIError.General?) -> Void)
Parameters
includeHidden
Include events that have been marked hidden (admin only)
callback
Function called when done
events
The events returned by the API
error
The error encountered (if any)
-
Enable voting on this event
Declaration
Swift
public func enableVoting(numSelected: Int, ordered: Bool, callback: @escaping (_ success: Bool, _ event: VotingEvent?, _ error: DALIError.General?) -> Void)
Parameters
numSelected
Number of options the user should select
ordered
The choices the user makes should be ordered (1st, 2nd, 3rd, …)
callback
Function to call when done
success
Flag to indicate that the event has been properly enabled for voting
event
The new VotingEvent, if it was successful
error
The error encountered if it was not successful
-
Checks in the current user to whatever event is happening now
Declaration
Swift
public static func checkIn(major: Int, minor: Int, callback: @escaping (_ success: Bool, _ error: DALIError.General?) -> Void)
Parameters
major
The major value of the bluetooth beacon
minor
The minor value of the beacon
callback
Called when done
success
The operation was a success
error
The error, if any, encountered
-
Enables checkin on the event, and gets back major and minor values to be used when advertizing
Declaration
Swift
public func enableCheckin(callback: @escaping (_ success: Bool, _ major: Int?, _ minor: Int?, _ error: DALIError.General?) -> Void)
Parameters
callback
Called when done
success
The operation was a success
major
The major value of the bluetooth beacon
minor
The minor value of the beacon
error
The error, if any, encountered
-
Gets a list of members who have checked in
Declaration
Swift
public func getMembersCheckedIn(callback: @escaping (_ members: [DALIMember], _ error: DALIError.General?) -> Void)
Parameters
callback
Called when done
members
The members who have been checked in to the event
error
The error, if any, encountered
-
Observe the list of members whom have checked in
Declaration
Swift
public func observeMembersCheckedIn(callback: @escaping (_ members: [DALIMember]) -> Void) -> Observation
Parameters
callback
Called when complete
memebers
The members who have checked in