Package cn.leancloud

Class LCUser


public class LCUser extends LCObject
  • Field Details

  • Constructor Details

    • LCUser

      public LCUser()
      constructor
  • Method Details

    • currentUser

      public static LCUser currentUser()
      获取当前登录用户
      Returns:
      current user. Notice: you SHOULDN'T invoke this method to get current user in lean engine.
    • getEmail

      public String getEmail()
      get user email.
      Returns:
      user email.
    • setEmail

      public void setEmail(String email)
      set user email
      Parameters:
      email - user email.
    • getUsername

      public String getUsername()
      get user name.
      Returns:
      user name
    • setUsername

      public void setUsername(String name)
      set user name.
      Parameters:
      name - username
    • getPassword

      public String getPassword()
      get user password.
      Returns:
      user password.
    • setPassword

      public void setPassword(String password)
      set user password.
      Parameters:
      password - user password.
    • getMobilePhoneNumber

      public String getMobilePhoneNumber()
      get user mobilephone.
      Returns:
      user mobilephone number.
    • setMobilePhoneNumber

      public void setMobilePhoneNumber(String mobile)
      set user mobilephone.
      Parameters:
      mobile - user mobilephone number.
    • isMobilePhoneVerified

      public boolean isMobilePhoneVerified()
      whether user's mobilephone is verified or not.
      Returns:
      flag to indicate user's mobilephone is verified or not
    • getSessionToken

      public String getSessionToken()
      get user session token. if user not login, session token is null.
      Returns:
      user session token, null if not login.
    • internalChangeSessionToken

      public void internalChangeSessionToken(String token)
      not use it!
      Parameters:
      token - user token.
    • isAuthenticated

      public boolean isAuthenticated()
      whether user is authenticated or not.
      Returns:
      flag to indicate user is authenticated or not.
    • onSaveSuccess

      protected void onSaveSuccess()
      Overrides:
      onSaveSuccess in class LCObject
    • onSaveFailure

      protected void onSaveFailure()
      Overrides:
      onSaveFailure in class LCObject
    • onDataSynchronized

      protected void onDataSynchronized()
      Overrides:
      onDataSynchronized in class LCObject
    • isAnonymous

      public boolean isAnonymous()
      Whether is anonymous or not.
      Returns:
      flag to indicate current user is anonymous or not.
    • signUp

      public void signUp()
      sign up(blocking).
    • signUpInBackground

      public io.reactivex.Observable<LCUser> signUpInBackground()
      sign up in background.
      Returns:
      observable instance.
    • signUpOrLoginByMobilePhone

      public static LCUser signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode)
      signUpOrLoginByMobilePhone
      Parameters:
      mobilePhoneNumber - mobile phone
      smsCode - sms code
      Returns:
      user instance.
    • signUpOrLoginByMobilePhone

      public static <T extends LCUser> T signUpOrLoginByMobilePhone(String mobilePhoneNumber, String smsCode, Class<T> clazz)
      signUpOrLoginByMobilePhone
      Type Parameters:
      T - template type.
      Parameters:
      mobilePhoneNumber - mobile phone number
      smsCode - sms code
      clazz - class name
      Returns:
      user instance.
    • signUpOrLoginByMobilePhoneInBackground

      public static io.reactivex.Observable<? extends LCUser> signUpOrLoginByMobilePhoneInBackground(String mobilePhoneNumber, String smsCode)
      signUpOrLoginByMobilePhoneInBackground
      Parameters:
      mobilePhoneNumber - mobile phone number.
      smsCode - sms code
      Returns:
      observable instance.
    • signUpOrLoginByMobilePhoneInBackground

      public static <T extends LCUser> io.reactivex.Observable<T> signUpOrLoginByMobilePhoneInBackground(String mobilePhoneNumber, String smsCode, Class<T> clazz)
      signUpOrLoginByMobilePhoneInBackground
      Type Parameters:
      T - template type.
      Parameters:
      mobilePhoneNumber - mobile phone number
      smsCode - sms code
      clazz - class name
      Returns:
      observable instance.
    • logIn

      public static io.reactivex.Observable<? extends LCUser> logIn(String username, String password)
      logIn in background
      Parameters:
      username - username
      password - user password
      Returns:
      observable instance.
    • logInAnonymously

      public static io.reactivex.Observable<? extends LCUser> logInAnonymously()
      login as anonymous user in background.
      Returns:
      observable instance.
    • logIn

      public static <T extends LCUser> io.reactivex.Observable<T> logIn(String username, String password, Class<T> clazz)
      logIn in background
      Type Parameters:
      T - template type.
      Parameters:
      username - username
      password - user password
      clazz - user class name
      Returns:
      observable instance.
    • loginByMobilePhoneNumber

      public static io.reactivex.Observable<? extends LCUser> loginByMobilePhoneNumber(String mobile, String password)
      logIn with mobile phone and password.
      Parameters:
      mobile - mobile phone
      password - password
      Returns:
      observable instance.
    • loginByEmail

      public static io.reactivex.Observable<? extends LCUser> loginByEmail(String email, String password)
      logIn with email and password
      Parameters:
      email - email.
      password - password.
      Returns:
      observable instance.
    • loginByMobilePhoneNumber

      public static <T extends LCUser> io.reactivex.Observable<T> loginByMobilePhoneNumber(String mobile, String password, Class<T> clazz)
      logIn with mobile phone and password.
      Type Parameters:
      T - template type.
      Parameters:
      mobile - mobile phone.
      password - user password.
      clazz - user class.
      Returns:
      observable instance.
    • loginBySMSCode

      public static io.reactivex.Observable<? extends LCUser> loginBySMSCode(String mobile, String smsCode)
      logIn with mobile phone and sms code.
      Parameters:
      mobile - mobile phone.
      smsCode - sms code.
      Returns:
      observable instance.
    • loginBySMSCode

      public static <T extends LCUser> io.reactivex.Observable<T> loginBySMSCode(String mobile, String smsCode, Class<T> clazz)
      logIn with mobile phone and sms code.
      Type Parameters:
      T - template type.
      Parameters:
      mobile - mobile phone.
      smsCode - sms code.
      clazz - user class.
      Returns:
      observable instance.
    • loginWithAuthData

      public static io.reactivex.Observable<? extends LCUser> loginWithAuthData(Map<String,Object> authData, String platform)
      login with auth data.
      Parameters:
      authData - auth data.
      platform - platform string.
      Returns:
      observable instance.
    • loginWithAuthData

      public static io.reactivex.Observable<? extends LCUser> loginWithAuthData(Map<String,Object> authData, String platform, String unionId, String unionIdPlatform, boolean asMainAccount)
      login with auth data.
      Parameters:
      authData - auth data.
      platform - platform string.
      unionId - unionid.
      unionIdPlatform - unionid platform string.
      asMainAccount - flag to treat as main account.
      Returns:
      observable instance.
    • loginWithAuthData

      public static <T extends LCUser> io.reactivex.Observable<T> loginWithAuthData(Class<T> clazz, Map<String,Object> authData, String platform)
      login with auth data.
      Type Parameters:
      T - template type.
      Parameters:
      clazz - user class name.
      authData - auth data.
      platform - platform string.
      Returns:
      observable instance.
    • loginWithAuthData

      public static <T extends LCUser> io.reactivex.Observable<T> loginWithAuthData(Class<T> clazz, Map<String,Object> authData, String platform, String unionId, String unionIdPlatform, boolean asMainAccount)
      login with auth data.
      Type Parameters:
      T - template type.
      Parameters:
      clazz - user class name.
      authData - auth data.
      platform - platform string.
      unionId - unionid.
      unionIdPlatform - unionid platform string.
      asMainAccount - flag to treat as main account.
      Returns:
      observable instance.
    • loginWithAuthData

      public io.reactivex.Observable<LCUser> loginWithAuthData(Map<String,Object> authData, String platform, boolean failOnNotExist)
      login with auth data.
      Parameters:
      authData - auth data.
      platform - platform string.
      failOnNotExist - flag to indicate to exit if failed or not.
      Returns:
      observable instance.
    • loginWithAuthData

      public io.reactivex.Observable<LCUser> loginWithAuthData(Map<String,Object> authData, String platform, String unionId, String unionIdPlatform, boolean asMainAccount, boolean failOnNotExist)
      login with auth data.
      Parameters:
      authData - auth data.
      platform - platform string.
      unionId - union id.
      unionIdPlatform - the platform which union id is binding with.
      asMainAccount - flag indicating that whether current platform is main account or not.
      failOnNotExist - flag to indicate to exit if failed or not.
      Returns:
      observable instance.
    • associateWithAuthData

      public io.reactivex.Observable<LCUser> associateWithAuthData(Map<String,Object> authData, String platform)
      associate with third party data.
      Parameters:
      authData - auth data.
      platform - platform name.
      Returns:
      observable instance.
    • associateWithAuthData

      public io.reactivex.Observable<LCUser> associateWithAuthData(Map<String,Object> authData, String platform, String unionId, String unionIdPlatform, boolean asMainAccount)
      associate with third party data.
      Parameters:
      authData - auth data.
      platform - platform name.
      unionId - union id.
      unionIdPlatform - the platform which union id is binding with.
      asMainAccount - flag indicating that whether current platform is main account or not.
      Returns:
      observable instance.
    • dissociateWithAuthData

      public io.reactivex.Observable<LCUser> dissociateWithAuthData(String platform)
      dissociate with third party data.
      Parameters:
      platform - platform name.
      Returns:
      observable instance.
    • checkAuthenticatedInBackground

      public io.reactivex.Observable<Boolean> checkAuthenticatedInBackground()
      check authenticated status in background.
      Returns:
      observable instance.
    • refreshSessionTokenInBackground

      public io.reactivex.Observable<Boolean> refreshSessionTokenInBackground()
      refresh session token in background.
      Returns:
      observable instance.
    • retrieveShortTokenInBackground

      public static io.reactivex.Observable<JSONObject> retrieveShortTokenInBackground(String sessionToken)
      获取用户的临时 JWT token,用于其他系统认证(例如 TDS 客服系统)
      Parameters:
      sessionToken - session token
      Returns:
      observable instance
    • becomeWithSessionToken

      public static LCUser becomeWithSessionToken(String sessionToken)
      instantiate AVUser object with sessionToken(synchronized)
      Parameters:
      sessionToken - session token
      Returns:
      AVUser instance. this method DOES NOT change AVUser#currentUser, it makes sense for being called in lean engine.
    • becomeWithSessionToken

      public static LCUser becomeWithSessionToken(String sessionToken, boolean saveToCurrentUser)
      instantiate AVUser object with sessionToken(synchronized)
      Parameters:
      sessionToken - session token
      saveToCurrentUser - flag indicating whether change current user or not. true - save user to AVUser#currentUser. false - not save.
      Returns:
      AVUser instance.
    • becomeWithSessionTokenInBackground

      public static io.reactivex.Observable<? extends LCUser> becomeWithSessionTokenInBackground(String sessionToken)
      instantiate AVUser object with sessionToken(asynchronous)
      Parameters:
      sessionToken - session token
      Returns:
      Observable instance. this method DOES NOT change AVUser#currentUser, it makes sense for being called in lean engine.
    • becomeWithSessionTokenInBackground

      public static io.reactivex.Observable<? extends LCUser> becomeWithSessionTokenInBackground(String sessionToken, boolean saveToCurrentUser)
      instantiate AVUser object with sessionToken(asynchronous)
      Parameters:
      sessionToken - session token
      saveToCurrentUser - flag indicating whether change current user or not. true - save user to AVUser#currentUser. false - not save.
      Returns:
      Observable instance.
    • becomeWithSessionToken

      public static <T extends LCUser> T becomeWithSessionToken(String sessionToken, Class<T> clazz)
      instantiate AVUser object with sessionToken(synchronized)
      Type Parameters:
      T - template.
      Parameters:
      sessionToken - session token
      clazz - class name.
      Returns:
      AVUser instance. this method DOES NOT change AVUser#currentUser, it makes sense for being called in lean engine.
    • becomeWithSessionToken

      public static <T extends LCUser> T becomeWithSessionToken(String sessionToken, boolean saveToCurrentUser, Class<T> clazz)
      instantiate AVUser object with sessionToken(synchronized)
      Type Parameters:
      T - template.
      Parameters:
      sessionToken - session token
      saveToCurrentUser - flag indicating whether change current user or not. true - save user to AVUser#currentUser. false - not save.
      clazz - class name.
      Returns:
      AVUser instance.
    • becomeWithSessionTokenInBackground

      public static <T extends LCUser> io.reactivex.Observable<T> becomeWithSessionTokenInBackground(String sessionToken, Class<T> clazz)
      instantiate AVUser object with sessionToken(asynchronous)
      Type Parameters:
      T - generic type.
      Parameters:
      sessionToken - session token
      clazz - class name
      Returns:
      Observable instance. this method DOES NOT change AVUser#currentUser, it makes sense for being called in lean engine.
    • becomeWithSessionTokenInBackground

      public static <T extends LCUser> io.reactivex.Observable<T> becomeWithSessionTokenInBackground(String sessionToken, boolean saveToCurrentUser, Class<T> clazz)
      instantiate AVUser object with sessionToken(asynchronous)
      Type Parameters:
      T - generic type
      Parameters:
      sessionToken - session token
      saveToCurrentUser - flag indicating whether change current user or not. true - save user to AVUser#currentUser. false - not save.
      clazz - class name
      Returns:
      Observable instance.
    • createWithSessionToken

      public static LCUser createWithSessionToken(String objectId, String sessionToken) throws LCException
      Throws:
      LCException
    • createWithSessionToken

      public static <T extends LCUser> T createWithSessionToken(Class<T> clazz, String objectId, String sessionToken) throws LCException
      Throws:
      LCException
    • logOut

      public static void logOut()
      user logout.
    • getUserQuery

      public static <T extends LCUser> LCQuery<T> getUserQuery(Class<T> clazz)
      Get User Query
      Type Parameters:
      T - template type.
      Parameters:
      clazz - class name.
      Returns:
      query instance.
    • getQuery

      public static LCQuery<LCUser> getQuery()
      Get User Query
      Returns:
      query instance.
    • strictlyFind

      public static io.reactivex.Observable<List<LCUser>> strictlyFind(QueryConditions queryConditions)
      Get User list by query with conditions
      Parameters:
      queryConditions - query conditions.
      Returns:
      query result
    • getRolesInBackground

      public io.reactivex.Observable<List<LCRole>> getRolesInBackground()
      Get roles in background.
      Returns:
      observable instance.
    • enableAutomaticUser

      public static void enableAutomaticUser()
    • isEnableAutomatic

      public static boolean isEnableAutomatic()
    • disableAutomaticUser

      public static void disableAutomaticUser()
    • changeCurrentUser

      public static void changeCurrentUser(LCUser newUser, boolean save)
      change current user instance.
      Parameters:
      newUser - new instance.
      save - flag indicating that whether save current user to cache or not.
    • getCurrentUser

      public static LCUser getCurrentUser()
      get current user, null if non-login.
      Returns:
      user instance.
    • getCurrentUser

      public static <T extends LCUser> T getCurrentUser(Class<T> userClass)
      get current user, null if non-login.
      Type Parameters:
      T - template type.
      Parameters:
      userClass - user object class.
      Returns:
      user instance.
    • requestPasswordResetInBackground

      public static io.reactivex.Observable<LCNull> requestPasswordResetInBackground(String email)
      Password-relative operations
      Parameters:
      email - user email.
      Returns:
      observable instance.
    • requestPasswordResetBySmsCodeInBackground

      public static io.reactivex.Observable<LCNull> requestPasswordResetBySmsCodeInBackground(String phoneNumber)
      request sms code for resetting password
      Parameters:
      phoneNumber - mobile phone number
      Returns:
      observable instance
    • requestPasswordResetBySmsCodeInBackground

      public static io.reactivex.Observable<LCNull> requestPasswordResetBySmsCodeInBackground(String phoneNumber, String validateToken)
      request sms code for resetting password, collaborating with AVCaptcha
      Parameters:
      phoneNumber - mobile phone number
      validateToken - validated token, retrieved after invoking AVCaptcha#verifyCaptchaCodeInBackground
      Returns:
      observable instance
    • resetPasswordBySmsCodeInBackground

      public static io.reactivex.Observable<LCNull> resetPasswordBySmsCodeInBackground(String smsCode, String newPassword, String phoneNumber)
      reset password with sms code for current user.
      Parameters:
      smsCode - sms code
      newPassword - new password
      Returns:
      observable instance
    • updatePasswordInBackground

      public io.reactivex.Observable<LCNull> updatePasswordInBackground(String oldPass, String newPass)
      update current user's password
      Parameters:
      oldPass - old password
      newPass - new password
      Returns:
      observable instance
    • requestEmailVerifyInBackground

      public static io.reactivex.Observable<LCNull> requestEmailVerifyInBackground(String email)
      request verified email
      Parameters:
      email - email address
      Returns:
      observable instance
    • requestMobilePhoneVerifyInBackground

      public static io.reactivex.Observable<LCNull> requestMobilePhoneVerifyInBackground(String mobilePhone)
      request sms code for verification mobile phone.
      Parameters:
      mobilePhone - mobile phone number.
      Returns:
      observable instance
    • requestMobilePhoneVerifyInBackground

      public static io.reactivex.Observable<LCNull> requestMobilePhoneVerifyInBackground(String mobilePhone, String validateToken)
      request sms code for verification mobile phone, collaborating with AVCaptcha
      Parameters:
      mobilePhone - mobile phone number.
      validateToken - validated token, retrieved after invoking AVCaptcha#verifyCaptchaCodeInBackground
      Returns:
      observable instance.
    • requestLoginSmsCodeInBackground

      public static io.reactivex.Observable<LCNull> requestLoginSmsCodeInBackground(String mobilePhone)
      request sms code for login
      Parameters:
      mobilePhone - mobile phone number.
      Returns:
      observable instance
    • requestLoginSmsCodeInBackground

      public static io.reactivex.Observable<LCNull> requestLoginSmsCodeInBackground(String mobilePhone, String validateToken)
      request sms code for login, collaborating with AVCaptcha
      Parameters:
      mobilePhone - mobile phone number
      validateToken - validated token, retrieved after invoking AVCaptcha#verifyCaptchaCodeInBackground
      Returns:
      observable instance.
    • verifyMobilePhoneInBackground

      public static io.reactivex.Observable<LCNull> verifyMobilePhoneInBackground(String verifyCode, String phoneNumber)
      verify sms code with current user's phone number.
      Parameters:
      verifyCode - sms code
      Returns:
      observable instance.
    • requestSMSCodeForUpdatingPhoneNumberInBackground

      public static io.reactivex.Observable<LCNull> requestSMSCodeForUpdatingPhoneNumberInBackground(String mobilePhone, LCSMSOption option)
      request sms code for updating phone number of current user.
      Parameters:
      mobilePhone - mobile phone number.
      option - sms option
      Returns:
      observable instance
    • requestSMSCodeForUpdatingPhoneNumberInBackground

      public static io.reactivex.Observable<LCNull> requestSMSCodeForUpdatingPhoneNumberInBackground(LCUser asAuthenticatedUser, String mobilePhone, LCSMSOption option)
      request sms code for updating phone number of current user.
      Parameters:
      asAuthenticatedUser - explicit user for request authentication.
      mobilePhone - mobile phone number.
      option - sms option
      Returns:
      observable instance in general, this method should be invoked in lean engine.
    • verifySMSCodeForUpdatingPhoneNumberInBackground

      public static io.reactivex.Observable<LCNull> verifySMSCodeForUpdatingPhoneNumberInBackground(String code, String mobilePhone)
      verify sms code for updating phone number of current user.
      Parameters:
      code - sms code
      mobilePhone - mobile phone number.
      Returns:
      observable instance
    • verifySMSCodeForUpdatingPhoneNumberInBackground

      public static io.reactivex.Observable<LCNull> verifySMSCodeForUpdatingPhoneNumberInBackground(LCUser asAuthenticatedUser, String code, String mobilePhone)
      verify sms code for updating phone number of current user.
      Parameters:
      asAuthenticatedUser - explicit user for request authentication.
      code - sms code
      mobilePhone - mobile phone number.
      Returns:
      observable instance in general, this method should be invoked in lean engine.
    • followInBackground

      public io.reactivex.Observable<JSONObject> followInBackground(String userObjectId)
      follow somebody in background.
      Parameters:
      userObjectId - target user objectId.
      Returns:
      observable instance.
    • followInBackground

      public io.reactivex.Observable<JSONObject> followInBackground(LCUser asAuthenticatedUser, String userObjectId)
      follow somebody in background.
      Parameters:
      asAuthenticatedUser - explicit user for request authentication.
      userObjectId - target user objectId.
      Returns:
      observable instance. in general, this method should be invoked in lean engine.
    • followInBackground

      public io.reactivex.Observable<JSONObject> followInBackground(String userObjectId, Map<String,Object> attributes)
      follow somebody in background.
      Parameters:
      userObjectId - target user objectId.
      attributes - friendship attributes.
      Returns:
      observable instance.
    • followInBackground

      public io.reactivex.Observable<JSONObject> followInBackground(LCUser asAuthenticatedUser, String userObjectId, Map<String,Object> attributes)
      follow somebody in background.
      Parameters:
      asAuthenticatedUser - explicit user for request authentication.
      userObjectId - target user objectId.
      attributes - friendship attributes.
      Returns:
      observable instance. in general, this method should be invoked in lean engine.
    • unfollowInBackground

      public io.reactivex.Observable<JSONObject> unfollowInBackground(String userObjectId)
      unfollow somebody in background.
      Parameters:
      userObjectId - target user objectId.
      Returns:
      observable instance.
    • unfollowInBackground

      public io.reactivex.Observable<JSONObject> unfollowInBackground(LCUser asAuthenticatedUser, String userObjectId)
      unfollow somebody in background.
      Parameters:
      asAuthenticatedUser - explicit user for request authentication.
      userObjectId - target user objectId.
      Returns:
      observable instance. in general, this method should be invoked in lean engine.
    • followerQuery

      public LCQuery<LCObject> followerQuery()
      get follower query.
      Returns:
      query instance.
    • followeeQuery

      public LCQuery<LCObject> followeeQuery()
      get followee query.
      Returns:
      query instance.
    • followerQuery

      public static <T extends LCObject> LCQuery<T> followerQuery(String userObjectId, Class<T> clazz)
      get follower query.
      Type Parameters:
      T - template type.
      Parameters:
      userObjectId - user object id.
      clazz - result class.
      Returns:
      query instance.
    • followeeQuery

      public static <T extends LCObject> LCQuery<T> followeeQuery(String userObjectId, Class<T> clazz)
      get followee query.
      Type Parameters:
      T - template type.
      Parameters:
      userObjectId - user object id.
      clazz - result class.
      Returns:
      query instance.
    • friendshipQuery

      public LCQuery<LCFriendship> friendshipQuery(boolean isFollowerDirection)
      get friendship query of current user.
      Parameters:
      isFollowerDirection - query direction: true - query follower of current user(users which followed current user). false - query followee of current user(users which current user followed).
      Returns:
      query instance, null for non-authenticated user.
    • queryFriendship

      public io.reactivex.Observable<List<LCFriendship>> queryFriendship()
      query current user's friendship.
      Returns:
      Observable instance to monitor operation result.
    • queryFriendship

      public io.reactivex.Observable<List<LCFriendship>> queryFriendship(int offset, int limit, String orderBy)
      query current user's friendship.
      Parameters:
      offset - result offset.
      limit - result size limit.
      orderBy - order attribute.
      Returns:
      Observable instance to monitor operation result.
    • applyFriendshipInBackground

      public io.reactivex.Observable<LCFriendshipRequest> applyFriendshipInBackground(LCUser friend, Map<String,Object> attributes)
      apply new friendship to someone.
      Parameters:
      friend - target user.
      attributes - additional attributes.
      Returns:
      Observable instance to monitor operation result.
    • applyFriendshipInBackground

      public io.reactivex.Observable<LCFriendshipRequest> applyFriendshipInBackground(LCUser asAuthenticatedUser, LCUser friend, Map<String,Object> attributes)
      apply new friendship to someone.
      Parameters:
      asAuthenticatedUser - explicit user for request authentication.
      friend - target user.
      attributes - additional attributes.
      Returns:
      Observable instance to monitor operation result. in general, this method should be invoked in lean engine.
    • updateFriendship

      public io.reactivex.Observable<LCFriendship> updateFriendship(LCFriendship friendship)
      update friendship attributes.
      Parameters:
      friendship - friendship instance.
      Returns:
      observable instance.
    • updateFriendship

      public io.reactivex.Observable<LCFriendship> updateFriendship(LCUser asAuthenticatedUser, LCFriendship friendship)
      update friendship attributes.
      Parameters:
      asAuthenticatedUser - explicit user for request authentication.
      friendship - friendship instance.
      Returns:
      observable instance. in general, this method should be invoked in lean engine.
    • blockFriendInBackground

      public io.reactivex.Observable<JSONObject> blockFriendInBackground(String objectId)
      block somebody in background.
      Parameters:
      objectId - target user objectId.
      Returns:
      observable instance.
    • unblockFriendInBackground

      public io.reactivex.Observable<JSONObject> unblockFriendInBackground(String objectId)
      unblock somebody in background.
      Parameters:
      objectId - target user objectId.
      Returns:
      observable instance.
    • friendshipBlockQuery

      public LCQuery<LCObject> friendshipBlockQuery()
      get block query.
      Returns:
      query instance.
    • friendshipBlockQuery

      public static <T extends LCObject> LCQuery<T> friendshipBlockQuery(Class<T> clazz)
      get block query.
      Type Parameters:
      T - template type.
      Parameters:
      clazz - result class.
      Returns:
      query instance.
    • acceptFriendshipRequest

      public io.reactivex.Observable<LCFriendshipRequest> acceptFriendshipRequest(LCFriendshipRequest request, Map<String,Object> attributes)
      accept a friendship.
      Parameters:
      request - friendship request.
      attributes - additional attributes.
      Returns:
      Observable instance to monitor operation result. notice: attributes is necessary as parameter bcz they are not properties of FriendshipRequest.
    • acceptFriendshipRequest

      public io.reactivex.Observable<LCFriendshipRequest> acceptFriendshipRequest(LCUser asAuthenticatedUser, LCFriendshipRequest request, Map<String,Object> attributes)
      accept a friendship.
      Parameters:
      asAuthenticatedUser - explicit user for request authentication.
      request - friendship request.
      attributes - additional attributes.
      Returns:
      Observable instance to monitor operation result. notice: attributes is necessary as parameter bcz they are not properties of FriendshipRequest. in general, this method should be invoked in lean engine.
    • declineFriendshipRequest

      public io.reactivex.Observable<LCFriendshipRequest> declineFriendshipRequest(LCFriendshipRequest request)
      decline a friendship.
      Parameters:
      request - friendship request.
      Returns:
      Observable instance to monitor operation result.
    • declineFriendshipRequest

      public io.reactivex.Observable<LCFriendshipRequest> declineFriendshipRequest(LCUser asAuthenticatedUser, LCFriendshipRequest request)
      decline a friendship.
      Parameters:
      asAuthenticatedUser - explicit user for request authentication.
      request - friendship request.
      Returns:
      Observable instance to monitor operation result. in general, this method should be invoked in lean engine.
    • friendshipRequestQuery

      public LCQuery<LCFriendshipRequest> friendshipRequestQuery(int status, boolean includeTargetUser, boolean requestToMe)
      get query for AVFriendshipRequest.
      Parameters:
      status - request status. following value can be used individually or combined with `and` operator: AVFriendshipRequest.STATUS_PENDING(0x01) - request is pending yet. AVFriendshipRequest.STATUS_ACCEPTED(0x02) - request is accepted by user. AVFriendshipRequest.STATUS_DECLINED(0x04) - request is declined by user. AVFriendshipRequest.STATUS_ANY(0x07) - no matter status, all of requests are wanted by current query.
      includeTargetUser - boolean flag, indicating that need to include target user pointer or not.
      requestToMe - boolean flag, indicating all requests are sent to current user or not. true - someone others sent requests to current user. false - current user sent requests to others.
      Returns:
      AVFriendshipRequest query, null for current user isn't authenticated or status is invlaid.
    • getFollowersAndFolloweesInBackground

      public void getFollowersAndFolloweesInBackground(FollowersAndFolloweesCallback callback)
      get follower and followee in background.
      Parameters:
      callback - callback handler. request authentication with current user.
    • getFollowersAndFolloweesInBackground

      public void getFollowersAndFolloweesInBackground(LCUser asAuthenticatedUser, FollowersAndFolloweesCallback callback)
      get follower and followee in background.
      Parameters:
      asAuthenticatedUser - explicit user for request authentication.
      callback - callback handler. in general, this method should be invoked in lean engine.
    • alwaysUseSubUserClass

      public static void alwaysUseSubUserClass(Class<? extends LCUser> clazz)
      通过设置此方法,所有关联对象中的 AVUser 对象都会被强转成注册的 AVUser 子类对象
      Parameters:
      clazz - class name
    • cast

      public static <T extends LCUser> T cast(LCUser user, Class<T> clazz)
      通过这个方法可以将 AVUser 对象强转为其子类对象
      Type Parameters:
      T - template type.
      Parameters:
      user - user object.
      clazz - user class name.
      Returns:
      user subclass instance.