示例#1
0
        public async Task <UserApiClient> GetAuthorizedApiClientAsync(string apiKey, string secret, string username, string sessionKey)
        {
            var client = new UserApiClient(apiKey, secret, username, sessionKey);

            if (!client.Authorized)
            {
                await client.GetToken();
            }

            return(client);
        }
示例#2
0
        public async Task <bool> IsLovedAsync(UserApiClient client, Track track)
        {
            var isLovedMethod = new IsLovedMethod(client, track, client.Username);

            return(await isLovedMethod.GetResultAsync());
        }
示例#3
0
 public async Task UnloveTrackAsync(UserApiClient client, Track track)
 {
     var unloveTrackMethod = new UnloveTrackMethod(client, track);
     await unloveTrackMethod.PostAsync();
 }
示例#4
0
 public async Task UpdateNowPlayingAsync(UserApiClient client, Track track, int duration)
 {
     var updateNowPlayingMethod = new UpdateNowPlayingMethod(client, track, duration);
     await updateNowPlayingMethod.PostAsync();
 }
示例#5
0
 public async Task ScrobbleAsync(UserApiClient client, Track track, DateTime timePlayed)
 {
     var scrobbleMethod = new ScrobbleMethod(client, track, timePlayed);
     await scrobbleMethod.PostAsync();
 }
示例#6
0
 public async Task Authorize(UserApiClient client, int maxAttempts)
 {
     await client.Authorize(maxAttempts);
 }