LeanCloud C# SDK
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Properties | List of all members
LeanCloud.Storage.LCUser Class Reference

LCUser represents a user for a LeanCloud application. More...

Inheritance diagram for LeanCloud.Storage.LCUser:
LeanCloud.Storage.LCObject

Public Member Functions

 LCUser ()
 
async Task< LCUserSignUp ()
 Signs up a new user.
 
Task AssociateAuthData (Dictionary< string, object > authData, string platform)
 Associates this user with a third party authData.
 
Task AssociateAuthDataAndUnionId (Dictionary< string, object > authData, string platform, string unionId, LCUserAuthDataLoginOption option=null)
 Associates this user with a third party authData and unionId.
 
Task DisassociateWithAuthData (string platform)
 Unlinks a user from a third party platform.
 
async Task RefreshSessionToken ()
 
async Task UpdatePassword (string oldPassword, string newPassword)
 Updates newPassword safely with oldPassword.
 
async Task< bool > IsAuthenticated ()
 Checks whether the current sessionToken is valid.
 
async Task SaveToLocal ()
 Save to local.
 
new async Task< LCUserFetch (IEnumerable< string > keys=null, IEnumerable< string > includes=null)
 Fetches this object from the cloud.
 
async Task Follow (string targetId, Dictionary< string, object > attrs=null)
 Follows a user.
 
async Task Unfollow (string targetId)
 Unfollows a user.
 
LCQuery< LCObjectFollowerQuery ()
 Constructs a follower query.
 
LCQuery< LCObjectFolloweeQuery ()
 Constructs a followee query.
 
LCQuery< LCObjectFriendshipQuery ()
 Constructs a friend query.
 
LCQuery< LCObjectFriendshipBlockQuery ()
 Constructs a block query for friend.
 
async Task< LCFollowersAndFolloweesGetFollowersAndFollowees (bool includeFollower=false, bool includeFollowee=false, bool returnCount=false)
 Gets the followers and followees of the currently logged in user.
 
new async Task< LCUserSave (bool fetchWhenSave=false, LCQuery< LCObject > query=null)
 
- Public Member Functions inherited from LeanCloud.Storage.LCObject
void DisableBeforeHook ()
 Disable hooks before saving / updating / deleting LCObject.
 
void DisableAfterHook ()
 Disable hooks after saving / updating / deleting LCObject.
 
void IgnoreHook (string hookName)
 Ignores the hook for this LCObject.
 
ReadOnlyCollection< string > GetUpdatedKeys ()
 Gets the updated keys of this LCObject.
 
 LCObject (string className)
 Constructs a new LCObject with no data in it. A LCObject constructed in this way will not have an ObjectedId and will not persist in the cloud until Save(bool, LCQuery<LCObject>)) is called.
 
void Unset (string key)
 Removes the key.
 
void AddRelation (string key, LCObject value)
 Creates a LCRelation<T> value for a key.
 
void RemoveRelation (string key, LCObject value)
 Removes a LCRelation<T> value for a key.
 
void Increment (string key, object value)
 Atomically increments the value of the given key with amount.
 
void Add (string key, object value)
 Atomically adds value to the end of the array key.
 
void AddAll (string key, IEnumerable values)
 Atomically adds values to the end of the array key.
 
void AddUnique (string key, object value)
 Atomically adds value to the array key, only if not already present.
 
void AddAllUnique (string key, IEnumerable values)
 Atomically adds values to the array key, only if not already present.
 
void Remove (string key, object value)
 Atomically removes all value from the array key.
 
void RemoveAll (string key, IEnumerable values)
 Atomically removes all values from the array key.
 
async Task< LCObjectSave (bool fetchWhenSave=false, LCQuery< LCObject > query=null)
 Saves this object to the cloud.
 
async Task Delete ()
 Deletes this object in the cloud.
 
async Task< LCObjectFetch (IEnumerable< string > keys=null, IEnumerable< string > includes=null)
 Fetches this object from the cloud.
 
override string ToString ()
 Serializes this LCObject to a JSON string.
 
void Merge (LCObjectData objectData)
 

Static Public Member Functions

static async Task< LCUserGetCurrent ()
 Gets the currently logged in LCUser with a valid session, from memory or disk if necessary.
 
static async Task RequestLoginSMSCode (string mobile)
 Requests sending a login sms code.
 
static async Task< LCUserSignUpOrLoginByMobilePhone (string mobile, string code)
 Signs up or signs in a user with their mobile number and verification code.
 
static Task< LCUserLogin (string username, string password)
 Signs in a user with their username and password.
 
static Task< LCUserLoginByEmail (string email, string password)
 Signs in a user with their email and password.
 
static Task< LCUserLoginByMobilePhoneNumber (string mobile, string password)
 Signs in a user with their mobile number and password.
 
static Task< LCUserLoginBySMSCode (string mobile, string code)
 Signs in a user with their mobile number and verification code.
 
static Task< LCUserLoginWithAuthData (Dictionary< string, object > authData, string platform, LCUserAuthDataLoginOption option=null)
 Signs up or signs in a user with third party authData.
 
static Task< LCUserLoginWithAuthDataAndUnionId (Dictionary< string, object > authData, string platform, string unionId, LCUserAuthDataLoginOption option=null)
 Signs up or signs in a user with third party authData and unionId.
 
static async Task< LCUserLoginAnonymously ()
 Creates an anonymous user.
 
static async Task RequestEmailVerify (string email)
 Requests a verification email to be sent to a user's email address.
 
static async Task RequestMobilePhoneVerify (string mobile)
 Requests a verification SMS to be sent to a user's mobile number.
 
static async Task VerifyMobilePhone (string mobile, string code)
 Requests to verify a user's mobile number with sms code they received.
 
static async Task< LCUserBecomeWithSessionToken (string sessionToken)
 Signs in a user with a sessionToken.
 
static async Task RequestPasswordReset (string email)
 Requests a password reset email to be sent to a user's email address.
 
static async Task RequestPasswordResetBySmsCode (string mobile)
 Requests a reset password sms code to be sent to a user's mobile number.
 
static async Task ResetPasswordBySmsCode (string mobile, string code, string newPassword)
 Resets a user's password via mobile phone.
 
static Task Logout ()
 Logs out the currently logged in user session.
 
static LCQuery< LCUserGetQuery ()
 Constructs a LCQuery for LCUser.
 
static async Task RequestSMSCodeForUpdatingPhoneNumber (string mobile, int ttl=360, string captchaToken=null)
 Requests an SMS code for updating phone number.
 
static async Task VerifyCodeForUpdatingPhoneNumber (string mobile, string code)
 Verify code for updating phone number.
 
static LCUser GenerateUser (LCObjectData objectData)
 
static async Task< ReadOnlyCollection< LCUser > > StrictlyFind (LCUserQueryCondition condition)
 
static async Task< string > RetrieveShortToken ()
 
- Static Public Member Functions inherited from LeanCloud.Storage.LCObject
static LCObject CreateWithoutData (string className, string objectId)
 Creates a reference to an existing LCObject.
 
static LCObject Create (string className)
 Creates a new LCObject.
 
static async Task< List< LCObject > > SaveAll (IEnumerable< LCObject > objects)
 Saves each object in the provided list.
 
static async Task DeleteAll (IEnumerable< LCObject > objects)
 Deletes each object in the provided list.
 
static async Task< IEnumerable< LCObject > > FetchAll (IEnumerable< LCObject > objects)
 Fetches all of the objects in the provided list.
 
static void RegisterSubclass< T > (string className, Func< T > constructor, string endpoint=null)
 Registers a custom subclass type with LeanCloud SDK, enabling strong-typing of those LCObjects whenever they appear.
 
static LCObject ParseObject (string json)
 Deserializes a JSON string to a LCObject.
 
static string GetClassEndpoint (string className)
 

Static Public Attributes

const string CLASS_NAME = "_User"
 
const string ENDPOINT = "users"
 

Properties

string Username [get, set]
 
string Password [get, set]
 
string Email [get, set]
 
string Mobile [get, set]
 
string SessionToken [get, set]
 
bool EmailVerified [get]
 
bool MobileVerified [get]
 
Dictionary< string, object > AuthData [get, set]
 
bool IsAnonymous [get]
 Checks whether this user is anonymous.
 
- Properties inherited from LeanCloud.Storage.LCObject
string ClassName [get]
 Gets the class name for the LCObject.
 
string ObjectId [get]
 Gets the object id. An object id is assigned as soon as an object is saved to the server. The combination of a ClassName and an ObjectId uniquely identifies an object in your application.
 
DateTime CreatedAt [get]
 Gets the creation time of this object in the cloud.
 
DateTime UpdatedAt [get]
 Gets the latest update time of this object in the cloud.
 
LCACL ACL [get, set]
 Gets or sets the LCACL governing this object.
 
bool IsDirty [get, set]
 
object this[string key] [get, set]
 Gets or sets a value on the object. It is forbidden to name keys with a leading underscore ('_').
 

Detailed Description

LCUser represents a user for a LeanCloud application.

Constructor & Destructor Documentation

◆ LCUser()

LeanCloud.Storage.LCUser.LCUser ( )
inline

Member Function Documentation

◆ AssociateAuthData()

Task LeanCloud.Storage.LCUser.AssociateAuthData ( Dictionary< string, object >  authData,
string  platform 
)
inline

Associates this user with a third party authData.

Parameters
authData
platform
Returns

◆ AssociateAuthDataAndUnionId()

Task LeanCloud.Storage.LCUser.AssociateAuthDataAndUnionId ( Dictionary< string, object >  authData,
string  platform,
string  unionId,
LCUserAuthDataLoginOption  option = null 
)
inline

Associates this user with a third party authData and unionId.

Parameters
authData
platform
unionId
option
Returns

◆ BecomeWithSessionToken()

static async Task< LCUser > LeanCloud.Storage.LCUser.BecomeWithSessionToken ( string  sessionToken)
inlinestatic

Signs in a user with a sessionToken.

Parameters
sessionToken
Returns

◆ DisassociateWithAuthData()

Task LeanCloud.Storage.LCUser.DisassociateWithAuthData ( string  platform)
inline

Unlinks a user from a third party platform.

Parameters
platform
Returns

◆ Fetch()

new async Task< LCUser > LeanCloud.Storage.LCUser.Fetch ( IEnumerable< string >  keys = null,
IEnumerable< string >  includes = null 
)
inline

Fetches this object from the cloud.

Parameters
keys
includes
Returns

◆ Follow()

async Task LeanCloud.Storage.LCUser.Follow ( string  targetId,
Dictionary< string, object >  attrs = null 
)
inline

Follows a user.

Parameters
targetId
attrs
Returns

◆ FolloweeQuery()

LCQuery< LCObject > LeanCloud.Storage.LCUser.FolloweeQuery ( )
inline

Constructs a followee query.

Returns

◆ FollowerQuery()

LCQuery< LCObject > LeanCloud.Storage.LCUser.FollowerQuery ( )
inline

Constructs a follower query.

Returns

◆ FriendshipBlockQuery()

LCQuery< LCObject > LeanCloud.Storage.LCUser.FriendshipBlockQuery ( )
inline

Constructs a block query for friend.

Returns

◆ FriendshipQuery()

LCQuery< LCObject > LeanCloud.Storage.LCUser.FriendshipQuery ( )
inline

Constructs a friend query.

Returns

◆ GenerateUser()

static LCUser LeanCloud.Storage.LCUser.GenerateUser ( LCObjectData  objectData)
inlinestatic

◆ GetCurrent()

static async Task< LCUser > LeanCloud.Storage.LCUser.GetCurrent ( )
inlinestatic

Gets the currently logged in LCUser with a valid session, from memory or disk if necessary.

Returns

◆ GetFollowersAndFollowees()

async Task< LCFollowersAndFollowees > LeanCloud.Storage.LCUser.GetFollowersAndFollowees ( bool  includeFollower = false,
bool  includeFollowee = false,
bool  returnCount = false 
)
inline

Gets the followers and followees of the currently logged in user.

Parameters
includeFollower
includeFollowee
returnCount
Returns

◆ GetQuery()

static LCQuery< LCUser > LeanCloud.Storage.LCUser.GetQuery ( )
inlinestatic

Constructs a LCQuery for LCUser.

Returns

◆ IsAuthenticated()

async Task< bool > LeanCloud.Storage.LCUser.IsAuthenticated ( )
inline

Checks whether the current sessionToken is valid.

Returns

◆ Login()

static Task< LCUser > LeanCloud.Storage.LCUser.Login ( string  username,
string  password 
)
inlinestatic

Signs in a user with their username and password.

Parameters
username
password
Returns

◆ LoginAnonymously()

static async Task< LCUser > LeanCloud.Storage.LCUser.LoginAnonymously ( )
inlinestatic

Creates an anonymous user.

Returns

◆ LoginByEmail()

static Task< LCUser > LeanCloud.Storage.LCUser.LoginByEmail ( string  email,
string  password 
)
inlinestatic

Signs in a user with their email and password.

Parameters
email
password
Returns

◆ LoginByMobilePhoneNumber()

static Task< LCUser > LeanCloud.Storage.LCUser.LoginByMobilePhoneNumber ( string  mobile,
string  password 
)
inlinestatic

Signs in a user with their mobile number and password.

Parameters
mobile
password
Returns

◆ LoginBySMSCode()

static Task< LCUser > LeanCloud.Storage.LCUser.LoginBySMSCode ( string  mobile,
string  code 
)
inlinestatic

Signs in a user with their mobile number and verification code.

Parameters
mobile
code
Returns

◆ LoginWithAuthData()

static Task< LCUser > LeanCloud.Storage.LCUser.LoginWithAuthData ( Dictionary< string, object >  authData,
string  platform,
LCUserAuthDataLoginOption  option = null 
)
inlinestatic

Signs up or signs in a user with third party authData.

Parameters
authData
platform
option
Returns

◆ LoginWithAuthDataAndUnionId()

static Task< LCUser > LeanCloud.Storage.LCUser.LoginWithAuthDataAndUnionId ( Dictionary< string, object >  authData,
string  platform,
string  unionId,
LCUserAuthDataLoginOption  option = null 
)
inlinestatic

Signs up or signs in a user with third party authData and unionId.

Parameters
authData
platform
unionId
option
Returns

◆ Logout()

static Task LeanCloud.Storage.LCUser.Logout ( )
inlinestatic

Logs out the currently logged in user session.

◆ RefreshSessionToken()

async Task LeanCloud.Storage.LCUser.RefreshSessionToken ( )
inline

◆ RequestEmailVerify()

static async Task LeanCloud.Storage.LCUser.RequestEmailVerify ( string  email)
inlinestatic

Requests a verification email to be sent to a user's email address.

Parameters
email
Returns

◆ RequestLoginSMSCode()

static async Task LeanCloud.Storage.LCUser.RequestLoginSMSCode ( string  mobile)
inlinestatic

Requests sending a login sms code.

Parameters
mobileThe mobile number of an existing user
Returns

◆ RequestMobilePhoneVerify()

static async Task LeanCloud.Storage.LCUser.RequestMobilePhoneVerify ( string  mobile)
inlinestatic

Requests a verification SMS to be sent to a user's mobile number.

Parameters
mobile
Returns

◆ RequestPasswordReset()

static async Task LeanCloud.Storage.LCUser.RequestPasswordReset ( string  email)
inlinestatic

Requests a password reset email to be sent to a user's email address.

Parameters
email
Returns

◆ RequestPasswordResetBySmsCode()

static async Task LeanCloud.Storage.LCUser.RequestPasswordResetBySmsCode ( string  mobile)
inlinestatic

Requests a reset password sms code to be sent to a user's mobile number.

Parameters
email
Returns

◆ RequestSMSCodeForUpdatingPhoneNumber()

static async Task LeanCloud.Storage.LCUser.RequestSMSCodeForUpdatingPhoneNumber ( string  mobile,
int  ttl = 360,
string  captchaToken = null 
)
inlinestatic

Requests an SMS code for updating phone number.

Parameters
mobile
ttl
captchaToken
Returns

◆ ResetPasswordBySmsCode()

static async Task LeanCloud.Storage.LCUser.ResetPasswordBySmsCode ( string  mobile,
string  code,
string  newPassword 
)
inlinestatic

Resets a user's password via mobile phone.

Parameters
mobile
code
newPassword
Returns

◆ RetrieveShortToken()

static async Task< string > LeanCloud.Storage.LCUser.RetrieveShortToken ( )
inlinestatic

◆ Save()

new async Task< LCUser > LeanCloud.Storage.LCUser.Save ( bool  fetchWhenSave = false,
LCQuery< LCObject query = null 
)
inline

◆ SaveToLocal()

async Task LeanCloud.Storage.LCUser.SaveToLocal ( )
inline

Save to local.

Returns

◆ SignUp()

async Task< LCUser > LeanCloud.Storage.LCUser.SignUp ( )
inline

Signs up a new user.

Returns

◆ SignUpOrLoginByMobilePhone()

static async Task< LCUser > LeanCloud.Storage.LCUser.SignUpOrLoginByMobilePhone ( string  mobile,
string  code 
)
inlinestatic

Signs up or signs in a user with their mobile number and verification code.

Parameters
mobile
code
Returns

◆ StrictlyFind()

static async Task< ReadOnlyCollection< LCUser > > LeanCloud.Storage.LCUser.StrictlyFind ( LCUserQueryCondition  condition)
inlinestatic

◆ Unfollow()

async Task LeanCloud.Storage.LCUser.Unfollow ( string  targetId)
inline

Unfollows a user.

Parameters
targetId
Returns

◆ UpdatePassword()

async Task LeanCloud.Storage.LCUser.UpdatePassword ( string  oldPassword,
string  newPassword 
)
inline

Updates newPassword safely with oldPassword.

Parameters
oldPassword
newPassword
Returns

◆ VerifyCodeForUpdatingPhoneNumber()

static async Task LeanCloud.Storage.LCUser.VerifyCodeForUpdatingPhoneNumber ( string  mobile,
string  code 
)
inlinestatic

Verify code for updating phone number.

Parameters
mobile
code
Returns

◆ VerifyMobilePhone()

static async Task LeanCloud.Storage.LCUser.VerifyMobilePhone ( string  mobile,
string  code 
)
inlinestatic

Requests to verify a user's mobile number with sms code they received.

Parameters
mobile
code
Returns

Member Data Documentation

◆ CLASS_NAME

const string LeanCloud.Storage.LCUser.CLASS_NAME = "_User"
static

◆ ENDPOINT

const string LeanCloud.Storage.LCUser.ENDPOINT = "users"
static

Property Documentation

◆ AuthData

Dictionary<string, object> LeanCloud.Storage.LCUser.AuthData
getset

◆ Email

string LeanCloud.Storage.LCUser.Email
getset

◆ EmailVerified

bool LeanCloud.Storage.LCUser.EmailVerified
get

◆ IsAnonymous

bool LeanCloud.Storage.LCUser.IsAnonymous
get

Checks whether this user is anonymous.

◆ Mobile

string LeanCloud.Storage.LCUser.Mobile
getset

◆ MobileVerified

bool LeanCloud.Storage.LCUser.MobileVerified
get

◆ Password

string LeanCloud.Storage.LCUser.Password
getset

◆ SessionToken

string LeanCloud.Storage.LCUser.SessionToken
getset

◆ Username

string LeanCloud.Storage.LCUser.Username
getset

The documentation for this class was generated from the following file: