ThinCloud
public class ThinCloud: OAuth2TokenDelegate
General container responsible for retaining the ThinCloud and VirtualGateway instances.
-
The ThinCloud SDK singleton.
Declaration
Swift
public static let shared = ThinCloud() -
The ThinCloud Virtual Gateway singleton.
Declaration
Swift
public let virtualGateway = VirtualGateway()
-
The ThinCloud deployment used.
Declaration
Swift
public private(set) var instance: String! -
The user signed in to the ThinCloud instance. If nil, no user is signed in.
Declaration
Swift
public private(set) var currentUser = Persistence.cachedUser() -
The client of the user associated with the current ThinCloud instance. If nil, no user is signed in.
Declaration
Swift
public private(set) var currentClient = Persistence.cachedClient() -
Configures the ThinCloud singleton with your deployment and client keys.
Declaration
Swift
public func configure(instance: String, clientId: String, apiKey: String)Parameters
instanceThe ThinCloud instance name, i.e. api.instance.yonomi.cloud
clientIdThe OAuth client key.
apiKeyThe ThinCloud API key.
-
A convenience method for UIApplication.shared.registerForRemoteNotifications().
Declaration
Swift
public func registerClient()
-
Signs in a user creating a session inside the ThinCloud singleton.
Declaration
Swift
public func signIn(email: String, password: String, completion: @escaping (_ error: Error?, _ user: User?) -> Void)Parameters
emailThe user’s e-mail address.
passwordThe user’s password.
completionThe handler called after a sign in attempt is completed.
-
Signs out the user session inside the ThinCloud singleton.
Declaration
Swift
public func signOut() -
Begins the user password reset process.
Declaration
Swift
public func resetPassword(email: String, completion: @escaping (_ error: Error?) -> Void)Parameters
emailThe user’s e-mail address.
completionThe handler called after a reset attempt is completed.
-
Verifies a password change of a user.
Declaration
Swift
public func verifyResetPassword(email: String, password: String, confirmationCode: String, completion: @escaping (_ error: Error?) -> Void)Parameters
emailThe user’s e-mail address.
passwordThe user’s new password.
confirmationCodeThe confirmation code sent to the user’s e-mail address.
completionThe handler called after a sign in attempt is completed.
-
Verifies a new user.
Declaration
Swift
public func verifyUser(email: String, confirmationCode: String, completion: @escaping (_ error: Error?) -> Void)Parameters
emailThe user’s e-mail address.
confirmationCodeThe confirmation code sent to the user’s e-mail address.
completionThe handler called after a sign in attempt is completed.
-
Resends a verification e-mail to new user.
Declaration
Swift
public func resendUserVerification(email: String, completion: @escaping (_ error: Error?) -> Void)Parameters
emailThe user’s e-mail address.
completionThe handler called after a sign in attempt is completed.
-
Creates a user.
Declaration
Swift
public func createUser(name: String, email: String, password: String, completion: @escaping (_ error: Error?, _ user: User?) -> Void)Parameters
nameThe user’s name.
emailThe user’s e-mail.
passwordThe user’s password.
completionThe handler called after a user creation attempt is completed.
-
Fetches the signed in user associated with the ThinCloud SDK instance.
Declaration
Swift
public func getUser(completion: @escaping (_ error: Error?, _ user: User?) -> Void)Parameters
completionThe handler called after a user fetch attempt is completed.
-
Updates a the signed in user associated with the ThinCloud SDK instance.
Declaration
Swift
public func updateUser(_ updates: UserUpdateRequest, completion: @escaping (_ error: Error?, _ user: User?) -> Void)Parameters
updatesThe changes to the user.
completionThe handler called after a user update attempt is completed.
-
Deletes the current user associated with the ThinCloud SDK instance.
Declaration
Swift
public func deleteUser(completion: @escaping (_ error: Error?) -> Void)Parameters
completionThe handler called after a user delete attempt is completed.
-
Fetches all devices associated with the current user.
Declaration
Swift
public func getDevices(completion: @escaping (_ error: Error?, _ device: [Device]?) -> Void)Parameters
completionThe handler called after a device fetch attempt is completed.
-
Fetches a specified device by its deviceId.
Declaration
Swift
public func getDevice(deviceId: String, completion: @escaping (_ error: Error?, _ device: Device?) -> Void)Parameters
deviceIdThe ThinCloud generated device identifier.
completionThe handler called after a device fetch attempt is completed.
-
Creates a device.
Declaration
Swift
public func createDevice(device: DeviceCreateRequest, completion: @escaping (_ error: Error?, _ device: Device?) -> Void)Parameters
deviceThe device to create.
completionThe handler called after a device creation attempt is completed.
-
Updates a device.
Declaration
Swift
public func updateDevice(deviceId: String, updates: DeviceUpdateRequest, completion: @escaping (_ error: Error?, _ device: Device?) -> Void)Parameters
deviceIdThe ThinCloud generated device identifier.
updatesThe changes to the device.
completionThe handler called after a device update attempt is completed.
-
Deletes a device.
Declaration
Swift
public func deleteDevice(deviceId: String, completion: @escaping (_ error: Error?) -> Void)Parameters
deviceIdThe ThinCloud generated device identifier.
completionThe handler called after a device deletion attempt is completed.
-
Fetches all clients associated with the current user.
Declaration
Swift
public func getClients(completion: @escaping (_ error: Error?, _ clients: [Client]?) -> Void)Parameters
completionThe handler called after a client fetch attempt is completed.
ThinCloud Class Reference