Customer account

Get Customer account information


Use this method to get a Customer’s account information.

Declared In

SNRClient.h

ClientAccountInformation

Class Name

Client

Method Name

getAccount(success:failure:)

Declaration

static func getAccount(success: ((ClientAccountInformation) -> Void), failure: ((ApiError) -> Void)) -> Void

Parameters

Parameter Type Mandatory Default Description
success ((ClientAccountInformation) -> 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.getAccount(success: { (clientAccountInformation) in
	// success
}) { (error) in
	// failure
}

Get Customer events


Retrieves the Customer’s events.

Declared In

SNRClient.h

ClientEventsApiQuery

Class Name

Client

Method Name

getEvents(apiQuery:success:failure:)

Declaration

static func getEvents(apiQuery: ClientEventsApiQuery, success: (([ClientEventData]) -> Void), failure: ((ApiError) -> Void)) -> Void

Parameters

Parameter Type Mandatory Default Description
apiQuery ClientEventsApiQuery yes - Object responsible for storing all query parameters
success (([ClientEventData]) -> 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.

Update Customer account information


Use this method to update a Customer’s account information.

This method requires the UpdateAccountInformation object with the Customer’s account information. Omitted fields are not modified.

Declared In

SNRClient.h

ClientUpdateAccountContext

Class Name

Client

Method Name

updateAccount(context:success:failure:)

Declaration

static func updateAccount(context: ClientUpdateAccountContext, success: ((Bool) -> Void), failure: ((ApiError) -> Void)) -> Void

Parameters

Parameter Type Mandatory Default Description
context ClientUpdateAccountContext yes - Object with client’s email, password, and other optional data
success ((Bool) -> 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

let agreements: ClientAgreements = ClientAgreements()
agreements.email = true
agreements.sms = true
agreements.push = true
agreements.bluetooth = true
agreements.rfid = true
agreements.wifi = true
let context: ClientUpdateAccountContext = ClientUpdateAccountContext()
context.email = "hello@synerise.com"
context.phone = "123-456-789"
context.customId = "CUSTOM_ID"
context.uuid = "UUID"
context.firstName = "FIRST_NAME"
context.lastName = "LAST_NAME"
context.displayName = "DISPLAY_NAME"
context.sex = .male
context.company = "Synerise"
context.address = "Lubostroń 1"
context.city = "Kraków"
context.province = "Małopolskie"
context.zipCode = "30-383"
context.countryCode = "+48"
context.birthDate = "01-01-2019"
context.avatarUrl = "http://www.synerise.com"
context.agreements = agreements
context.attributes = ["attribute1": "value1", "attribute2": "value2"]
context.tags = ["tag1", "tag2" "tag3"]
Client.updateAccount(context: context, success: { (success) in
	// success
}) { (error) in
	// failure
}

Change Customer’s account password


Use this method to change a Customer’s password.

Returns the HTTP 403 status code if provided old password is invalid.

Declared In

SNRClient.h

Class Name

Client

Method Name

changePassword(password:oldPassword:success:failure:)

Declaration

static func changePassword(password: String, oldPassword: String, success: ((Bool) -> Void), failure: ((ApiError) -> Void)) -> Void

Parameters

Parameter Type Mandatory Default Description
password String yes - Customer’s new password
oldPassword String yes - Customer’s old password
success ((Bool) -> 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

let newPassword: String = "NEW_PASSWORD"
let oldPassword: String = "OLD_PASSWORD"
Client.changePassword(password: newPassword, oldPassword: oldPassword, success: { (success) in
	// success
}, failure: { (error) in
	// failure
})

Request password reset for Customer account


Request a Customer’s password reset with email. The Customer will receive a token at the provided email address. That token is then used for Client.confirmResetPassword.

This method requires the Customer’s email. This method is a global operation and does not require authorization.

Declared In

SNRClient.h

ClientPasswordResetRequestContext

Class Name

Client

Method Name

requestPasswordReset(context:success:failure:)

Declaration

static func requestPasswordReset(context: ClientPasswordResetRequestContext, success: ((Bool) -> Void), failure: ((ApiError) -> Void)) -> Void

Parameters

Parameter Type Mandatory Default Description
context ClientPasswordResetRequestContext yes - Object with the Customer’s email
success ((Bool) -> 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

let email: String = "EMAIL"
let context: ClientPasswordResetRequestContext = ClientPasswordResetRequestContext(email: email)
Client.requestPasswordReset(context: context, success: { (success) in
	// success
}, failure: { (error) in
	// failure
}) 

Confirm password reset for Customer account


Confirm a Customer’s password reset with the new password and token provided by Client.requestPasswordReset(email).

This method requires the Customer’s new password and the confirmation token received by e-mail.

This method is a global operation and does not require authorization.

Declared In

SNRClient.h

ClientPasswordResetConfirmationContext

Class Name

Client

Method Name

confirmResetPassword(context:success:failure:)

Declaration

static func confirmResetPassword(context: ClientPasswordResetConfirmationContext, success: ((Bool) -> Void), failure: ((ApiError) -> Void)) -> Void

Parameters

Parameter Type Mandatory Default Description
context ClientPasswordResetConfirmationContext yes - Object with customer’s password and token
success ((Bool) -> 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

let password: String = "PASSWORD"
let token: String = "TOKEN"
let context: ClientPasswordResetConfirmationContext = ClientPasswordResetConfirmationContext(password: password, token: token)
Client.confirmResetPassword(context: context, success: { (success) in
	// success
}, failure: { (error) in
	// failure
})

Request email change for Customer account


Use this method to request a Customer’s email change.

Returns the HTTP 403 status code if the provided UUID does not exist or the password is invalid.

Declared In

SNRClient.h

Class Name

Client

Method Name

requestEmailChange(email:password:externalToken:authID:success:failure:)

Declaration

static func requestEmailChange(email: String, password: String, externalToken: AnyObject?, authID: String?, success: ((Bool) -> Void), failure: ((ApiError) -> Void)) -> Void

Parameters

Parameter Type Mandatory Default Description
email String yes - Customer’s new email
password String yes - Customer’s password
externalToken AnyObject no - Client’s token (if OAuth, Facebook etc.)
authID String no - Authorization custom identity
success ((Bool) -> 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.

Confirm email change for Customer account


Use this method to confirm an email change.

Returns the HTTP 403 status code if the provided token is invalid.

Declared In

SNRClient.h

Class Name

Client

Method Name

confirmEmailChange(token:success:failure:)

Declaration

static func confirmEmailChange(token: String, newsletterAgreement: Bool, success: ((Bool) -> Void), failure: ((ApiError) -> Void)) -> Void

Parameters

Parameter Type Mandatory Default Description
token String yes - Client’s token provided by email
newsletterAgreement Bool yes - Agreement for newsletters to the provided email
success ((Bool) -> 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

let token: String = "TOKEN"
Client.confirmEmailChange(token: token, success: { _ in
	// success
}) { (error) in
	// failure
}

Request phone update on Customer account


Use this method to request a phone number update. This action requires additional validation by PIN code.

Returns the HTTP 403 status code if the provided UUID does not exist or the password is invalid.

Declared In

SNRClient.h

Class Name

Client

Method Name

requestPhoneUpdate(phone:success:failure:)

Declaration

static func requestPhoneUpdate(phone: String, success: ((Bool) -> Void), failure: ((ApiError) -> Void)) -> Void

Parameters

Parameter Type Mandatory Default Description
phone String yes - Customer’s new phone number
success ((Bool) -> 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

let phone: String = "123-456-789"
Client.requestPhoneUpdate(phone: phone, success: { (success) in
	// success
}, failure: { (error) in
	// failure
})

Confirm phone update on Customer account


Use this method to confirm a phone number update. This action requires the new phone number and confirmation code as parameters.

Returns the HTTP 403 status code if the provided UUID does not exist or the password is invalid.

Declared In

SNRClient.h

Class Name

Client

Method Name

confirmPhoneUpdate(phone:confirmationCode:success:failure:)

Declaration

static func confirmPhoneUpdate(phone: String, confirmationCode: String, smsAgreement: Bool, success: ((Bool) -> Void), failure: ((ApiError) -> Void)) -> Void

Parameters

Parameter Type Mandatory Default Description
phone String yes - New phone number
confirmationCode String yes - Customer’s confirmation code received by phone
smsAgreement Bool yes - Agreement for SMS marketing to the provided number
success ((Bool) -> 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

let phone: String = "123-456-789"
let confirmationCode: String = "CONFIRMATION_CODE"
Client.confirmPhoneUpdate(phone: phone, confirmationCode: confirmationCode, smsAgreement: true, success: { (success) in
	// success
}) { (error) in
	// failure
}

Delete Customer account by Identity Provider


Use this method to delete a Customer’s account using an identity provider.

HTTP 403 status code will be returned if the provided credentials are invalid.

Declared In

SNRClient.h

Class Name

Client

Method Name

deleteAccount(clientAuthFactor:clientIdentityProvider:authID:success:failure:)

Declaration

static func deleteAccount(clientAuthFactor: String, clientIdentityProvider: ClientIdentityProvider, authID: String, success: ((Bool) -> Void), failure: ((ApiError) -> Void))

Parameters

Parameter Type Mandatory Default Description
clientAuthFactor String yes - Customer’s token from the identity provider
clientIdentityProvider ClientIdentityProvider yes - Customer’s identity Provider
authID String no - Authorization custom identity
success ((Bool) -> 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.

Delete Customer account


Use this method to delete a Customer’s account.

HTTP 403 status code will be returned if provided password is invalid.

Declared In

SNRClient.h

Class Name

Client

Method Name

deleteAccount(password:success:failure:)

Declaration

static func deleteAccount(password: String, success: ((Bool) -> Void), failure: ((ApiError) -> Void))

Parameters

Parameter Type Mandatory Default Description
password String yes - Client’s password
success ((Bool) -> 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

let password: String = "PASSWORD"
Client.deleteAccount(password: password, success: { (success) in
	// success
}) { (error) in
	// failure
}

Delete Customer account by OAuth


Use this method to delete an account by OAuth.

Declared In

SNRClient.h

Class Name

Client

Method Name

deleteAccountByOAuth(accessToken:success:failure:)

Declaration

static func deleteAccountByOAuth(accessToken: String, success: ((Bool) -> Void), failure: ((ApiError) -> Void)) -> Void

Parameters

Parameter Type Mandatory Default Description
accessToken String yes - OAuth Access Token
success ((Bool) -> 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.

Delete Customer account by Facebook


Use this method to delete an account by Facebook.

Returns:

  • HTTP 400 status code if the provided data is invalid.
  • HTTP 403 status code if the provided token is invalid.
  • HTTP 404 status code if the Facebook user does not exist.

Declared In

SNRClient.h

Class Name

Client

Method Name

deleteAccountByFacebook(facebookToken:success:failure:)

Declaration

static func deleteAccountByFacebook(facebookToken: String, success: ((Bool) -> Void), failure: ((ApiError) -> Void)) -> Void

Parameters

Parameter Type Mandatory Default Description
facebookToken String yes - Token from an active Facebook session
success ((Bool) -> 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

guard let facebookToken = FBSDKAccessToken.current()?.tokenString else {
	return
}
Client.deleteAccountByFacebookToken(facebookToken: facebookToken, success: { (success) in
	// success
}, failure: { (error) in
	// failure
})

Delete Customer account by Apple Sign In


Use this method to delete an account by Sign In With Apple.

Declared In

SNRClient.h

Class Name

Client

Method Name

deleteAccountByAppleSignIn(identityToken:success:failure:)

Declaration

static func deleteAccountByAppleSignIn(identityToken: Data, success: ((Bool) -> Void), failure: ((ApiError) -> Void)) -> Void

Parameters

Parameter Type Mandatory Default Description
identityToken Data yes - Token from Sign In With Apple session
success ((Bool) -> 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.

Recognize anonymous customer


Method to recognize anonymous customers and save personal information in their CRM entries.

Declared In

SNRClient.h

Class Name

Client

Method Name

recognizeAnonymous(email:customIdentify:parameters:)

Declaration

static func recognizeAnonymousWithEmail(email: String?, customIdentify: String?, parameters: [AnyHashable: Any]?) -> Void

Parameters

Parameter Type Mandatory Default Description
email String no - Customer’s email
customIdentify String no - Customer’s custom identifier
parameters [AnyHashable: Any] no - Customer’s custom parameters

Return Value

There is no return value.

Examples

let email = "EMAIL"
let customIdentify = "CUSTOM_IDENTIFIER"
let parameters = ["key": "value"]
Client.recognizeAnonymous(email: email, customIdentify: customIdentify, parameters: parameters)
😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.