Skip to content

Instantly share code, notes, and snippets.

@SeloSlav
Created June 23, 2018 23:58
Show Gist options
  • Save SeloSlav/f74e5ae8f1cddca4cef62e0376fe9b05 to your computer and use it in GitHub Desktop.
Save SeloSlav/f74e5ae8f1cddca4cef62e0376fe9b05 to your computer and use it in GitHub Desktop.
ParseUser.cs
#region Assembly Parse, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// C:\Users\marti\.nuget\packages\parse\2.0.0\lib\netstandard2.0\Parse.dll
#endregion
using System.Threading;
using System.Threading.Tasks;
namespace Parse
{
//
// Summary:
// Represents a user for a Parse application.
[ParseClassName("_User")]
public class ParseUser : ParseObject
{
public ParseUser();
//
// Summary:
// Constructs a Parse.ParseQuery`1 for ParseUsers.
public static ParseQuery<ParseUser> Query { get; }
//
// Summary:
// Gets the currently logged in ParseUser with a valid session, either from memory
// or disk if necessary.
public static ParseUser CurrentUser { get; }
//
// Summary:
// Sets the email address.
[ParseFieldName("email")]
public string Email { get; set; }
//
// Summary:
// Sets the password.
[ParseFieldName("password")]
public string Password { set; }
//
// Summary:
// Gets or sets the username.
[ParseFieldName("username")]
public string Username { get; set; }
public string SessionToken { get; }
//
// Summary:
// Whether the ParseUser has been authenticated on this device. Only an authenticated
// ParseUser can be saved and deleted.
public bool IsAuthenticated { get; }
//
// Summary:
// Logs in a user with a username and password. On success, this saves the session
// to disk so you can retrieve the currently logged in user using Parse.ParseUser.CurrentUser.
//
// Parameters:
// sessionToken:
// The session token to authorize with
//
// Returns:
// The user if authorization was successful
public static Task<ParseUser> BecomeAsync(string sessionToken);
//
// Summary:
// Logs in a user with a username and password. On success, this saves the session
// to disk so you can retrieve the currently logged in user using Parse.ParseUser.CurrentUser.
//
// Parameters:
// sessionToken:
// The session token to authorize with
//
// cancellationToken:
// The cancellation token.
//
// Returns:
// The user if authorization was successful
public static Task<ParseUser> BecomeAsync(string sessionToken, CancellationToken cancellationToken);
//
// Summary:
// Tells server to use revocable session on LogIn and SignUp, even when App's Settings
// has "Require Revocable Session" turned off. Issues network request in background
// to migrate the sessionToken on disk to revocable session.
//
// Returns:
// The Task that upgrades the session.
public static Task EnableRevocableSessionAsync();
//
// Summary:
// Tells server to use revocable session on LogIn and SignUp, even when App's Settings
// has "Require Revocable Session" turned off. Issues network request in background
// to migrate the sessionToken on disk to revocable session.
//
// Returns:
// The Task that upgrades the session.
public static Task EnableRevocableSessionAsync(CancellationToken cancellationToken);
//
// Summary:
// Logs in a user with a username and password. On success, this saves the session
// to disk so you can retrieve the currently logged in user using Parse.ParseUser.CurrentUser.
//
// Parameters:
// username:
// The username to log in with.
//
// password:
// The password to log in with.
//
// Returns:
// The newly logged-in user.
public static Task<ParseUser> LogInAsync(string username, string password);
//
// Summary:
// Logs in a user with a username and password. On success, this saves the session
// to disk so you can retrieve the currently logged in user using Parse.ParseUser.CurrentUser.
//
// Parameters:
// username:
// The username to log in with.
//
// password:
// The password to log in with.
//
// cancellationToken:
// The cancellation token.
//
// Returns:
// The newly logged-in user.
public static Task<ParseUser> LogInAsync(string username, string password, CancellationToken cancellationToken);
//
// Summary:
// Logs out the currently logged in user session. This will remove the session from
// disk, log out of linked services, and future calls to Parse.ParseUser.CurrentUser
// will return null.
//
// Remarks:
// Typically, you should use Parse.ParseUser.LogOutAsync, unless you are managing
// your own threading.
public static void LogOut();
//
// Summary:
// Logs out the currently logged in user session. This will remove the session from
// disk, log out of linked services, and future calls to Parse.ParseUser.CurrentUser
// will return null. This is preferable to using Parse.ParseUser.LogOut, unless
// your code is already running from a background thread.
public static Task LogOutAsync(CancellationToken cancellationToken);
//
// Summary:
// Logs out the currently logged in user session. This will remove the session from
// disk, log out of linked services, and future calls to Parse.ParseUser.CurrentUser
// will return null.
//
// Remarks:
// This is preferable to using Parse.ParseUser.LogOut, unless your code is already
// running from a background thread.
public static Task LogOutAsync();
//
// Summary:
// Requests a password reset email to be sent to the specified email address associated
// with the user account. This email allows the user to securely reset their password
// on the Parse site.
//
// Parameters:
// email:
// The email address associated with the user that forgot their password.
public static Task RequestPasswordResetAsync(string email);
//
// Summary:
// Requests a password reset email to be sent to the specified email address associated
// with the user account. This email allows the user to securely reset their password
// on the Parse site.
//
// Parameters:
// email:
// The email address associated with the user that forgot their password.
//
// cancellationToken:
// The cancellation token.
public static Task RequestPasswordResetAsync(string email, CancellationToken cancellationToken);
//
// Summary:
// Removes a key from the object's data if it exists.
//
// Parameters:
// key:
// The key to remove.
//
// Exceptions:
// T:System.ArgumentException:
// Cannot remove the username key.
public override void Remove(string key);
//
// Summary:
// Signs up a new user. This will create a new ParseUser on the server and will
// also persist the session on disk so that you can access the user using Parse.ParseUser.CurrentUser.
// A username and password must be set before calling SignUpAsync.
//
// Parameters:
// cancellationToken:
// The cancellation token.
public Task SignUpAsync(CancellationToken cancellationToken);
//
// Summary:
// Signs up a new user. This will create a new ParseUser on the server and will
// also persist the session on disk so that you can access the user using Parse.ParseUser.CurrentUser.
// A username and password must be set before calling SignUpAsync.
public Task SignUpAsync();
protected override bool IsKeyMutable(string key);
protected override Task SaveAsync(Task toAwait, CancellationToken cancellationToken);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment