Account
final class Account
Class providing Account related actions.
-
Social login closure typealias containing account and error.
Declaration
Swift
public typealias SocialLoginCompletion = (_ account: InPlayerAccount?, _ error: InPlayerError?) -> VoidParameters
accountThe obtained account.
errorThe error that might occur.
-
Get user credentials if present, else returns nil.
Declaration
Swift
public static func getCredentials() -> InPlayerCredentials?Return Value
User credentials or nil.
-
Removes account and user credentials
Declaration
Swift
public static func removeCredentials() -
Get account if logged in, else it returns nil
Declaration
Swift
public static func getAccountInfo() -> InPlayerAccount?Return Value
Account or nil
-
Check if current user has valid access token.
Declaration
Swift
public static func isAuthenticated() -> BoolReturn Value
Bool result of the check.
-
Creates new account.
Declaration
Swift
public static func signUp(fullName: String, email: String, password: String, passwordConfirmation: String, brandingID: Int? = nil, metadata: [String: Any]? = nil, success: @escaping (_ authorization: InPlayerAuthorization) -> Void, failure: @escaping (_ error: InPlayerError) -> Void)Parameters
fullNameAccount’s first and last name
emailAccount’s email address
passwordPassword containing minimum 8 characters
passwordConfirmationThe same password with minimum 8 characters
metadataAdditional information about the account that can be attached to the account object
brandingIDOptional parameter - system branding theme ID
successA closure to be executed once the request has finished successfully.
authorizationAuthorization model containing info regarding token and account
failureA closure to be executed once the request has finished with error.
errorContaining information about the error that occurred.
-
Gets the account information for a given authorization token
Declaration
Swift
public static func getAccount(success: @escaping (_ account: InPlayerAccount) -> Void, failure: @escaping (_ error: InPlayerError) -> Void)Parameters
successA closure to be executed once the request has finished successfully.
accountContains account info
failureA closure to be executed once the request has finished with error.
errorContaining information about the error that occurred.
-
Authenticates account using username and password
Declaration
Swift
public static func authenticate(username: String, password: String, success: @escaping (_ authorization: InPlayerAuthorization) -> Void, failure: @escaping (_ error: InPlayerError) -> Void)Parameters
usernameThe email address of the account.
passwordThe account password
successA closure to be executed once the request has finished successfully.
authorizationModel containing access tokens and logged in account.
failureA closure to be executed once the request has finished with error.
errorContaining information about the error that occurred.
-
Logout currently authenticated account
Declaration
Swift
public static func signOut(success: @escaping () -> Void, failure: @escaping (_ error: InPlayerError) -> Void)Parameters
successA closure to be executed once the request has finished successfully.
failureA closure to be executed once the request has finished with error.
errorContaining information about the error that occurred.
-
Updates account information.
Declaration
Swift
public static func updateAccount(fullName: String, metadata: [String : Any]? = nil, success: @escaping (_ account: InPlayerAccount) -> Void, failure: @escaping (_ error: InPlayerError) -> Void)Parameters
fullNameThe full name of the account.
metadataAdditional information about the account that can be attached to the account object
successA closure to be executed once the request has finished successfully.
accountContains account info.
failureA closure to be executed once the request has finished with error.
errorContaining information about the error that occurred.
-
Updates account password.
Declaration
Swift
public static func changePassword(oldPassword: String, newPassword: String, newPasswordConfirmation: String, brandingID: Int? = nil, success: @escaping () -> Void, failure: @escaping (_ error: InPlayerError) -> Void)Parameters
oldPasswordAccount’s old password.
newPasswordThe account’s new password
newPasswordConfirmationThe account’s new password for confirmation.
brandingIDOptional parameter - system branding theme ID
successA closure to be executed once the request has finished successfully.
failureA closure to be executed once the request has finished with error.
errorContaining information about the error that occurred.
-
Deletes account and all information stored with it.
Declaration
Swift
public static func deleteAccount(password: String, brandingID: Int? = nil, success: @escaping () -> Void, failure: @escaping (_ error: InPlayerError) -> Void)Parameters
passwordPassword confirmation.
brandingIDOptional parameter - system branding theme ID
successA closure to be executed once the request has finished successfully.
failureA closure to be executed once the request has finished with error.
errorContaining information about the error that occurred.
-
Sets new password for account using the token from account’s email.
Declaration
Swift
public static func setNewPassword(token: String, password: String, passwordConfirmation: String, brandingID: Int? = nil, success: @escaping () -> Void, failure: @escaping (_ error: InPlayerError) -> Void)Parameters
tokenThe forgot password token sent to your email address.
passwordThe account’s new password.
passwordConfirmationThe password confirmation.
brandingIDOptional parameter - system branding theme ID
successA closure to be executed once the request has finished successfully.
failureA closure to be executed once the request has finished with error.
errorContaining information about the error that occurred.
-
Sends forgot password instructions on specified email.
Declaration
Swift
public static func requestNewPassword(email: String, brandingID: Int? = nil, success: @escaping () -> Void, failure: @escaping (_ error: InPlayerError) -> Void)Parameters
emailAccount’s email address.
brandingIDOptional parameter - system branding theme ID
successA closure to be executed once the request has finished successfully.
failureA closure to be executed once the request has finished with error.
errorContaining information about the error that occurred.
-
Refreshes account
access_tokenDeclaration
Swift
public static func refreshToken(using refreshToken: String, success: @escaping (_ authorization: InPlayerAuthorization) -> Void, failure: @escaping (_ error: InPlayerError) -> Void)Parameters
refreshTokenAn auto-generated token that enables access when the original access token has expired without requiring re authentication
successA closure to be executed once the request has finished successfully.
authorizationModel containing access tokens and logged in account.
failureA closure to be executed once the request has finished with error.
errorContaining information about the error that occurred.
-
Exports account data such as logins, payments, subscriptions, access to assets etc. After invoking the request the account will receive the data in a json format via e-mail.
Declaration
Swift
public static func exportData(password: String, brandingID: Int? = nil, success: @escaping () -> Void, failure: @escaping (_ error: InPlayerError) -> Void)Parameters
passwordPassword of the current logged user
brandingIDOptional parameter - system branding theme ID
successA closure to be executed once the request has finished successfully.
failureA closure to be executed once the request has finished with error.
errorContaining information about the error that occurred.
-
Gets register fields
Declaration
Swift
public static func getRegisterFields(success: @escaping (_ registerFields: [InPlayerRegisterField]) -> Void, failure: @escaping (_ error: InPlayerError) -> Void)Parameters
successA closure to be executed once the request has finished successfully.
registerFieldsInPlayerRegisterFieldstruct optionally containing associated values depending on the type enum.failureA closure to be executed once the request has finished with error.
errorContaining information about the error that occurred.
-
Get List of Social URLs
Declaration
Swift
public static func getSocialUrls(redirectUri: String, success: @escaping (_ socialURLs: [InPlayerSocialUrl]) -> Void, failure: @escaping (_ error: InPlayerError) -> Void)Parameters
successA closure to be executed once the request has finished successfully.
socialURLsArray of objects, each containing different social service and its url.
failureA closure to be executed once the request has finished with error.
errorContaining information about the error that occurred.
-
Validates social login redirect url
Declaration
Swift
public static func validateSocialLogin(url: URL)Parameters
urlThe redirect url to be processed.
-
Opens external browser with the provided url.
Declaration
Swift
public static func socialLogin(withUrl url: URL, completion: @escaping SocialLoginCompletion)Parameters
urlThe social url that needs to be open.
completionA closure to be executed once the request has finished. It contains
accountif the loging was successfull orerrorif something went wrong. -
Creates pin code and sends it to your email
Declaration
Swift
public static func sendPinCode(brandingID: Int?, success: @escaping () -> Void, failure: @escaping (_ error: InPlayerError) -> Void)Parameters
brandingIDOptional parameter - system branding theme ID
successA closure to be executed once the request has finished successfully.
failureA closure to be executed once the request has finished with error.
errorContaining information about the error that occurred.
-
Checks validity of pin code
Declaration
Swift
public static func validatePinCode(_ pinCode: String, success: @escaping () -> Void, failure: @escaping (_ error: InPlayerError) -> Void)Parameters
pinCodeThe pin code that was sent to your email
successA closure to be executed once the request has finished successfully.
failureA closure to be executed once the request has finished with error.
errorContaining information about the error that occurred.
View on GitHub
Account Class Reference