/// <summary> /// Login the specified username and password. /// </summary> /// <param name="username">Username.</param> /// <param name="password">Password.</param> protected Account Login(string username, string password) { var client = new GitHubSharp.Client(username, password); var user = client.API.GetAuthenticatedUser(); return(new Account { Username = username, Password = password, AvatarUrl = user.Data.AvatarUrl }); }
public static void SetUser(Account account) { if (account == null) { Account = null; Client = null; Accounts.SetDefault(null); return; } Account = account; Accounts.SetDefault(Account); Client = new GitHubSharp.Client(Account.Username, Account.Password) { Timeout = 1000 * 30, //30 seconds CacheProvider = Cache, }; }
public static void SetUser(GitHubAccount account, GitHubSharp.Client client) { if (account == null) { Account = null; Client = null; Accounts.SetDefault(null); return; } Accounts.SetActiveAccount(account); Accounts.SetDefault(account); //Assign the client Client = client; Client.Timeout = 1000 * 30; CheckCacheSize(account.Cache); //Set the cache ClientCache = account.Cache; Client.Cache = new GitHubCache(account.Cache); }
/// <summary> /// Login the specified username and password. /// </summary> /// <param name="username">Username.</param> /// <param name="password">Password.</param> protected Account Login(string username, string password) { var client = new GitHubSharp.Client(username, password); var user = client.API.GetAuthenticatedUser(); return new Account { Username = username, Password = password, AvatarUrl = user.Data.AvatarUrl }; }