Class ProfileAPI
- java.lang.Object
-
- com.cheetahdigital.corekit.models.module.Controller
-
- com.cheetahdigital.profile.core.api.ProfileAPI
-
- All Implemented Interfaces:
RestController
public class ProfileAPI extends Controller
Cheetah Loyalty Profile ModuleAPI Controller class for Profile
-
-
Field Summary
-
Fields inherited from class com.cheetahdigital.corekit.models.module.Controller
STANDARD_DATE_FORMAT, TIMEZONE_DATE_FORMAT
-
-
Constructor Summary
Constructors Constructor Description ProfileAPI()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
changePassword(ProfileParams parameters, ProfileFields fields, ListenerModel<BaseModel<BaseData>,BaseData> listener)
Change Password API.void
connectIdentity(java.lang.String provider, ProfileParams parameters, ProfileFields fields, Listener<SuccessResponse> listener)
Connects a third party identity to the member using a unique token from the 3rd party.void
deleteAccount(ProfileParams profileParameters, ProfileFields profileFields, Listener<SuccessResponse> listener)
Delete Profile Account API.void
disconnectIdentity(java.lang.String provider, ProfileParams parameters, ProfileFields fields, Listener<SuccessResponse> listener)
Disconnects the identity from the member profile.void
getConnectedIdentities(ProfileParams parameters, boolean clearCache, ListenerModel<BaseModel<java.util.List<Identity>>,java.util.List<Identity>> listener)
Connected Identities API.void
getProfile(ProfileParams profileParameters, boolean clearCache, Listener<Profile> listener)
Profile API.void
getProfileMetadata(ProfileParams profileParameters, boolean clearCache, Listener<BaseGenericModel<java.util.List<Metadata>>> listener)
Profile Metadata API.void
requestOtpCode(ProfileParams profileParameters, Listener<SuccessResponse> listener)
API to request OTP code.void
submitReferralCode(ProfileParams parameters, Listener<SuccessResponse> listener)
Submit a referral codevoid
trackActive(ProfileParams parameters, ListenerModel<BaseModel<BaseData>,BaseData> listener)
API for tracking.void
updateAvatar(ProfileParams parameters, okhttp3.MultipartBody.Part avatar, ListenerModel<BaseModel<Avatar>,Avatar> listener)
Update Avatar API.void
updateProfile(ProfileParams parameters, ProfileFields fields, ListenerModel<BaseModel<MemberAttributes>,MemberAttributes> listener)
Update Profile API.-
Methods inherited from class com.cheetahdigital.corekit.models.module.Controller
createCache, createHttpClient, createRetrofitInterface, evictAllCache, getGsonConfiguration, getRestAdapter, getTimeoutConnectionInSeconds, getTimeoutSocketInSeconds, initialize, removeResponsesFromCache
-
-
-
-
Method Detail
-
getProfileMetadata
public void getProfileMetadata(ProfileParams profileParameters, boolean clearCache, Listener<BaseGenericModel<java.util.List<Metadata>>> listener)
Profile Metadata API. Should be called before calling the Profile API.- Parameters:
profileParameters
- theProfileParams
for Metadata APIclearCache
- set totrue
if cache should be cleared, otherwisefalse
listener
- handler for the response
-
getProfile
public void getProfile(ProfileParams profileParameters, boolean clearCache, Listener<Profile> listener)
Profile API. Retrieves the values for the member attributes / profile. Note that values will be matched from the Profile Metadata, hence, it is important that Profile Metadata is already present before using the Profile API.- Parameters:
profileParameters
- theProfileParams
for Profile API. Accepted parameters includeProfileParams.Builder.setIncludeSegments(Boolean)
clearCache
- set totrue
if cache should be cleared, otherwisefalse
listener
- handler for the response
-
deleteAccount
public void deleteAccount(ProfileParams profileParameters, ProfileFields profileFields, Listener<SuccessResponse> listener)
Delete Profile Account API.- Parameters:
profileParameters
- theProfileParams
for Profile API.profileFields
- theProfileFields
for Profile API. Accepted parameters includeProfileFields.Builder.setCode(String)
andProfileFields.Builder.setCurrentPassword(String)
listener
- handler for the response
-
requestOtpCode
public void requestOtpCode(ProfileParams profileParameters, Listener<SuccessResponse> listener)
API to request OTP code. sent from the user email.- Parameters:
profileParameters
- theProfileParams
for Profile API.listener
- handler for the response
-
updateProfile
public void updateProfile(ProfileParams parameters, ProfileFields fields, ListenerModel<BaseModel<MemberAttributes>,MemberAttributes> listener)
Update Profile API. Updates the member attributes from the values of theProfileFields
. The keys for the profile field must be taken from the keys in the Profile metadata, if not, update profile will not be successful.- Parameters:
parameters
- theProfileParams
for query parametersfields
- theProfileFields
for field parameterslistener
- handler of the response
-
updateAvatar
public void updateAvatar(ProfileParams parameters, okhttp3.MultipartBody.Part avatar, ListenerModel<BaseModel<Avatar>,Avatar> listener)
Update Avatar API. Updates the Avatar of the member, this uploads an image using aMultipartBody.Part
object.- Parameters:
parameters
- theProfileParams
for query parametersavatar
- the image file converted to aMultipartBody.Part
objectlistener
- handler of the response
-
changePassword
public void changePassword(ProfileParams parameters, ProfileFields fields, ListenerModel<BaseModel<BaseData>,BaseData> listener)
Change Password API. Changes the current password. For required fields, see field parameters- Parameters:
parameters
- theProfileParams
for query parametersfields
- theProfileFields
for field parameters. For a successful call, fields must contain the following values for the fields using these methods:ProfileFields.setCurrentPassword(String)
,ProfileFields.setPassword(String)
andProfileFields.setConfirmPassword(String)
listener
- handler of response
-
trackActive
public void trackActive(ProfileParams parameters, ListenerModel<BaseModel<BaseData>,BaseData> listener)
API for tracking. Updates the user last active timestamp in the server.- Parameters:
parameters
- theProfileParams
for query parameterslistener
- handler of the response
-
getConnectedIdentities
public void getConnectedIdentities(ProfileParams parameters, boolean clearCache, ListenerModel<BaseModel<java.util.List<Identity>>,java.util.List<Identity>> listener)
Connected Identities API. Get all identities connected to the member- Parameters:
parameters
- theProfileParams
for query parametersclearCache
- set totrue
if cache should be cleared, otherwisefalse
listener
- handler of response
-
connectIdentity
public void connectIdentity(java.lang.String provider, ProfileParams parameters, ProfileFields fields, Listener<SuccessResponse> listener)
Connects a third party identity to the member using a unique token from the 3rd party.- Parameters:
provider
- the 3rd party provider (e.g.facebook
,instagram
, orgarmin
parameters
- theProfileParams
for query parametersfields
- theProfileFields
for field parameters, should include values for fieldsProfileFields.setIdentityToken(String)
; other optional fields will be based on the provider to be connected, see further documentationlistener
- handler of response
-
disconnectIdentity
public void disconnectIdentity(java.lang.String provider, ProfileParams parameters, ProfileFields fields, Listener<SuccessResponse> listener)
Disconnects the identity from the member profile.- Parameters:
provider
- the 3rd party provider (e.g.facebook
,instagram
, orgarmin
parameters
- theProfileParams
for query parametersfields
- theProfileFields
for field parameters, should include value for fieldProfileFields.setUID(String)
other optional fields will be based on the provider to be disconnected, see further documentationlistener
- handler of response
-
submitReferralCode
public void submitReferralCode(ProfileParams parameters, Listener<SuccessResponse> listener)
Submit a referral code- Parameters:
parameters
- theProfileParams
for query parameterslistener
- handler of response
-
-