Customer session
Refresh Customer token
Refreshes the customer’s token.
Declared In
SNRClient.h
Class Name
Method Name
refreshToken(success:failure:)
Declaration
static func refreshToken(success: (() -> Void), failure: ((ApiError) -> Void)) -> Void
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
success | (() -> Void) |
yes | - | Closure/Block to be executed when the operation finishes successfully |
failure | ((ApiError) -> Void) |
yes | - | Closure/Block to be executed when the operation finishes unsuccessfully |
Return Value
There is no return value.
Example
Client.refreshToken(success: { _ in
Client.retrieveToken(success: { (token) in
// success
let tokenString: String = token.tokenString
let tokenOrigin: TokenOrigin = token.tokenOrigin
}, failure: { (error) in
// failure
})
}, failure: { (error) in
// failure
})
Retrieve Customer token
Retrieves the customer’s token.
This method provides a valid token if the customer is signed in and the current token is not expired.
Declared In
SNRClient.h
Related To
Class Name
Method Name
retrieveToken(success:failure:)
Declaration
static func retrieveToken(success: ((Token) -> Void), failure: ((ApiError) -> Void)) -> Void
Parameters
| Parameter | Type | Mandatory | Default | Description |
| success | ((Token) -> Void)
| yes | - | Closure/Block to be executed when the operation finishes successfully |
| failure | ((ApiError) -> Void)
| yes | - | Closure/Block to be executed when the operation finishes unsuccessfully |
Return Value
There is no return value.
Example
Client.retrieveToken(success: { (token) in
// success
let tokenString: String = token.tokenString
let tokenOrigin: TokenOrigin = token.tokenOrigin
}, failure: { (error) in
// failure
})
Get current Customer UUID
Retrieves the customer’s UUID.
Declared In
SNRClient.h
Class Name
Method Name
getUUID()
Declaration
static func getUUID() -> String
Return Value
Method returns NSString/String with the Customer’s UUID.
Example
let clientUUID: String = Client.getUUID()
Regenerate Customer
Regenerates the customer’s UUID and clears authentication token, login (if applicable), custom email, and custom identifier.
Declared In
SNRClient.h
Class Name
Method Name
regenerateUUID()
Declaration
static func regenerateUUID() -> Void
Return Value
true
if the Current Client is anonymous and the operation succeed, false
otherwise.
Regenerate Customer with identifier
Regenerates the customer’s UUID and clears authentication token, login (if applicable), custom email, and custom identifier.
Declared In
SNRClient.h
Class Name
Method Name
regenerateUUID(clientIdentifier:)
Declaration
static func regenerateUUID(clientIdentifier: String?) -> Void
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
clientIdentifier | String |
no | - | It is a seed for UUID generation |
Destroy current session
Destroys the whole session completely.
Declared In
SNRClient.h
Class Name
Method Name
destroySession()
Declaration
static func destroySession()
Return Value
There is no return value.
Example
Client.destroySession()