Customer account

Get Customer account information


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

Declared In

SNRClient.h

SNRClientAccountInformation.h

Method Name

Client.getAccount(success:failure:)

Declaration

func getAccount(success: ((SNRClientAccountInformation) -> ()), failure: ((Error) -> ())) -> Void) -> Void

Parameters

Parameter Type Mandatory Default Description
success Block/Closure no - Block/closure to be executed when the operation finishes successfully
failure Block/Closure no - Block/closure 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
}

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

SNRClientAgreements.h
SNRClientUpdateAccountContext.h

Method Name

Client.updateAccount(success:failure:)

Declaration

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

Parameters

Parameter Type Mandatory Default Description
context SNRClientUpdateAccountContext yes - Object with client’s email, password, and other optional data
success Block/Closure no - Block/closure to be executed when the operation finishes successfully
failure Block/Closure no - Block/closure 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

Method Name

Client.changePassword(password:oldPassword:success:failure:)

Declaration

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

Parameters

Parameter Type Mandatory Default Description
password String yes - Customer’s new password
oldPassword String yes - Customer’s old password
success Block/Closure no - Block/closure to be executed when the operation finishes successfully
failure Block/Closure no - Block/closure 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

SNRClientPasswordResetRequestContext.h

Method Name

Client.requestPasswordReset(context:success:failure:)

Declaration

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

Parameters

Parameter Type Mandatory Default Description
context SNRClientPasswordResetRequestContext yes - Object with the Customer’s email
success Block/Closure no - Block/closure to be executed when the operation finishes successfully
failure Block/Closure no - Block/closure 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

SNRClientPasswordResetConfirmationContext.h

Method Name

Client.confirmResetPassword(context:success:failure:)

Declaration

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

Parameters

Parameter Type Mandatory Default Description
context SNRClientPasswordResetConfirmationContext yes - Object with customer’s password and token
success Block/Closure no - Block/closure to be executed when the operation finishes successfully
failure Block/Closure no - Block/closure 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

Method Name

Client.requestEmailChange(email:password:success:failure:)

Declaration

func requestEmailChange(email:String, password: String, success: ((Bool) -> ()), failure: ((Error) -> ())) -> Void) -> Void

Parameters

Parameter Type Mandatory Default Description
email String yes - Customer’s new email
password String yes - Customer’s password
success Block/Closure no - Block/closure to be executed when the operation finishes successfully
failure Block/Closure no - Block/closure to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

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

Request email change by Facebook


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

Returns HTTP 403 status code if the provided UUID does not exist.

Declared In

SNRClient.h

Method Name

Client.requestEmailChangeByFacebook(email:password:success:failure:)

Declaration

func requestEmailChangeByFacebook(email: String, success: ((Bool) -> ()), failure: ((Error) -> ())) -> Void) -> Void

Parameters

Parameter Type Mandatory Default Description
email String yes - Customer’s new email
success Block/Closure no - Block/closure to be executed when the operation finishes successfully
failure Block/Closure no - Block/closure to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

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

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

Method Name

Client.confirmEmailChange(token:success:failure:)

Declaration

func confirmEmailChange(token: String, newsletterAgreement: Bool, success: ((Bool) -> ()), failure: ((Error) -> ())) -> 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 Block/Closure no - Block/closure to be executed when the operation finishes successfully
failure Block/Closure no - Block/closure 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

Method Name

Client.requestPhoneUpdate(phone:success:failure:)

Declaration

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

Parameters

Parameter Type Mandatory Default Description
phone String yes - Customer’s new phone number
success Block/Closure no - Block/closure to be executed when the operation finishes successfully
failure Block/Closure no - Block/closure 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

Method Name

Client.confirmPhoneUpdate(phone:confirmationCode:success:failure:)

Declaration

func confirmPhoneUpdate(phone: String, confirmationCode: String, smsAgreement: Bool, success: ((Bool) -> ()), failure: ((Error) -> ())) -> 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 Block/Closure no - Block/closure to be executed when the operation finishes successfully
failure Block/Closure no - Block/closure 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


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

Method Name

Client.deleteAccount(success:failure:)

Declaration

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

Parameters

Parameter Type Mandatory Default Description
password String yes - Client’s password
success Block/Closure no - Block/closure to be executed when the operation finishes successfully
failure Block/Closure no - Block/closure 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 Facebook


Use this method to delete 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

Method Name

Client.deleteAccountByFacebook(facebookToken:success:failure:)

Declaration

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

Parameters

Parameter Type Mandatory Default Description
facebookToken String yes - Token from an active Facebook session
success Block/Closure no - Block/closure to be executed when the operation finishes successfully
failure Block/Closure no - Block/closure 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
})

Recognize anonymous customer


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

Declared In

SNRClient.h

Method Name

Client.recognizeAnonymous(email:customIdentify:parameters:)

Declaration

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.