AuthenticationAPI
public enum AuthenticationAPI
Caseless enumeration with static methods to send Authentication Requests.
-
Enumeration representing the type of social media network for login.
See moreDeclaration
Swift
public enum SocialLoginType : String
-
Enumeration representing keys for sign up parameters.
See moreDeclaration
Swift
public enum SignUpParameterKeys : String
-
Sends a request to log in to the API.
Declaration
Swift
public static func logIn(with parameters: Parameters? = nil, completion: ResponseCompletion<AuthenticationInfo> = nil)
Parameters
parameters
The
Parameters
to apply.completion
The closure to be executed once the request has finished.
-
Sends a request to log in the user using email and password to the API.
Declaration
Swift
public static func logIn(email: String, password: String, completion: ResponseCompletion<AuthenticationInfo> = nil)
Parameters
email
The user’s email address.
password
The user’s password.
completion
The closure to be executed once the request has finished.
-
Sends a request to log in the user using email and password to the API.
Declaration
Swift
public static func logIn(phoneNumber: String, password: String, completion: ResponseCompletion<AuthenticationInfo> = nil)
Parameters
phoneNumber
The user’s phone number.
password
The user’s password.
completion
The closure to be executed once the request has finished.
-
Sends a request to log in the user using email and password to the API.
Declaration
Swift
public static func logIn(socialNetwork: SocialLoginType, accessToken: String, completion: ResponseCompletion<AuthenticationInfo> = nil)
Parameters
socialNetwork
The user’s phone number.
accessToken
The user’s password.
completion
The closure to be executed once the request has finished.
-
Sends a request to refresh the current access token of the user session.
Declaration
Swift
public static func refreshToken(refreshToken: String, completion: ResponseCompletion<AuthenticationInfo> = nil)
Parameters
refreshToken
The user session’s access token.
completion
The closure to be executed once the request has finished.
-
Sends a request to login to the API.
Declaration
Swift
public static func signUp(with parameters: Parameters?, completion: ResponseCompletion<AuthenticationInfo> = nil)
Parameters
parameters
The
Parameters
to apply. Commonly used parameter keys can be found in theSignUpParameterKeys
enumeration.completion
The closure to be executed once the request has finished.
-
Sends a request to resend email confirmation for the specified email to the API.
Declaration
Swift
public static func resendEmailConfirmation(email: String, completion: ResponseCompletion<String> = nil)
Parameters
email
The user’s email address.
completion
The closure to be executed once the request has finished.
-
Logs out the user for the current session by clearing their credentials and resetting the session of the
API
shared instance.Note
This API call succeeds regardless if an access token is found or not. This will only get an error if there are problems on the server.Declaration
Swift
public static func logOut(completion: ResponseCompletion<AnyCodable> = nil)