public async Task <T> RequestAsync <T>(RestRequest req, int timeout = 0) { var res = await _restProtocol.RequestDataAsync(req, timeout); return(res is JToken ? (res as JToken).ToObject <T>() : Cast <T>(res)); }
public async Task <AuthInfo <TUser, TToken> > Authenticate(TToken token) { try { _authInfo = await _restProtocol.RequestDataAsync(new AuthRequest { method = "authenticate", data = token }); if (_authInfo != null) { SetIsAuthenticate(true); return(_authInfo); } else { throw new Exception("no auth info"); } } catch (Exception ex) { _authInfo = null; SetIsAuthenticate(false); throw ex; } }