VSCode Formatter - Also bumped tests to net core 3.1

This commit is contained in:
Jonas Dellinger 2020-03-09 20:47:39 +01:00
parent 307d69945e
commit 466e61523d
74 changed files with 2626 additions and 2642 deletions

View File

@ -1,4 +1,4 @@
using System.Diagnostics; using System.Diagnostics;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace SpotifyAPI.Web.Auth namespace SpotifyAPI.Web.Auth

View File

@ -18,13 +18,10 @@ namespace SpotifyAPI.Web.Auth
public ProxyConfig ProxyConfig { get; set; } public ProxyConfig ProxyConfig { get; set; }
public AuthorizationCodeAuth(string redirectUri, string serverUri, Scope scope = Scope.None, string state = "") public AuthorizationCodeAuth(string redirectUri, string serverUri, Scope scope = Scope.None, string state = "") : base("code", "AuthorizationCodeAuth", redirectUri, serverUri, scope, state)
: base("code", "AuthorizationCodeAuth", redirectUri, serverUri, scope, state) { }
{
}
public AuthorizationCodeAuth(string clientId, string secretId, string redirectUri, string serverUri, Scope scope = Scope.None, string state = "") public AuthorizationCodeAuth(string clientId, string secretId, string redirectUri, string serverUri, Scope scope = Scope.None, string state = "") : this(redirectUri, serverUri, scope, state)
: this(redirectUri, serverUri, scope, state)
{ {
ClientId = clientId; ClientId = clientId;
SecretId = secretId; SecretId = secretId;
@ -130,7 +127,6 @@ namespace SpotifyAPI.Web.Auth
} }
public AuthorizationCodeAuthController(IHttpContext context) : base(context) public AuthorizationCodeAuthController(IHttpContext context) : base(context)
{ { }
}
} }
} }

View File

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http; using System.Net.Http;
using System.Text; using System.Text;
@ -27,8 +27,7 @@ namespace SpotifyAPI.Web.Auth
string auth = Convert.ToBase64String(Encoding.UTF8.GetBytes(ClientId + ":" + ClientSecret)); string auth = Convert.ToBase64String(Encoding.UTF8.GetBytes(ClientId + ":" + ClientSecret));
List<KeyValuePair<string, string>> args = new List<KeyValuePair<string, string>> List<KeyValuePair<string, string>> args = new List<KeyValuePair<string, string>>
{ {new KeyValuePair<string, string>("grant_type", "client_credentials")
new KeyValuePair<string, string>("grant_type", "client_credentials")
}; };
HttpClientHandler handler = ProxyConfig.CreateClientHandler(ProxyConfig); HttpClientHandler handler = ProxyConfig.CreateClientHandler(ProxyConfig);

View File

@ -9,8 +9,7 @@ namespace SpotifyAPI.Web.Auth
{ {
public class ImplicitGrantAuth : SpotifyAuthServer<Token> public class ImplicitGrantAuth : SpotifyAuthServer<Token>
{ {
public ImplicitGrantAuth(string clientId, string redirectUri, string serverUri, Scope scope = Scope.None, string state = "") : public ImplicitGrantAuth(string clientId, string redirectUri, string serverUri, Scope scope = Scope.None, string state = "") : base("token", "ImplicitGrantAuth", redirectUri, serverUri, scope, state)
base("token", "ImplicitGrantAuth", redirectUri, serverUri, scope, state)
{ {
ClientId = clientId; ClientId = clientId;
} }
@ -59,7 +58,6 @@ namespace SpotifyAPI.Web.Auth
} }
public ImplicitGrantAuthController(IHttpContext context) : base(context) public ImplicitGrantAuthController(IHttpContext context) : base(context)
{ { }
}
} }
} }

View File

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;

View File

@ -1,14 +1,14 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Newtonsoft.Json;
using SpotifyAPI.Web.Enums; using SpotifyAPI.Web.Enums;
using SpotifyAPI.Web.Models;
using Unosquare.Labs.EmbedIO; using Unosquare.Labs.EmbedIO;
using Unosquare.Labs.EmbedIO.Constants; using Unosquare.Labs.EmbedIO.Constants;
using Unosquare.Labs.EmbedIO.Modules; using Unosquare.Labs.EmbedIO.Modules;
using SpotifyAPI.Web.Models;
using Newtonsoft.Json;
using System.Net.Http;
namespace SpotifyAPI.Web.Auth namespace SpotifyAPI.Web.Auth
{ {
@ -91,8 +91,7 @@ namespace SpotifyAPI.Web.Auth
int currentRetries = 0) int currentRetries = 0)
{ {
FormUrlEncodedContent content = new FormUrlEncodedContent(new Dictionary<string, string> FormUrlEncodedContent content = new FormUrlEncodedContent(new Dictionary<string, string>
{ { { "grant_type", grantType },
{"grant_type", grantType},
{ "code", authorizationCode }, { "code", authorizationCode },
{ "refresh_token", refreshToken } { "refresh_token", refreshToken }
}); });
@ -111,8 +110,7 @@ namespace SpotifyAPI.Web.Auth
} }
} }
catch catch
{ { }
}
if (currentRetries >= MaxGetTokenRetries) if (currentRetries >= MaxGetTokenRetries)
{ {
@ -194,8 +192,7 @@ namespace SpotifyAPI.Web.Auth
internal class TokenSwapAuthController : WebApiController internal class TokenSwapAuthController : WebApiController
{ {
public TokenSwapAuthController(IHttpContext context) : base(context) public TokenSwapAuthController(IHttpContext context) : base(context)
{ { }
}
[WebApiHandler(HttpVerbs.Get, "/auth")] [WebApiHandler(HttpVerbs.Get, "/auth")]
public Task<bool> GetAuth() public Task<bool> GetAuth()

View File

@ -1,9 +1,9 @@
using SpotifyAPI.Web.Enums;
using SpotifyAPI.Web.Models;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using SpotifyAPI.Web.Enums;
using SpotifyAPI.Web.Models;
namespace SpotifyAPI.Web.Auth namespace SpotifyAPI.Web.Auth
{ {
@ -127,8 +127,7 @@ namespace SpotifyAPI.Web.Auth
public static new AccessTokenExpiredEventArgs Empty { get; } = new AccessTokenExpiredEventArgs(); public static new AccessTokenExpiredEventArgs Empty { get; } = new AccessTokenExpiredEventArgs();
public AccessTokenExpiredEventArgs() public AccessTokenExpiredEventArgs()
{ { }
}
} }
/// <summary> /// <summary>
/// When the authorization from Spotify expires. This will only occur if <see cref="AutoRefresh"/> is true. /// When the authorization from Spotify expires. This will only occur if <see cref="AutoRefresh"/> is true.
@ -140,8 +139,7 @@ namespace SpotifyAPI.Web.Auth
public static new AuthSuccessEventArgs Empty { get; } = new AuthSuccessEventArgs(); public static new AuthSuccessEventArgs Empty { get; } = new AuthSuccessEventArgs();
public AuthSuccessEventArgs() public AuthSuccessEventArgs()
{ { }
}
} }
/// <summary> /// <summary>
/// When an authorization attempt succeeds and gains authorization. /// When an authorization attempt succeeds and gains authorization.

View File

@ -1,4 +1,4 @@
using System.Diagnostics; using System.Diagnostics;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;

View File

@ -26,7 +26,7 @@ namespace SpotifyAPI.Web.Examples.ASP
.AddCookie() .AddCookie()
.AddSpotify(options => .AddSpotify(options =>
{ {
var scopes = Scope.UserLibraryRead; var scopes = Scope.UserLibraryRead | Scope.UserModifyPlaybackState;
options.Scope.Add(scopes.GetStringAttribute(",")); options.Scope.Add(scopes.GetStringAttribute(","));
options.SaveTokens = true; options.SaveTokens = true;

View File

@ -1,4 +1,4 @@
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using SpotifyAPI.Web.Auth; using SpotifyAPI.Web.Auth;
using SpotifyAPI.Web.Enums; using SpotifyAPI.Web.Enums;
@ -14,13 +14,13 @@ namespace SpotifyAPI.Web.Examples.CLI
// ReSharper disable once UnusedParameter.Local // ReSharper disable once UnusedParameter.Local
public static void Main(string[] args) public static void Main(string[] args)
{ {
_clientId = string.IsNullOrEmpty(_clientId) _clientId = string.IsNullOrEmpty(_clientId) ?
? Environment.GetEnvironmentVariable("SPOTIFY_CLIENT_ID") Environment.GetEnvironmentVariable("SPOTIFY_CLIENT_ID") :
: _clientId; _clientId;
_secretId = string.IsNullOrEmpty(_secretId) _secretId = string.IsNullOrEmpty(_secretId) ?
? Environment.GetEnvironmentVariable("SPOTIFY_SECRET_ID") Environment.GetEnvironmentVariable("SPOTIFY_SECRET_ID") :
: _secretId; _secretId;
Console.WriteLine("####### Spotify API Example #######"); Console.WriteLine("####### Spotify API Example #######");
Console.WriteLine("This example uses AuthorizationCodeAuth."); Console.WriteLine("This example uses AuthorizationCodeAuth.");
@ -37,8 +37,6 @@ namespace SpotifyAPI.Web.Examples.CLI
Console.ReadLine(); Console.ReadLine();
auth.Stop(0); auth.Stop(0);
} }
private static async void AuthOnAuthReceived(object sender, AuthorizationCode payload) private static async void AuthOnAuthReceived(object sender, AuthorizationCode payload)

View File

@ -1,4 +1,4 @@
using System; using System;
using NUnit.Framework; using NUnit.Framework;
namespace SpotifyAPI.Web.Tests namespace SpotifyAPI.Web.Tests

View File

@ -1,8 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework> <TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
</PropertyGroup> </PropertyGroup>

View File

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@ -67,7 +67,6 @@ namespace SpotifyAPI.Web.Tests
_mock.Setup(client => client.DownloadJson<PublicProfile>(It.IsAny<string>(), It.IsAny<Dictionary<string, string>>())) _mock.Setup(client => client.DownloadJson<PublicProfile>(It.IsAny<string>(), It.IsAny<Dictionary<string, string>>()))
.Returns(new Tuple<ResponseInfo, PublicProfile>(ResponseInfo.Empty, profile)); .Returns(new Tuple<ResponseInfo, PublicProfile>(ResponseInfo.Empty, profile));
_spotify.UseAuth = false; _spotify.UseAuth = false;
Assert.AreEqual(profile, _spotify.GetPublicProfile("wizzler")); Assert.AreEqual(profile, _spotify.GetPublicProfile("wizzler"));
_mock.Verify(client => client.DownloadJson<PublicProfile>( _mock.Verify(client => client.DownloadJson<PublicProfile>(

View File

@ -1,4 +1,4 @@
using System; using System;
using NUnit.Framework; using NUnit.Framework;
namespace SpotifyAPI.Web.Tests namespace SpotifyAPI.Web.Tests

View File

@ -1,4 +1,4 @@
using System; using System;
namespace SpotifyAPI.Web.Enums namespace SpotifyAPI.Web.Enums
{ {

View File

@ -1,4 +1,4 @@
using System; using System;
namespace SpotifyAPI.Web.Enums namespace SpotifyAPI.Web.Enums
{ {

View File

@ -1,4 +1,4 @@
using System; using System;
namespace SpotifyAPI.Web.Enums namespace SpotifyAPI.Web.Enums
{ {

View File

@ -1,4 +1,4 @@
using System; using System;
namespace SpotifyAPI.Web.Enums namespace SpotifyAPI.Web.Enums
{ {

View File

@ -1,4 +1,4 @@
using System; using System;
namespace SpotifyAPI.Web.Enums namespace SpotifyAPI.Web.Enums
{ {

View File

@ -1,4 +1,4 @@
using System; using System;
namespace SpotifyAPI.Web.Enums namespace SpotifyAPI.Web.Enums
{ {

View File

@ -1,4 +1,4 @@
using System; using System;
namespace SpotifyAPI.Web.Enums namespace SpotifyAPI.Web.Enums
{ {

View File

@ -1,7 +1,7 @@
using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using Newtonsoft.Json;
using SpotifyAPI.Web.Models; using SpotifyAPI.Web.Models;
namespace SpotifyAPI.Web namespace SpotifyAPI.Web

View File

@ -1,4 +1,4 @@
using Newtonsoft.Json; using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,4 +1,4 @@
using Newtonsoft.Json; using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,5 +1,5 @@
using Newtonsoft.Json;
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,4 +1,4 @@
using Newtonsoft.Json; using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,4 +1,4 @@
using Newtonsoft.Json; using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,5 +1,5 @@
using Newtonsoft.Json;
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,4 +1,4 @@
using Newtonsoft.Json; using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models

View File

@ -1,5 +1,5 @@
using Newtonsoft.Json;
using System.Net; using System.Net;
using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,5 +1,5 @@
using Newtonsoft.Json;
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,4 +1,4 @@
using Newtonsoft.Json; using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,4 +1,4 @@
using Newtonsoft.Json; using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,5 +1,5 @@
using Newtonsoft.Json;
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,4 +1,4 @@
using Newtonsoft.Json; using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,4 +1,4 @@
using Newtonsoft.Json; using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,4 +1,4 @@
using Newtonsoft.Json; using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,5 +1,5 @@
using Newtonsoft.Json;
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,5 +1,5 @@
using Newtonsoft.Json;
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,5 +1,5 @@
using Newtonsoft.Json;
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,5 +1,5 @@
using Newtonsoft.Json;
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,7 +1,7 @@
using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {
@ -18,8 +18,7 @@ namespace SpotifyAPI.Web.Models
} }
public class ErrorResponse : BasicModel public class ErrorResponse : BasicModel
{ { }
}
public class Error public class Error
{ {

View File

@ -1,4 +1,4 @@
using Newtonsoft.Json; using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,5 +1,5 @@
using Newtonsoft.Json;
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,4 +1,4 @@
using System; using System;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models

View File

@ -1,4 +1,4 @@
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Converters; using Newtonsoft.Json.Converters;
using SpotifyAPI.Web.Enums; using SpotifyAPI.Web.Enums;

View File

@ -1,5 +1,5 @@
using Newtonsoft.Json;
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,5 +1,5 @@
using Newtonsoft.Json;
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,4 +1,4 @@
using Newtonsoft.Json; using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models

View File

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models

View File

@ -1,4 +1,4 @@
using System.Net; using System.Net;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,4 +1,4 @@
using Newtonsoft.Json; using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models

View File

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models

View File

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models

View File

@ -1,5 +1,5 @@
using Newtonsoft.Json;
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,5 +1,5 @@
using Newtonsoft.Json;
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,5 +1,5 @@
using Newtonsoft.Json;
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,5 +1,5 @@
using Newtonsoft.Json;
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,4 +1,4 @@
using Newtonsoft.Json; using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,5 +1,5 @@
using Newtonsoft.Json;
using System; using System;
using Newtonsoft.Json;
namespace SpotifyAPI.Web.Models namespace SpotifyAPI.Web.Models
{ {

View File

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Reflection; using System.Reflection;
@ -57,9 +57,9 @@ namespace SpotifyAPI.Web.Models
string name = info.GetCustomAttribute<StringAttribute>()?.Text; string name = info.GetCustomAttribute<StringAttribute>()?.Text;
if (name == null || value == null) if (name == null || value == null)
continue; continue;
urlParams.Add(value is float valueAsFloat urlParams.Add(value is float valueAsFloat ?
? $"{prefix}_{name}={valueAsFloat.ToString(CultureInfo.InvariantCulture)}" $"{prefix}_{name}={valueAsFloat.ToString(CultureInfo.InvariantCulture)}" :
: $"{prefix}_{name}={value}"); $"{prefix}_{name}={value}");
} }
if (urlParams.Count > 0) if (urlParams.Count > 0)
return "&" + string.Join("&", urlParams); return "&" + string.Join("&", urlParams);

View File

@ -1,4 +1,4 @@
using System; using System;
using System.Net; using System.Net;
using System.Net.Http; using System.Net.Http;

View File

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;

View File

@ -1,4 +1,3 @@
using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net; using System.Net;
@ -6,6 +5,7 @@ using System.Net.Http;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Newtonsoft.Json;
using SpotifyAPI.Web.Models; using SpotifyAPI.Web.Models;
namespace SpotifyAPI.Web namespace SpotifyAPI.Web
@ -83,7 +83,8 @@ namespace SpotifyAPI.Web
public async Task<Tuple<ResponseInfo, T>> DownloadJsonAsync<T>(string url, Dictionary<string, string> headers = null) public async Task<Tuple<ResponseInfo, T>> DownloadJsonAsync<T>(string url, Dictionary<string, string> headers = null)
{ {
Tuple<ResponseInfo, string> response = await DownloadAsync(url, headers).ConfigureAwait(false);try Tuple<ResponseInfo, string> response = await DownloadAsync(url, headers).ConfigureAwait(false);
try
{ {
return new Tuple<ResponseInfo, T>(response.Item1, JsonConvert.DeserializeObject<T>(response.Item2, JsonSettings)); return new Tuple<ResponseInfo, T>(response.Item1, JsonConvert.DeserializeObject<T>(response.Item2, JsonSettings));
} }

View File

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;