diff --git a/IF.Lastfm.Core/Api/Auth.cs b/IF.Lastfm.Core/Api/Auth.cs index 0ea39de..377d9d9 100644 --- a/IF.Lastfm.Core/Api/Auth.cs +++ b/IF.Lastfm.Core/Api/Auth.cs @@ -30,6 +30,17 @@ public Auth(string apikey, string secret) _apiSecret = secret; } + /// + /// Load an existing user session + /// + /// Session to load + /// Whether session object is valid + public bool LoadSession(UserSession session) + { + User = session; + return true; + } + public async Task GetSessionTokenAsync(string username, string password) { const string apiMethod = "auth.getMobileSession"; diff --git a/IF.Lastfm.Core/Api/IAuth.cs b/IF.Lastfm.Core/Api/IAuth.cs index b31b548..a8fa933 100644 --- a/IF.Lastfm.Core/Api/IAuth.cs +++ b/IF.Lastfm.Core/Api/IAuth.cs @@ -11,6 +11,13 @@ public interface IAuth string ApiKey { get; } UserSession User { get; } + /// + /// Load an existing user session object. + /// + /// + /// Whether session object is valid + bool LoadSession(UserSession session); + /// /// Gets the session token which is used as authentication for any service calls. /// Username and password aren't stored.