Esempio n. 1
0
 /// <summary>
 /// Autenticates the user.
 /// </summary>
 /// <returns>The GrooveShark Authenticated user.</returns>
 /// <param name="user">GrooveShark User.</param>
 public LoggedUser AutenticateUser(User user)
 {
     logger.Debug("authenticate user...");
     LoggedUser loggedUser = this.Exexute<LoggedUser>(new GsRequest("authenticate", user));
     loggedUser.addBasicUserInfos(user);
     loggedUser.SetLastSessionId(this.header.sessionID);
     return loggedUser;
 }
Esempio n. 2
0
 /// <summary>
 /// Adds the basic user infos.
 /// </summary>
 /// <param name="user">Existing basic User.</param>
 public void addBasicUserInfos(User user)
 {
     this.login = user.login;
     this.password = user.password;
 }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GrooveShark.Model.User"/> class.
 /// </summary>
 /// <param name="user">User.</param>
 public User(User user)
 {
     this.login = user.login;
     this.password = user.password;
 }
Esempio n. 4
0
 /// <summary>
 /// Recovers the session.
 /// </summary>
 /// <returns>The Logged User.</returns>
 /// <param name="user">GrooveShark User.</param>
 public LoggedUser RecoverSession(User user)
 {
     logger.Debug("recover session...");
     if(user.lastSessionId == null) {
         logger.Warn("session id not found");
         throw new GsApiSessionException("can't get last session id");
     }
     this.header.sessionID = user.lastSessionId;
     try {
         LoggedUser loggedUser = this.Exexute<LoggedUser>(new GsRequest("getUserInfo", user));
         loggedUser.addBasicUserInfos(user);
         return loggedUser;
     } catch(ApiException) {
         logger.Warn("session id expired");
         throw new GsApiSessionException("session expired");
     }
 }