DALIapi

public class DALIapi

Static class to configure and handle general requests for the DALI api framework

  • The current configuration being used by the framework

    Declaration

    Swift

    public static var config: DALIConfig { get }
  • Defines if the user is signed in

    Declaration

    Swift

    public static var isSignedIn: Bool { get }
  • A callback reporting either success or failure in the requested action

    Declaration

    Swift

    public typealias SuccessCallback = (_ success: Bool, _ error: DALIError.General?) -> Void

    Parameters

    success

    Flag indicating success in the action

    error

    Error encountered (if any)

  • Configures the entire framework

    NOTE: Make sure to run this configure method before using anything on the API

    Declaration

    Swift

    public static func configure(config: DALIConfig)
  • Enables the use of sockets

    Declaration

    Swift

    public static func enableSockets()
  • Disables all sockets used by the API

    Declaration

    Swift

    public static func disableSockets()
  • Signs in on the server using Google Signin provided server auth code

    Declaration

    Swift

    public static func signin(authCode: String, done: @escaping (_ success: Bool, _ error: DALIError.General?) -> Void)

    Parameters

    authCode

    The authCode provided by Google signin

    done

    Function called when signin is complete

    success

    The signin completed correctly

    error

    The error, if any, encountered

  • Signs in on the server using access and refresh tokens provided by Google Signin. Will not sign in if already signed in

    Declaration

    Swift

    public static func signin(accessToken: String, refreshToken: String, done: @escaping (_ success: Bool, _ error: DALIError.General?) -> Void)

    Parameters

    accessToken

    The access token provided by Google signin

    refreshToken

    The refresh token from Google siginin

    done

    Function called when signin is complete

    success

    The signin completed correctly

    error

    The error, if any, encountered

  • Signs in on the server using access and refresh tokens provided by Google Signin

    Declaration

    Swift

    public static func signin(accessToken: String, refreshToken: String, forced: Bool, done: @escaping (_ success: Bool, _ error: DALIError.General?) -> Void)

    Parameters

    accessToken

    The access token provided by Google signin

    refreshToken

    The refresh token from Google siginin

    forced

    Flag forces signin even if there is already a token avialable

    done

    Function called when signin is complete

    success

    The signin completed correctly

    error

    The error, if any, encountered

  • Silently updates the current member object from the server

    Declaration

    Swift

    public static func silentMemberUpdate(callback: @escaping (_ member: DALIMember?) -> Void)

    Parameters

    callback

    A function to be called when the opperation is complete

    member

    The updated memeber object

  • Signs out of your account on the API

    Declaration

    Swift

    public static func signOut()
  • Sends a notification to EVERY device with the given tag set to true

    Declaration

    Swift

    public static func sendSimpleNotification(with title: String, and subtitle: String, to tag: String, callback: @escaping (_ success: Bool, _ error: DALIError.General?) -> Void)

    Parameters

    title

    The title of the notification

    subtitle

    The main message to be sent

    tag

    The tag that OneSignal will use to identify recipient devices

    callback

    The function that iwll be called when the process is done

    success

    The notification was sent correctly

    error

    The error, if any, encountered