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 voidchangePassword(ProfileParams parameters, ProfileFields fields, ListenerModel<BaseModel<BaseData>,BaseData> listener)Change Password API.voidconnectIdentity(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.voiddeleteAccount(ProfileParams profileParameters, ProfileFields profileFields, Listener<SuccessResponse> listener)Delete Profile Account API.voiddisconnectIdentity(java.lang.String provider, ProfileParams parameters, ProfileFields fields, Listener<SuccessResponse> listener)Disconnects the identity from the member profile.voidgetConnectedIdentities(ProfileParams parameters, boolean clearCache, ListenerModel<BaseModel<java.util.List<Identity>>,java.util.List<Identity>> listener)Connected Identities API.voidgetProfile(ProfileParams profileParameters, boolean clearCache, Listener<Profile> listener)Profile API.voidgetProfileMetadata(ProfileParams profileParameters, boolean clearCache, Listener<BaseGenericModel<java.util.List<Metadata>>> listener)Profile Metadata API.voidrequestOtpCode(ProfileParams profileParameters, Listener<SuccessResponse> listener)API to request OTP code.voidsubmitReferralCode(ProfileParams parameters, Listener<SuccessResponse> listener)Submit a referral codevoidtrackActive(ProfileParams parameters, ListenerModel<BaseModel<BaseData>,BaseData> listener)API for tracking.voidupdateAvatar(ProfileParams parameters, okhttp3.MultipartBody.Part avatar, ListenerModel<BaseModel<Avatar>,Avatar> listener)Update Avatar API.voidupdateProfile(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- theProfileParamsfor Metadata APIclearCache- set totrueif cache should be cleared, otherwisefalselistener- 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- theProfileParamsfor Profile API. Accepted parameters includeProfileParams.Builder.setIncludeSegments(Boolean)clearCache- set totrueif cache should be cleared, otherwisefalselistener- handler for the response
-
deleteAccount
public void deleteAccount(ProfileParams profileParameters, ProfileFields profileFields, Listener<SuccessResponse> listener)
Delete Profile Account API.- Parameters:
profileParameters- theProfileParamsfor Profile API.profileFields- theProfileFieldsfor 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- theProfileParamsfor 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- theProfileParamsfor query parametersfields- theProfileFieldsfor 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.Partobject.- Parameters:
parameters- theProfileParamsfor query parametersavatar- the image file converted to aMultipartBody.Partobjectlistener- 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- theProfileParamsfor query parametersfields- theProfileFieldsfor 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- theProfileParamsfor 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- theProfileParamsfor query parametersclearCache- set totrueif cache should be cleared, otherwisefalselistener- 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, orgarminparameters- theProfileParamsfor query parametersfields- theProfileFieldsfor 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, orgarminparameters- theProfileParamsfor query parametersfields- theProfileFieldsfor 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- theProfileParamsfor query parameterslistener- handler of response
-
-