Customer account management
Get customer account information
This method gets a customer’s account information.
This method requires customer authentication.
API_PERSONAL_INFORMATION_CLIENT_READ
permission from the Client group.Declared In:
Headers/SNRClient.h
Related To:
ClientAccountInformation
Class:
Client
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 is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
Client.getAccount(success: { (clientAccountInformation) in
// success
}) { (error) in
// failure
}
Get customer’s events
This method retrieves events for an authenticated customer.
This method requires customer authentication.
Declared In:
Headers/SNRClient.h
Related To:
ClientEventsApiQuery
Class:
Client
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 is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Update customer account basic information
This method updates a customer’s account’s basic information (without identification data: uuid, customId, email).
This method requires the context object with the customer’s account information. Omitted fields are not modified.
This method does not require customer authentication and can be used by anonymous profiles.
iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
---|---|---|---|---|
Introduced in: | 4.22.0 | 5.21.0 | 0.24.0 | 1.4.0 |
API_BASIC_INFORMATION_CLIENT_UPDATE
permission from the Client group.Declared In:
Headers/SNRClient.h
Related To:
ClientUpdateAccountBasicInformationContext
Class:
Client
Declaration:
static func updateAccountBasicInformation(context: ClientUpdateAccountBasicInformationContext, success: ((Bool) -> Void), failure: ((ApiError) -> Void)) -> Void
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
context | ClientUpdateAccountBasicInformationContext | yes | - | Object with customer’s basic information optional data |
success | ((Bool) -> Void) | yes | - | Closure/Block to be executed when the operation is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Update customer account information
This method updates a customer’s account information.
This method requires the context object with the customer’s account information. Omitted fields are not modified.
This method requires customer authentication.
API_PERSONAL_INFORMATION_CLIENT_UPDATE
permission from the Client group.Declared In:
Headers/SNRClient.h
Related To:
ClientUpdateAccountContext
Class:
Client
Declaration:
static func updateAccount(context: ClientUpdateAccountContext, success: ((Bool) -> Void), failure: ((ApiError) -> Void)) -> Void
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
context | ClientUpdateAccountContext | yes | - | Object with customer’s email, password, and other optional data |
success | ((Bool) -> Void) | yes | - | Closure/Block to be executed when the operation is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
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
This method changes a customer’s password.
This method requires customer authentication.
SAUTH_CHANGE_PASSWORD_CLIENT_UPDATE
permission from the Client group.Declared In:
Headers/SNRClient.h
Class:
Client
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 is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
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
This method requests a customer’s password reset with email. The customer will receive a token to the provided email address. That token is then used for the confirmation of password reset.
This method requires the customer’s email.
This method is a global operation and doesn’t require customer authentication.
SAUTH_PASSWORD_RESET_CLIENT_CREATE
permission from the Client group.Declared In:
Headers/SNRClient.h
Related To:
ClientPasswordResetRequestContext
Class:
Client
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 is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
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
This method confirm a customer’s password reset with the new password and token provided by password reset request.
This method requires the customer’s new password and the confirmation token received by e-mail.
This method is a global operation and doesn’t require customer authentication.
SAUTH_PASSWORD_RESET_CLIENT_CREATE
permission from the Client group.Declared In:
Headers/SNRClient.h
Related To:
ClientPasswordResetConfirmationContext
Class:
Client
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 is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
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
This method requests a customer’s email change.
This method is a global operation and doesn’t require customer authentication.
SAUTH_CHANGE_EMAIL_CLIENT_UPDATE
permission from the Client group.Declared In:
Headers/SNRClient.h
Class:
Client
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 |
---|---|---|---|---|
String | yes | - | Customer’s new email | |
password | String | yes | - | Customer’s password |
externalToken | AnyObject | no | - | Customer’s token (if OAuth, Facebook, and so on) |
authID | String | no | - | Optional identifier of authorization |
success | ((Bool) -> Void) | yes | - | Closure/Block to be executed when the operation is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Confirm email change for customer account
This method confirms an email change.
This method is a global operation and doesn’t require customer authentication.
SAUTH_CHANGE_EMAIL_CLIENT_UPDATE
permission from the Client group.Declared In:
Headers/SNRClient.h
Class:
Client
Declaration:
static func confirmEmailChange(token: String, newsletterAgreement: Bool, success: ((Bool) -> Void), failure: ((ApiError) -> Void)) -> Void
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
token | String | yes | - | Customer’s token provided in an email |
newsletterAgreement | Bool | yes | - | Agreement for sending newsletters to the provided email |
success | ((Bool) -> Void) | yes | - | Closure/Block to be executed when the operation is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
let token: String = "TOKEN"
Client.confirmEmailChange(token: token, success: { _ in
// success
}) { (error) in
// failure
}
Request phone update on customer account
This method requests a customer’s phone update. A confirmation code is sent to the phone number.
This method is a global operation and doesn’t require customer authentication.
API_PERSONAL_PHONE_CLIENT_CREATE
permission from the Client group.Declared In:
Headers/SNRClient.h
Class:
Client
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 is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
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
This method confirms a phone number update. This action requires the new phone number and confirmation code as parameters.
This method is a global operation and doesn’t require customer authentication.
API_PERSONAL_PHONE_CLIENT_CREATE
permission from the Client group.Declared In:
Headers/SNRClient.h
Class:
Client
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 | - | A confirmation code received by a text message |
smsAgreement | Bool | yes | - | Agreement for sending SMS to the provided number |
success | ((Bool) -> Void) | yes | - | Closure/Block to be executed when the operation is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
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
This method deletes a customer’s account.
This method requires customer authentication.
SAUTH_CLIENT_DELETE
, SAUTH_OAUTH_CLIENT_DELETE
, SAUTH_FACEBOOK_CLIENT_DELETE
, SAUTH_APPLE_CLIENT_DELETE
permissions from the Client group.Declared In:
Headers/SNRClient.h
Class:
Client
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 | - | Optional identifier of authorization |
success | ((Bool) -> Void) | yes | - | Closure/Block to be executed when the operation is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Deprecated methods
Delete customer account
This method deletes a customer’s account.
This method requires customer authentication.
iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
---|---|---|---|---|
Introduced in: | 3.6.11 | 3.6.13 | 0.9.12 | n/a |
Deprecated in: | 3.6.19 | 3.6.19 | 0.14.0 | n/a |
SAUTH_CLIENT_DELETE
permission from the Client group.Declared In:
Headers/SNRClient.h
Class:
Client
Declaration:
static func deleteAccount(password: String, success: ((Bool) -> Void), failure: ((ApiError) -> Void))
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
password | String | yes | - | Customer’s password |
success | ((Bool) -> Void) | yes | - | Closure/Block to be executed when the operation is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
let password: String = "PASSWORD"
Client.deleteAccount(password: password, success: { (success) in
// success
}) { (error) in
// failure
}
Delete customer account by OAuth
This method deletes a customer’s account by OAuth.
This method requires customer authentication.
iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
---|---|---|---|---|
Introduced in: | 3.6.11 | 3.6.13 | 0.9.12 | n/a |
Deprecated in: | 3.6.19 | 3.6.19 | 0.14.0 | n/a |
SAUTH_CLIENT_DELETE
and SAUTH_OAUTH_CLIENT_DELETE
permissions from the Client group.Declared In:
Headers/SNRClient.h
Class:
Client
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 is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Delete customer account by Facebook
This method deletes a customer’s account by Facebook.
This method requires customer authentication.
iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
---|---|---|---|---|
Introduced in: | 3.3.8 | 3.3.0 | 0.9.12 | n/a |
Deprecated in: | 3.6.19 | 3.6.19 | 0.14.0 | n/a |
SAUTH_CLIENT_DELETE
and SAUTH_FACEBOOK_CLIENT_DELETE
permissions from the Client group.Declared In:
Headers/SNRClient.h
Class:
Client
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 is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.
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
This method deletes a customer’s account information by Sign In With Apple.
This method requires customer authentication.
iOS SDK | Android SDK | React Native SDK | Flutter SDK | |
---|---|---|---|---|
Introduced in: | 3.6.11 | 3.6.13 | 0.9.12 | n/a |
Deprecated in: | 3.6.19 | 3.6.19 | 0.14.0 | n/a |
SAUTH_CLIENT_DELETE
and SAUTH_APPLE_CLIENT_DELETE
permissions from the Client group.Declared In:
Headers/SNRClient.h
Class:
Client
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 is completed successfully |
failure | ((ApiError) -> Void) | yes | - | Closure/Block to be executed when the operation is completed with an error |
Return Value:
No value is returned.