APIClient
public class APIClient : NSObject
Class used to access the API associated with this app
-
Shared instance of the APIClient
Declaration
Swift
public static let shared: APIClient -
Authenticates user with server (needs to be done before other requests, otherwise an APIError.notAuthenticated occurs)
Declaration
Parameters
usernameUsername of user
passwordPassword of user
cloudUserIdAssociated Cloud User Id
environmentEnvironment to use
completionCompletion block that gets called on response
-
Type of push notification (SSE) to the gateway
Declaration
Swift
public enum GatewayPushEvent -
Push event to gateway (SSE)
Declaration
Swift
public func pushEventToGateway(_ gateway: SPGateway, event: GatewayPushEvent, completion: @escaping (_ success: Bool, _ response: JSON?, _ error: APIError?) -> Void)Parameters
gatewaySPGateway that should receive the notification
eventThe type of the notification
completionCompletion block that gets called on response
-
Sends a SMS message to the provided receiver
Declaration
Parameters
messageThe message
receiverSPNumber that should receive the message
gatewaySPGateway that should send out the message
completionCompletion block that gets called on response
-
Cross-checks local device info and registers/updates info on server (gives back an error if the device got revoked by server)
Declaration
Parameters
deviceSPDevice object of the current device
completionClosure that gets called after server response
-
Cross-checks local device info and registers/updates VoIP APN Token of device
Declaration
Swift
public func register(voipToken token: String, completion: @escaping (_ success: Bool, _ error: APIError?) -> Void)Parameters
tokenVoIP APN Token provided by PushKit
completionClosure that gets called after server response
-
Sets the iCloud Sync State of the current device (either sync or keep data local)
Declaration
Swift
public func setiCloudSyncState(_ newState: Bool, completion: @escaping (_ success: Bool, _ error: APIError?) -> Void)Parameters
newStateNew state. Either synced by iCloud (true) or not (false).
completionClosure that gets called after server response
-
Revokes a device using its Identifier
Declaration
Swift
public func revokeDevice(withId id: String, completion: @escaping (_ success: Bool, _ error: APIError?) -> Void)Parameters
idIdentifier of the device
completionClosure that gets called after server response
-
Revokes all devices with iCloud Sync enabled of the provided account
Declaration
Swift
public func revokeAllDevicesWithiCloudSyncEnabled(completion: @escaping (_ success: Bool, _ error: APIError?) -> Void)Parameters
completionClosure that gets called after server response
-
Rekoves the device that makes the request
Declaration
Swift
public func revokeThisDevice(completion: @escaping (_ success: Bool, _ error: APIError?) -> Void)Parameters
completionClosure that gets called after server response
APIClient Class Reference