public static AuthToken Parse(string text, bool isRgx = false) { AuthToken token = null; if (isRgx) { var matchAccessToken = rgxAccessToken.Match(text); var matchRefreshToken = rgxRefreshToken.Match(text); var matchTokenType = rgxTokenType.Match(text); var matchExpiresIn = rgxExpiresIn.Match(text); if (matchAccessToken.Success && matchRefreshToken.Success) { token = new AuthToken(); token.access_token = matchAccessToken.Groups[1].Value; token.refresh_token = matchRefreshToken.Groups[1].Value; token.token_type = matchTokenType.Groups[1].Value; token.expires_in = Convert.ToInt32(matchExpiresIn.Groups[1].Value); } else { return(null); } } else { token = SerializeExtension.JsonDeserlialize <AuthToken>(text); } token.ExpiresIn = DateTime.Now.AddSeconds(token.expires_in); return(token); }
public static AuthToken Parse(string text) { var token = SerializeExtension.JsonDeserlialize <AuthToken>(text); token.ExpiresIn = DateTime.Now.AddSeconds(token.expires_in); return(token); }
public static ImageFile Parse(string text) { return(SerializeExtension.JsonDeserlialize <ImageFile>(text)); }
public async Task <User> GetSelf() { return(await Get("http://api.huaban.com/users/me", o => SerializeExtension.JsonDeserlialize <User>(o))); }
public async Task <User> GetSelf() { return(await Get(Client.API_ME, o => SerializeExtension.JsonDeserlialize <User>(o))); }