diff --git a/SpotifyAPI.Web.Auth/AuthException.cs b/SpotifyAPI.Web.Auth/AuthException.cs index 06fe4720..41e1bdf3 100644 --- a/SpotifyAPI.Web.Auth/AuthException.cs +++ b/SpotifyAPI.Web.Auth/AuthException.cs @@ -14,7 +14,7 @@ namespace SpotifyAPI.Web.Auth System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { } - public string Error { get; set; } - public string State { get; set; } + public string? Error { get; set; } + public string? State { get; set; } } } diff --git a/SpotifyAPI.Web.Auth/EmbedIOAuthServer.cs b/SpotifyAPI.Web.Auth/EmbedIOAuthServer.cs index b5a625a5..97cb7d99 100644 --- a/SpotifyAPI.Web.Auth/EmbedIOAuthServer.cs +++ b/SpotifyAPI.Web.Auth/EmbedIOAuthServer.cs @@ -12,13 +12,13 @@ namespace SpotifyAPI.Web.Auth { public class EmbedIOAuthServer : IAuthServer { - public event Func AuthorizationCodeReceived; - public event Func ImplictGrantReceived; + public event Func? AuthorizationCodeReceived; + public event Func? ImplictGrantReceived; private const string AssetsResourcePath = "SpotifyAPI.Web.Auth.Resources.auth_assets"; private const string DefaultResourcePath = "SpotifyAPI.Web.Auth.Resources.default_site"; - private CancellationTokenSource _cancelTokenSource; + private CancellationTokenSource? _cancelTokenSource; private readonly WebServer _webServer; public EmbedIOAuthServer(Uri baseUri, int port) @@ -76,7 +76,7 @@ namespace SpotifyAPI.Web.Auth public Task Stop() { - _cancelTokenSource.Cancel(); + _cancelTokenSource?.Cancel(); return Task.CompletedTask; } diff --git a/SpotifyAPI.Web.Auth/Models/Response/AuthorizationCodeResponse.cs b/SpotifyAPI.Web.Auth/Models/Response/AuthorizationCodeResponse.cs index 224b4063..13d43608 100644 --- a/SpotifyAPI.Web.Auth/Models/Response/AuthorizationCodeResponse.cs +++ b/SpotifyAPI.Web.Auth/Models/Response/AuthorizationCodeResponse.cs @@ -9,7 +9,7 @@ namespace SpotifyAPI.Web.Auth Code = code; } - public string Code { get; set; } - public string State { get; set; } + public string Code { get; set; } = default!; + public string State { get; set; } = default!; } } diff --git a/SpotifyAPI.Web.Auth/Models/Response/ImplicitGrantResponse.cs b/SpotifyAPI.Web.Auth/Models/Response/ImplicitGrantResponse.cs index cc27b6ca..2950923e 100644 --- a/SpotifyAPI.Web.Auth/Models/Response/ImplicitGrantResponse.cs +++ b/SpotifyAPI.Web.Auth/Models/Response/ImplicitGrantResponse.cs @@ -14,10 +14,10 @@ namespace SpotifyAPI.Web.Auth ExpiresIn = expiresIn; } - public string AccessToken { get; set; } - public string TokenType { get; set; } + public string AccessToken { get; set; } = default!; + public string TokenType { get; set; } = default!; public int ExpiresIn { get; set; } - public string State { get; set; } + public string State { get; set; } = default!; /// /// Auto-Initalized to UTC Now diff --git a/SpotifyAPI.Web.Auth/SpotifyAPI.Web.Auth.csproj b/SpotifyAPI.Web.Auth/SpotifyAPI.Web.Auth.csproj index 3472e69c..ef329856 100644 --- a/SpotifyAPI.Web.Auth/SpotifyAPI.Web.Auth.csproj +++ b/SpotifyAPI.Web.Auth/SpotifyAPI.Web.Auth.csproj @@ -1,6 +1,8 @@  netstandard2.1;netstandard2.0 + 8.0 + enable SpotifyAPI.Web.Auth SpotifyAPI.Web.Auth Jonas Dellinger diff --git a/SpotifyAPI.Web.Examples/Example.CLI.PersistentConfig/Example.CLI.PersistentConfig.csproj b/SpotifyAPI.Web.Examples/Example.CLI.PersistentConfig/Example.CLI.PersistentConfig.csproj index ddfa049b..608c17db 100644 --- a/SpotifyAPI.Web.Examples/Example.CLI.PersistentConfig/Example.CLI.PersistentConfig.csproj +++ b/SpotifyAPI.Web.Examples/Example.CLI.PersistentConfig/Example.CLI.PersistentConfig.csproj @@ -3,6 +3,8 @@ Exe netcoreapp3.1 + 8.0 + enable diff --git a/SpotifyAPI.Web.Examples/Example.CLI.PersistentConfig/Program.cs b/SpotifyAPI.Web.Examples/Example.CLI.PersistentConfig/Program.cs index aec0ac8f..293e28bf 100644 --- a/SpotifyAPI.Web.Examples/Example.CLI.PersistentConfig/Program.cs +++ b/SpotifyAPI.Web.Examples/Example.CLI.PersistentConfig/Program.cs @@ -1,4 +1,3 @@ -using System.Diagnostics; using System.IO; using System.Threading.Tasks; using System; @@ -18,12 +17,19 @@ namespace Example.CLI.PersistentConfig public class Program { private const string CredentialsPath = "credentials.json"; - private static readonly string clientId = Environment.GetEnvironmentVariable("SPOTIFY_CLIENT_ID"); - private static readonly string clientSecret = Environment.GetEnvironmentVariable("SPOTIFY_CLIENT_SECRET"); - private static EmbedIOAuthServer _server; + private static readonly string? clientId = Environment.GetEnvironmentVariable("SPOTIFY_CLIENT_ID"); + private static readonly string? clientSecret = Environment.GetEnvironmentVariable("SPOTIFY_CLIENT_SECRET"); + private static readonly EmbedIOAuthServer _server = new EmbedIOAuthServer(new Uri("http://localhost:5000/callback"), 5000); public static async Task Main() { + if (string.IsNullOrEmpty(clientId) || string.IsNullOrEmpty(clientSecret)) + { + throw new NullReferenceException( + "Please set SPOTIFY_CLIENT_ID and SPOTIFY_CLIENT_SECRET via environment variables before starting the program" + ); + } + if (File.Exists(CredentialsPath)) { await Start(); @@ -42,7 +48,7 @@ namespace Example.CLI.PersistentConfig var json = await File.ReadAllTextAsync(CredentialsPath); var token = JsonConvert.DeserializeObject(json); - var authenticator = new AuthorizationCodeAuthenticator(clientId, clientSecret, token); + var authenticator = new AuthorizationCodeAuthenticator(clientId!, clientSecret!, token); authenticator.TokenRefreshed += (sender, token) => File.WriteAllText(CredentialsPath, JsonConvert.SerializeObject(token)); var config = SpotifyClientConfig.CreateDefault() @@ -61,11 +67,10 @@ namespace Example.CLI.PersistentConfig private static async Task StartAuthentication() { - _server = new EmbedIOAuthServer(new Uri("http://localhost:5000/callback"), 5000); await _server.Start(); _server.AuthorizationCodeReceived += OnAuthorizationCodeReceived; - var request = new LoginRequest(_server.BaseUri, clientId, LoginRequest.ResponseType.Code) + var request = new LoginRequest(_server.BaseUri, clientId!, LoginRequest.ResponseType.Code) { Scope = new List { UserReadEmail, UserReadPrivate, PlaylistReadPrivate } }; @@ -85,7 +90,7 @@ namespace Example.CLI.PersistentConfig { await _server.Stop(); AuthorizationCodeTokenResponse token = await new OAuthClient().RequestToken( - new AuthorizationCodeTokenRequest(clientId, clientSecret, response.Code, _server.BaseUri) + new AuthorizationCodeTokenRequest(clientId!, clientSecret!, response.Code, _server.BaseUri) ); await File.WriteAllTextAsync(CredentialsPath, JsonConvert.SerializeObject(token)); diff --git a/SpotifyAPI.Web.Tests/Clients/UserProfileClientTest.cs b/SpotifyAPI.Web.Tests/Clients/UserProfileClientTest.cs index a5dd4232..de51084e 100644 --- a/SpotifyAPI.Web.Tests/Clients/UserProfileClientTest.cs +++ b/SpotifyAPI.Web.Tests/Clients/UserProfileClientTest.cs @@ -28,7 +28,7 @@ namespace SpotifyAPI.Web await client.Get(userId); - api.Verify(a => a.Get(SpotifyUrls.User("userId")), Times.Once); + api.Verify(a => a.Get(SpotifyUrls.User(userId)), Times.Once); } } } diff --git a/SpotifyAPI.Web/Clients/OAuthClient.cs b/SpotifyAPI.Web/Clients/OAuthClient.cs index 14558665..e6e92ab2 100644 --- a/SpotifyAPI.Web/Clients/OAuthClient.cs +++ b/SpotifyAPI.Web/Clients/OAuthClient.cs @@ -101,6 +101,7 @@ namespace SpotifyAPI.Web private static APIConnector ValidateConfig(SpotifyClientConfig config) { Ensure.ArgumentNotNull(config, nameof(config)); + return new APIConnector( config.BaseAddress, config.Authenticator, diff --git a/SpotifyAPI.Web/Clients/SpotifyClientConfig.cs b/SpotifyAPI.Web/Clients/SpotifyClientConfig.cs index 6223b180..75bc7881 100644 --- a/SpotifyAPI.Web/Clients/SpotifyClientConfig.cs +++ b/SpotifyAPI.Web/Clients/SpotifyClientConfig.cs @@ -7,11 +7,11 @@ namespace SpotifyAPI.Web public class SpotifyClientConfig { public Uri BaseAddress { get; private set; } - public IAuthenticator Authenticator { get; private set; } + public IAuthenticator? Authenticator { get; private set; } public IJSONSerializer JSONSerializer { get; private set; } public IHTTPClient HTTPClient { get; private set; } - public IHTTPLogger HTTPLogger { get; private set; } - public IRetryHandler RetryHandler { get; private set; } + public IHTTPLogger? HTTPLogger { get; private set; } + public IRetryHandler? RetryHandler { get; private set; } public IPaginator DefaultPaginator { get; private set; } /// @@ -26,11 +26,11 @@ namespace SpotifyAPI.Web /// public SpotifyClientConfig( Uri baseAddress, - IAuthenticator authenticator, + IAuthenticator? authenticator, IJSONSerializer jsonSerializer, IHTTPClient httpClient, - IRetryHandler retryHandler, - IHTTPLogger httpLogger, + IRetryHandler? retryHandler, + IHTTPLogger? httpLogger, IPaginator defaultPaginator ) { diff --git a/SpotifyAPI.Web/Exceptions/APIException.cs b/SpotifyAPI.Web/Exceptions/APIException.cs index ebfe182d..2de67e42 100644 --- a/SpotifyAPI.Web/Exceptions/APIException.cs +++ b/SpotifyAPI.Web/Exceptions/APIException.cs @@ -7,9 +7,9 @@ using System.Runtime.Serialization; namespace SpotifyAPI.Web { [Serializable] - public class APIException : System.Exception + public class APIException : Exception { - public IResponse Response { get; set; } + public IResponse? Response { get; set; } public APIException(IResponse response) : base(ParseAPIErrorMessage(response)) { @@ -26,7 +26,7 @@ namespace SpotifyAPI.Web { } - public APIException(string message, System.Exception innerException) : base(message, innerException) + public APIException(string message, Exception innerException) : base(message, innerException) { } @@ -35,7 +35,7 @@ namespace SpotifyAPI.Web Response = info.GetValue("APIException.Response", typeof(IResponse)) as IResponse; } - private static string ParseAPIErrorMessage(IResponse response) + private static string? ParseAPIErrorMessage(IResponse response) { var body = response.Body as string; if (string.IsNullOrEmpty(body)) @@ -44,7 +44,7 @@ namespace SpotifyAPI.Web } try { - JObject bodyObject = JObject.Parse(body); + JObject bodyObject = JObject.Parse(body!); JObject error = bodyObject.Value("error"); if (error != null) { diff --git a/SpotifyAPI.Web/Http/APIConnector.cs b/SpotifyAPI.Web/Http/APIConnector.cs index 261fe139..00a25022 100644 --- a/SpotifyAPI.Web/Http/APIConnector.cs +++ b/SpotifyAPI.Web/Http/APIConnector.cs @@ -9,22 +9,22 @@ namespace SpotifyAPI.Web.Http public class APIConnector : IAPIConnector { private readonly Uri _baseAddress; - private readonly IAuthenticator _authenticator; + private readonly IAuthenticator? _authenticator; private readonly IJSONSerializer _jsonSerializer; private readonly IHTTPClient _httpClient; - private readonly IRetryHandler _retryHandler; - private readonly IHTTPLogger _httpLogger; + private readonly IRetryHandler? _retryHandler; + private readonly IHTTPLogger? _httpLogger; public APIConnector(Uri baseAddress, IAuthenticator authenticator) : this(baseAddress, authenticator, new NewtonsoftJSONSerializer(), new NetHttpClient(), null, null) { } public APIConnector( Uri baseAddress, - IAuthenticator authenticator, + IAuthenticator? authenticator, IJSONSerializer jsonSerializer, IHTTPClient httpClient, - IRetryHandler retryHandler, - IHTTPLogger httpLogger) + IRetryHandler? retryHandler, + IHTTPLogger? httpLogger) { _baseAddress = baseAddress; _authenticator = authenticator; @@ -41,21 +41,21 @@ namespace SpotifyAPI.Web.Http return SendAPIRequest(uri, HttpMethod.Delete); } - public Task Delete(Uri uri, IDictionary parameters) + public Task Delete(Uri uri, IDictionary? parameters) { Ensure.ArgumentNotNull(uri, nameof(uri)); return SendAPIRequest(uri, HttpMethod.Delete, parameters); } - public Task Delete(Uri uri, IDictionary parameters, object body) + public Task Delete(Uri uri, IDictionary? parameters, object? body) { Ensure.ArgumentNotNull(uri, nameof(uri)); return SendAPIRequest(uri, HttpMethod.Delete, parameters, body); } - public async Task Delete(Uri uri, IDictionary parameters, object body) + public async Task Delete(Uri uri, IDictionary? parameters, object? body) { Ensure.ArgumentNotNull(uri, nameof(uri)); @@ -70,14 +70,14 @@ namespace SpotifyAPI.Web.Http return SendAPIRequest(uri, HttpMethod.Get); } - public Task Get(Uri uri, IDictionary parameters) + public Task Get(Uri uri, IDictionary? parameters) { Ensure.ArgumentNotNull(uri, nameof(uri)); return SendAPIRequest(uri, HttpMethod.Get, parameters); } - public async Task Get(Uri uri, IDictionary parameters, object body) + public async Task Get(Uri uri, IDictionary? parameters, object? body) { Ensure.ArgumentNotNull(uri, nameof(uri)); @@ -92,28 +92,28 @@ namespace SpotifyAPI.Web.Http return SendAPIRequest(uri, HttpMethod.Post); } - public Task Post(Uri uri, IDictionary parameters) + public Task Post(Uri uri, IDictionary? parameters) { Ensure.ArgumentNotNull(uri, nameof(uri)); return SendAPIRequest(uri, HttpMethod.Post, parameters); } - public Task Post(Uri uri, IDictionary parameters, object body) + public Task Post(Uri uri, IDictionary? parameters, object? body) { Ensure.ArgumentNotNull(uri, nameof(uri)); return SendAPIRequest(uri, HttpMethod.Post, parameters, body); } - public Task Post(Uri uri, IDictionary parameters, object body, Dictionary headers) + public Task Post(Uri uri, IDictionary? parameters, object? body, Dictionary? headers) { Ensure.ArgumentNotNull(uri, nameof(uri)); return SendAPIRequest(uri, HttpMethod.Post, parameters, body, headers); } - public async Task Post(Uri uri, IDictionary parameters, object body) + public async Task Post(Uri uri, IDictionary? parameters, object? body) { Ensure.ArgumentNotNull(uri, nameof(uri)); @@ -128,21 +128,21 @@ namespace SpotifyAPI.Web.Http return SendAPIRequest(uri, HttpMethod.Put); } - public Task Put(Uri uri, IDictionary parameters) + public Task Put(Uri uri, IDictionary? parameters) { Ensure.ArgumentNotNull(uri, nameof(uri)); return SendAPIRequest(uri, HttpMethod.Put, parameters); } - public Task Put(Uri uri, IDictionary parameters, object body) + public Task Put(Uri uri, IDictionary? parameters, object? body) { Ensure.ArgumentNotNull(uri, nameof(uri)); return SendAPIRequest(uri, HttpMethod.Put, parameters, body); } - public async Task Put(Uri uri, IDictionary parameters, object body) + public async Task Put(Uri uri, IDictionary? parameters, object? body) { Ensure.ArgumentNotNull(uri, nameof(uri)); @@ -150,7 +150,7 @@ namespace SpotifyAPI.Web.Http return response.StatusCode; } - public async Task PutRaw(Uri uri, IDictionary parameters, object body) + public async Task PutRaw(Uri uri, IDictionary? parameters, object? body) { Ensure.ArgumentNotNull(uri, nameof(uri)); @@ -166,19 +166,21 @@ namespace SpotifyAPI.Web.Http private IRequest CreateRequest( Uri uri, HttpMethod method, - IDictionary parameters, - object body, - IDictionary headers + IDictionary? parameters, + object? body, + IDictionary? headers ) { Ensure.ArgumentNotNull(uri, nameof(uri)); Ensure.ArgumentNotNull(method, nameof(method)); - return new Request(headers ?? new Dictionary(), parameters ?? new Dictionary()) + return new Request( + _baseAddress, + uri, + method, + headers ?? new Dictionary(), + parameters ?? new Dictionary()) { - BaseAddress = _baseAddress, - Endpoint = uri, - Method = method, Body = body }; } @@ -222,16 +224,16 @@ namespace SpotifyAPI.Web.Http || request.Endpoint.AbsoluteUri.Contains("https://api.spotify.com", StringComparison.InvariantCulture)) #endif { - await _authenticator.Apply(request, this).ConfigureAwait(false); + await _authenticator!.Apply(request, this).ConfigureAwait(false); } } public Task SendRawRequest( Uri uri, HttpMethod method, - IDictionary parameters = null, - object body = null, - IDictionary headers = null + IDictionary? parameters = null, + object? body = null, + IDictionary? headers = null ) { var request = CreateRequest(uri, method, parameters, body, headers); @@ -241,9 +243,9 @@ namespace SpotifyAPI.Web.Http public async Task SendAPIRequest( Uri uri, HttpMethod method, - IDictionary parameters = null, - object body = null, - IDictionary headers = null + IDictionary? parameters = null, + object? body = null, + IDictionary? headers = null ) { var request = CreateRequest(uri, method, parameters, body, headers); @@ -254,9 +256,9 @@ namespace SpotifyAPI.Web.Http public async Task SendAPIRequestDetailed( Uri uri, HttpMethod method, - IDictionary parameters = null, - object body = null, - IDictionary headers = null + IDictionary? parameters = null, + object? body = null, + IDictionary? headers = null ) { var request = CreateRequest(uri, method, parameters, body, headers); diff --git a/SpotifyAPI.Web/Http/Authenticators/AuthorizationCodeAuthenticator.cs b/SpotifyAPI.Web/Http/Authenticators/AuthorizationCodeAuthenticator.cs index 77795962..e4059ebd 100644 --- a/SpotifyAPI.Web/Http/Authenticators/AuthorizationCodeAuthenticator.cs +++ b/SpotifyAPI.Web/Http/Authenticators/AuthorizationCodeAuthenticator.cs @@ -9,7 +9,7 @@ namespace SpotifyAPI.Web.Http /// public class AuthorizationCodeAuthenticator : IAuthenticator { - public event EventHandler TokenRefreshed; + public event EventHandler? TokenRefreshed; /// /// Initiate a new instance. The token will be refreshed once it expires. diff --git a/SpotifyAPI.Web/Http/Authenticators/CredentialsAuthenticator.cs b/SpotifyAPI.Web/Http/Authenticators/CredentialsAuthenticator.cs index d343e6e4..e78e4149 100644 --- a/SpotifyAPI.Web/Http/Authenticators/CredentialsAuthenticator.cs +++ b/SpotifyAPI.Web/Http/Authenticators/CredentialsAuthenticator.cs @@ -8,7 +8,7 @@ namespace SpotifyAPI.Web.Http /// public class CredentialsAuthenticator : IAuthenticator { - private CredentialsTokenResponse _token; + private CredentialsTokenResponse? _token; /// /// Initiate a new instance. The first token will be fetched when the first API call occurs diff --git a/SpotifyAPI.Web/Http/Interfaces/IAPIConnector.cs b/SpotifyAPI.Web/Http/Interfaces/IAPIConnector.cs index 8182b372..7f193a3a 100644 --- a/SpotifyAPI.Web/Http/Interfaces/IAPIConnector.cs +++ b/SpotifyAPI.Web/Http/Interfaces/IAPIConnector.cs @@ -17,32 +17,32 @@ namespace SpotifyAPI.Web.Http [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716")] Task Get(Uri uri); [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716")] - Task Get(Uri uri, IDictionary parameters); + Task Get(Uri uri, IDictionary? parameters); [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716")] - Task Get(Uri uri, IDictionary parameters, object body); + Task Get(Uri uri, IDictionary? parameters, object? body); Task Post(Uri uri); - Task Post(Uri uri, IDictionary parameters); - Task Post(Uri uri, IDictionary parameters, object body); - Task Post(Uri uri, IDictionary parameters, object body, Dictionary headers); - Task Post(Uri uri, IDictionary parameters, object body); + Task Post(Uri uri, IDictionary? parameters); + Task Post(Uri uri, IDictionary? parameters, object? body); + Task Post(Uri uri, IDictionary? parameters, object? body, Dictionary? headers); + Task Post(Uri uri, IDictionary? parameters, object? body); Task Put(Uri uri); - Task Put(Uri uri, IDictionary parameters); - Task Put(Uri uri, IDictionary parameters, object body); - Task Put(Uri uri, IDictionary parameters, object body); - Task PutRaw(Uri uri, IDictionary parameters, object body); + Task Put(Uri uri, IDictionary? parameters); + Task Put(Uri uri, IDictionary? parameters, object? body); + Task Put(Uri uri, IDictionary? parameters, object? body); + Task PutRaw(Uri uri, IDictionary? parameters, object? body); Task Delete(Uri uri); - Task Delete(Uri uri, IDictionary parameters); - Task Delete(Uri uri, IDictionary parameters, object body); - Task Delete(Uri uri, IDictionary parameters, object body); + Task Delete(Uri uri, IDictionary? parameters); + Task Delete(Uri uri, IDictionary? parameters, object? body); + Task Delete(Uri uri, IDictionary? parameters, object? body); Task SendAPIRequest( Uri uri, HttpMethod method, - IDictionary parameters = null, - object body = null, - IDictionary headers = null); + IDictionary? parameters = null, + object? body = null, + IDictionary? headers = null); void SetRequestTimeout(TimeSpan timeout); } diff --git a/SpotifyAPI.Web/Http/Interfaces/IProxyConfig.cs b/SpotifyAPI.Web/Http/Interfaces/IProxyConfig.cs index 1076feb3..7a6f281b 100644 --- a/SpotifyAPI.Web/Http/Interfaces/IProxyConfig.cs +++ b/SpotifyAPI.Web/Http/Interfaces/IProxyConfig.cs @@ -4,8 +4,8 @@ namespace SpotifyAPI.Web { string Host { get; } int Port { get; } - string User { get; } - string Password { get; } + string? User { get; } + string? Password { get; } bool SkipSSLCheck { get; } /// /// Whether to bypass the proxy server for local addresses. diff --git a/SpotifyAPI.Web/Http/Interfaces/IRequest.cs b/SpotifyAPI.Web/Http/Interfaces/IRequest.cs index 9a6c0db3..c5d91532 100644 --- a/SpotifyAPI.Web/Http/Interfaces/IRequest.cs +++ b/SpotifyAPI.Web/Http/Interfaces/IRequest.cs @@ -16,6 +16,6 @@ namespace SpotifyAPI.Web.Http HttpMethod Method { get; } - object Body { get; set; } + object? Body { get; set; } } } diff --git a/SpotifyAPI.Web/Http/Interfaces/IResponse.cs b/SpotifyAPI.Web/Http/Interfaces/IResponse.cs index 09b54fab..b4ace428 100644 --- a/SpotifyAPI.Web/Http/Interfaces/IResponse.cs +++ b/SpotifyAPI.Web/Http/Interfaces/IResponse.cs @@ -5,12 +5,12 @@ namespace SpotifyAPI.Web.Http { public interface IResponse { - object Body { get; } + object? Body { get; } IReadOnlyDictionary Headers { get; } HttpStatusCode StatusCode { get; } - string ContentType { get; } + string? ContentType { get; } } } diff --git a/SpotifyAPI.Web/Http/NetHttpClient.cs b/SpotifyAPI.Web/Http/NetHttpClient.cs index f4191f50..26b4435b 100644 --- a/SpotifyAPI.Web/Http/NetHttpClient.cs +++ b/SpotifyAPI.Web/Http/NetHttpClient.cs @@ -10,7 +10,7 @@ namespace SpotifyAPI.Web.Http { public class NetHttpClient : IHTTPClient { - private readonly HttpMessageHandler _httpMessageHandler; + private readonly HttpMessageHandler? _httpMessageHandler; private readonly HttpClient _httpClient; public NetHttpClient() diff --git a/SpotifyAPI.Web/Http/NewtonsoftJSONSerializer.cs b/SpotifyAPI.Web/Http/NewtonsoftJSONSerializer.cs index ff6d45c5..2db938ab 100644 --- a/SpotifyAPI.Web/Http/NewtonsoftJSONSerializer.cs +++ b/SpotifyAPI.Web/Http/NewtonsoftJSONSerializer.cs @@ -31,10 +31,13 @@ namespace SpotifyAPI.Web.Http { Ensure.ArgumentNotNull(response, nameof(response)); - if (response.ContentType?.Equals("application/json", StringComparison.Ordinal) is true || response.ContentType == null) + if ( + ( + response.ContentType?.Equals("application/json", StringComparison.Ordinal) is true || response.ContentType == null + )) { - var body = JsonConvert.DeserializeObject(response.Body as string, _serializerSettings); - return new APIResponse(response, body); + var body = JsonConvert.DeserializeObject(response.Body as string ?? "", _serializerSettings); + return new APIResponse(response, body!); } return new APIResponse(response); } diff --git a/SpotifyAPI.Web/Http/ProxyConfig.cs b/SpotifyAPI.Web/Http/ProxyConfig.cs index 5d08e9ee..0392c4d7 100644 --- a/SpotifyAPI.Web/Http/ProxyConfig.cs +++ b/SpotifyAPI.Web/Http/ProxyConfig.cs @@ -12,8 +12,8 @@ namespace SpotifyAPI.Web public string Host { get; } public int Port { get; } - public string User { get; set; } - public string Password { get; set; } + public string? User { get; set; } + public string? Password { get; set; } public bool BypassProxyOnLocal { get; set; } public bool SkipSSLCheck { get; set; } } diff --git a/SpotifyAPI.Web/Http/Request.cs b/SpotifyAPI.Web/Http/Request.cs index 18748f8e..42dd4cce 100644 --- a/SpotifyAPI.Web/Http/Request.cs +++ b/SpotifyAPI.Web/Http/Request.cs @@ -6,22 +6,36 @@ namespace SpotifyAPI.Web.Http { public class Request : IRequest { - public Request() + public Request(Uri baseAddress, Uri endpoint, HttpMethod method) { Headers = new Dictionary(); Parameters = new Dictionary(); + BaseAddress = baseAddress; + Endpoint = endpoint; + Method = method; } - public Request(IDictionary headers) + public Request(Uri baseAddress, Uri endpoint, HttpMethod method, IDictionary headers) { Headers = headers; Parameters = new Dictionary(); + BaseAddress = baseAddress; + Endpoint = endpoint; + Method = method; } - public Request(IDictionary headers, IDictionary parameters) + public Request( + Uri baseAddress, + Uri endpoint, + HttpMethod method, + IDictionary headers, + IDictionary parameters) { Headers = headers; Parameters = parameters; + BaseAddress = baseAddress; + Endpoint = endpoint; + Method = method; } public Uri BaseAddress { get; set; } @@ -34,6 +48,6 @@ namespace SpotifyAPI.Web.Http public HttpMethod Method { get; set; } - public object Body { get; set; } + public object? Body { get; set; } } } diff --git a/SpotifyAPI.Web/Http/Response.cs b/SpotifyAPI.Web/Http/Response.cs index 93d3ed74..de16744f 100644 --- a/SpotifyAPI.Web/Http/Response.cs +++ b/SpotifyAPI.Web/Http/Response.cs @@ -14,12 +14,12 @@ namespace SpotifyAPI.Web.Http Headers = new ReadOnlyDictionary(headers); } - public object Body { get; set; } + public object? Body { get; set; } public IReadOnlyDictionary Headers { get; set; } public HttpStatusCode StatusCode { get; set; } - public string ContentType { get; set; } + public string? ContentType { get; set; } } } diff --git a/SpotifyAPI.Web/Http/SimpleHTTPLogger.cs b/SpotifyAPI.Web/Http/SimpleHTTPLogger.cs index 8ec57608..d2487821 100644 --- a/SpotifyAPI.Web/Http/SimpleHTTPLogger.cs +++ b/SpotifyAPI.Web/Http/SimpleHTTPLogger.cs @@ -12,7 +12,7 @@ namespace SpotifyAPI.Web.Http { Ensure.ArgumentNotNull(request, nameof(request)); - string parameters = null; + string? parameters = null; if (request.Parameters != null) { parameters = string.Join(",", request.Parameters?.Select(kv => kv.Key + "=" + kv.Value).ToArray()); @@ -26,9 +26,9 @@ namespace SpotifyAPI.Web.Http { Ensure.ArgumentNotNull(response, nameof(response)); #if NETSTANDARD2_0 - string body = response.Body?.ToString().Replace("\n", ""); + string? body = response.Body?.ToString().Replace("\n", ""); #else - string body = response.Body?.ToString().Replace("\n", "", StringComparison.InvariantCulture); + string? body = response.Body?.ToString().Replace("\n", "", StringComparison.InvariantCulture); #endif body = body?.Substring(0, Math.Min(50, body?.Length ?? 0)); diff --git a/SpotifyAPI.Web/Models/Converters/PlaylistElementConverter.cs b/SpotifyAPI.Web/Models/Converters/PlaylistElementConverter.cs index 1505bb05..bec5e263 100644 --- a/SpotifyAPI.Web/Models/Converters/PlaylistElementConverter.cs +++ b/SpotifyAPI.Web/Models/Converters/PlaylistElementConverter.cs @@ -8,8 +8,8 @@ namespace SpotifyAPI.Web { public override bool CanConvert(Type objectType) => true; - public override object ReadJson(JsonReader reader, Type objectType, - object existingValue, JsonSerializer serializer) + public override object? ReadJson(JsonReader reader, Type objectType, + object? existingValue, JsonSerializer serializer) { Ensure.ArgumentNotNull(serializer, nameof(serializer)); @@ -19,7 +19,7 @@ namespace SpotifyAPI.Web return null; } - var type = token["type"].Value(); + var type = token["type"]?.Value(); if (type == "track") { var obj = new FullTrack(); @@ -38,10 +38,10 @@ namespace SpotifyAPI.Web } } - public override void WriteJson(JsonWriter writer, object value, - JsonSerializer serializer) + public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) { throw new NotSupportedException(); } } } + diff --git a/SpotifyAPI.Web/Models/Request/AlbumRequest.cs b/SpotifyAPI.Web/Models/Request/AlbumRequest.cs index 8633b9ab..0154d447 100644 --- a/SpotifyAPI.Web/Models/Request/AlbumRequest.cs +++ b/SpotifyAPI.Web/Models/Request/AlbumRequest.cs @@ -3,6 +3,6 @@ namespace SpotifyAPI.Web public class AlbumRequest : RequestParams { [QueryParam("market")] - public string Market { get; set; } + public string? Market { get; set; } } } diff --git a/SpotifyAPI.Web/Models/Request/AlbumTracksRequest.cs b/SpotifyAPI.Web/Models/Request/AlbumTracksRequest.cs index c02119ae..6e3d443a 100644 --- a/SpotifyAPI.Web/Models/Request/AlbumTracksRequest.cs +++ b/SpotifyAPI.Web/Models/Request/AlbumTracksRequest.cs @@ -3,7 +3,7 @@ namespace SpotifyAPI.Web public class AlbumTracksRequest : RequestParams { [QueryParam("market")] - public string Market { get; set; } + public string? Market { get; set; } [QueryParam("limit")] public int? Limit { get; set; } @@ -12,3 +12,4 @@ namespace SpotifyAPI.Web public int? Offset { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/AlbumsRequest.cs b/SpotifyAPI.Web/Models/Request/AlbumsRequest.cs index 4fb40cb4..f36f5403 100644 --- a/SpotifyAPI.Web/Models/Request/AlbumsRequest.cs +++ b/SpotifyAPI.Web/Models/Request/AlbumsRequest.cs @@ -15,6 +15,7 @@ namespace SpotifyAPI.Web public IList Ids { get; } [QueryParam("market")] - public string Market { get; set; } + public string? Market { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/ArtistsAlbumsRequest.cs b/SpotifyAPI.Web/Models/Request/ArtistsAlbumsRequest.cs index 618db6fa..2ae8a268 100644 --- a/SpotifyAPI.Web/Models/Request/ArtistsAlbumsRequest.cs +++ b/SpotifyAPI.Web/Models/Request/ArtistsAlbumsRequest.cs @@ -8,7 +8,7 @@ namespace SpotifyAPI.Web public IncludeGroups? IncludeGroupsParam { get; set; } [QueryParam("market")] - public string Market { get; set; } + public string? Market { get; set; } [QueryParam("limit")] public int? Limit { get; set; } @@ -34,3 +34,4 @@ namespace SpotifyAPI.Web } } } + diff --git a/SpotifyAPI.Web/Models/Request/ArtistsRequest.cs b/SpotifyAPI.Web/Models/Request/ArtistsRequest.cs index 81fdee4c..7342f766 100644 --- a/SpotifyAPI.Web/Models/Request/ArtistsRequest.cs +++ b/SpotifyAPI.Web/Models/Request/ArtistsRequest.cs @@ -15,3 +15,4 @@ namespace SpotifyAPI.Web public IList Ids { get; } } } + diff --git a/SpotifyAPI.Web/Models/Request/ArtistsTopTracksRequest.cs b/SpotifyAPI.Web/Models/Request/ArtistsTopTracksRequest.cs index d3b98cf5..9aaff456 100644 --- a/SpotifyAPI.Web/Models/Request/ArtistsTopTracksRequest.cs +++ b/SpotifyAPI.Web/Models/Request/ArtistsTopTracksRequest.cs @@ -13,3 +13,4 @@ namespace SpotifyAPI.Web public string Market { get; } } } + diff --git a/SpotifyAPI.Web/Models/Request/AuthorizationCodeRefreshRequest.cs b/SpotifyAPI.Web/Models/Request/AuthorizationCodeRefreshRequest.cs index 1bb54484..c2fb6cc2 100644 --- a/SpotifyAPI.Web/Models/Request/AuthorizationCodeRefreshRequest.cs +++ b/SpotifyAPI.Web/Models/Request/AuthorizationCodeRefreshRequest.cs @@ -21,3 +21,4 @@ namespace SpotifyAPI.Web public string ClientSecret { get; } } } + diff --git a/SpotifyAPI.Web/Models/Request/AuthorizationCodeTokenRequest.cs b/SpotifyAPI.Web/Models/Request/AuthorizationCodeTokenRequest.cs index e376fbda..831e4af0 100644 --- a/SpotifyAPI.Web/Models/Request/AuthorizationCodeTokenRequest.cs +++ b/SpotifyAPI.Web/Models/Request/AuthorizationCodeTokenRequest.cs @@ -25,3 +25,4 @@ namespace SpotifyAPI.Web public Uri RedirectUri { get; } } } + diff --git a/SpotifyAPI.Web/Models/Request/CategoriesRequest.cs b/SpotifyAPI.Web/Models/Request/CategoriesRequest.cs index 0e0072c6..8dd92e1c 100644 --- a/SpotifyAPI.Web/Models/Request/CategoriesRequest.cs +++ b/SpotifyAPI.Web/Models/Request/CategoriesRequest.cs @@ -3,10 +3,10 @@ namespace SpotifyAPI.Web public class CategoriesRequest : RequestParams { [QueryParam("country")] - public string Country { get; set; } + public string? Country { get; set; } [QueryParam("locale")] - public string Locale { get; set; } + public string? Locale { get; set; } [QueryParam("limit")] public int? Limit { get; set; } @@ -15,3 +15,4 @@ namespace SpotifyAPI.Web public int? Offset { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/CategoryPlaylistsRequest.cs b/SpotifyAPI.Web/Models/Request/CategoryPlaylistsRequest.cs index e7ff31f9..65ecb340 100644 --- a/SpotifyAPI.Web/Models/Request/CategoryPlaylistsRequest.cs +++ b/SpotifyAPI.Web/Models/Request/CategoryPlaylistsRequest.cs @@ -3,7 +3,7 @@ namespace SpotifyAPI.Web public class CategoriesPlaylistsRequest : RequestParams { [QueryParam("country")] - public string Country { get; set; } + public string? Country { get; set; } [QueryParam("limit")] public int? Limit { get; set; } @@ -12,3 +12,4 @@ namespace SpotifyAPI.Web public int? Offset { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/CategoryRequest.cs b/SpotifyAPI.Web/Models/Request/CategoryRequest.cs index 6fd31513..306a4976 100644 --- a/SpotifyAPI.Web/Models/Request/CategoryRequest.cs +++ b/SpotifyAPI.Web/Models/Request/CategoryRequest.cs @@ -3,9 +3,10 @@ namespace SpotifyAPI.Web public class CategoryRequest : RequestParams { [QueryParam("country")] - public string Country { get; set; } + public string? Country { get; set; } [QueryParam("locale")] - public string Locale { get; set; } + public string? Locale { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/ClientCredentialsRequest.cs b/SpotifyAPI.Web/Models/Request/ClientCredentialsRequest.cs index 00bcd31d..b4a12a3a 100644 --- a/SpotifyAPI.Web/Models/Request/ClientCredentialsRequest.cs +++ b/SpotifyAPI.Web/Models/Request/ClientCredentialsRequest.cs @@ -17,3 +17,4 @@ namespace SpotifyAPI.Web public string ClientSecret { get; } } } + diff --git a/SpotifyAPI.Web/Models/Request/EpisodeRequest.cs b/SpotifyAPI.Web/Models/Request/EpisodeRequest.cs index c4c178e4..28e034ee 100644 --- a/SpotifyAPI.Web/Models/Request/EpisodeRequest.cs +++ b/SpotifyAPI.Web/Models/Request/EpisodeRequest.cs @@ -3,6 +3,7 @@ namespace SpotifyAPI.Web public class EpisodeRequest : RequestParams { [QueryParam("market")] - public string Market { get; set; } + public string? Market { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/EpisodesRequest.cs b/SpotifyAPI.Web/Models/Request/EpisodesRequest.cs index e58ed833..a9450b60 100644 --- a/SpotifyAPI.Web/Models/Request/EpisodesRequest.cs +++ b/SpotifyAPI.Web/Models/Request/EpisodesRequest.cs @@ -12,9 +12,10 @@ namespace SpotifyAPI.Web } [QueryParam("ids")] - public IList Ids { get; set; } + public IList Ids { get; } [QueryParam("market")] - public string Market { get; set; } + public string? Market { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/FeaturedPlaylistsRequest.cs b/SpotifyAPI.Web/Models/Request/FeaturedPlaylistsRequest.cs index f97c384a..1cdb1fa7 100644 --- a/SpotifyAPI.Web/Models/Request/FeaturedPlaylistsRequest.cs +++ b/SpotifyAPI.Web/Models/Request/FeaturedPlaylistsRequest.cs @@ -5,19 +5,24 @@ namespace SpotifyAPI.Web public class FeaturedPlaylistsRequest : RequestParams { [QueryParam("country")] - public string Country { get; set; } + public string? Country { get; set; } + [QueryParam("locale")] - public string Locale { get; set; } + public string? Locale { get; set; } + [QueryParam("limit")] public int? Limit { get; set; } + [QueryParam("offset")] public int? Offset { get; set; } + public DateTime? Timestamp { get; set; } [QueryParam("timestamp")] - protected string TimestampFormatted + protected string? TimestampFormatted { get => Timestamp?.ToString("o", CultureInfo.InvariantCulture); } } } + diff --git a/SpotifyAPI.Web/Models/Request/FollowCheckCurrentUserRequest.cs b/SpotifyAPI.Web/Models/Request/FollowCheckCurrentUserRequest.cs index d787394d..81023c02 100644 --- a/SpotifyAPI.Web/Models/Request/FollowCheckCurrentUserRequest.cs +++ b/SpotifyAPI.Web/Models/Request/FollowCheckCurrentUserRequest.cs @@ -28,3 +28,4 @@ namespace SpotifyAPI.Web } } } + diff --git a/SpotifyAPI.Web/Models/Request/FollowCheckPlaylistRequest.cs b/SpotifyAPI.Web/Models/Request/FollowCheckPlaylistRequest.cs index f4dc5eb1..2110b2ca 100644 --- a/SpotifyAPI.Web/Models/Request/FollowCheckPlaylistRequest.cs +++ b/SpotifyAPI.Web/Models/Request/FollowCheckPlaylistRequest.cs @@ -15,3 +15,4 @@ namespace SpotifyAPI.Web public IList Ids { get; } } } + diff --git a/SpotifyAPI.Web/Models/Request/FollowGetCurrentUserRequest.cs b/SpotifyAPI.Web/Models/Request/FollowGetCurrentUserRequest.cs index acb4f82b..d70eafbe 100644 --- a/SpotifyAPI.Web/Models/Request/FollowGetCurrentUserRequest.cs +++ b/SpotifyAPI.Web/Models/Request/FollowGetCurrentUserRequest.cs @@ -14,7 +14,7 @@ namespace SpotifyAPI.Web public int? Limit { get; set; } [QueryParam("after")] - public string After { get; set; } + public string? After { get; set; } public enum Type { @@ -23,3 +23,4 @@ namespace SpotifyAPI.Web } } } + diff --git a/SpotifyAPI.Web/Models/Request/FollowPlaylistRequest.cs b/SpotifyAPI.Web/Models/Request/FollowPlaylistRequest.cs index 72a45951..4e6cf2b1 100644 --- a/SpotifyAPI.Web/Models/Request/FollowPlaylistRequest.cs +++ b/SpotifyAPI.Web/Models/Request/FollowPlaylistRequest.cs @@ -6,3 +6,4 @@ namespace SpotifyAPI.Web public bool? Public { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/FollowRequest.cs b/SpotifyAPI.Web/Models/Request/FollowRequest.cs index 07bc41c2..8c2e0285 100644 --- a/SpotifyAPI.Web/Models/Request/FollowRequest.cs +++ b/SpotifyAPI.Web/Models/Request/FollowRequest.cs @@ -28,3 +28,4 @@ namespace SpotifyAPI.Web } } } + diff --git a/SpotifyAPI.Web/Models/Request/LibraryAlbumsRequest.cs b/SpotifyAPI.Web/Models/Request/LibraryAlbumsRequest.cs index 0aaba0bd..3e091d99 100644 --- a/SpotifyAPI.Web/Models/Request/LibraryAlbumsRequest.cs +++ b/SpotifyAPI.Web/Models/Request/LibraryAlbumsRequest.cs @@ -9,6 +9,7 @@ namespace SpotifyAPI.Web public int? Offset { get; set; } [QueryParam("market")] - public string Market { get; set; } + public string? Market { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/LibraryCheckAlbumsRequest.cs b/SpotifyAPI.Web/Models/Request/LibraryCheckAlbumsRequest.cs index a7b25c58..18aef33f 100644 --- a/SpotifyAPI.Web/Models/Request/LibraryCheckAlbumsRequest.cs +++ b/SpotifyAPI.Web/Models/Request/LibraryCheckAlbumsRequest.cs @@ -16,3 +16,4 @@ namespace SpotifyAPI.Web public IList Ids { get; } } } + diff --git a/SpotifyAPI.Web/Models/Request/LibraryCheckShowsRequest.cs b/SpotifyAPI.Web/Models/Request/LibraryCheckShowsRequest.cs index 66ba2aab..dd5e0cb4 100644 --- a/SpotifyAPI.Web/Models/Request/LibraryCheckShowsRequest.cs +++ b/SpotifyAPI.Web/Models/Request/LibraryCheckShowsRequest.cs @@ -15,3 +15,4 @@ namespace SpotifyAPI.Web public IList Ids { get; } } } + diff --git a/SpotifyAPI.Web/Models/Request/LibraryCheckTracksRequest.cs b/SpotifyAPI.Web/Models/Request/LibraryCheckTracksRequest.cs index ee2d291f..d1c21901 100644 --- a/SpotifyAPI.Web/Models/Request/LibraryCheckTracksRequest.cs +++ b/SpotifyAPI.Web/Models/Request/LibraryCheckTracksRequest.cs @@ -15,3 +15,4 @@ namespace SpotifyAPI.Web public IList Ids { get; } } } + diff --git a/SpotifyAPI.Web/Models/Request/LibraryRemoveAlbumsRequest.cs b/SpotifyAPI.Web/Models/Request/LibraryRemoveAlbumsRequest.cs index fc69474a..04cfb2a1 100644 --- a/SpotifyAPI.Web/Models/Request/LibraryRemoveAlbumsRequest.cs +++ b/SpotifyAPI.Web/Models/Request/LibraryRemoveAlbumsRequest.cs @@ -15,3 +15,4 @@ namespace SpotifyAPI.Web public IList Ids { get; } } } + diff --git a/SpotifyAPI.Web/Models/Request/LibraryRemoveShowsRequest.cs b/SpotifyAPI.Web/Models/Request/LibraryRemoveShowsRequest.cs index ac2fd390..be60abb4 100644 --- a/SpotifyAPI.Web/Models/Request/LibraryRemoveShowsRequest.cs +++ b/SpotifyAPI.Web/Models/Request/LibraryRemoveShowsRequest.cs @@ -15,3 +15,4 @@ namespace SpotifyAPI.Web public IList Ids { get; } } } + diff --git a/SpotifyAPI.Web/Models/Request/LibraryRemoveTracksRequest.cs b/SpotifyAPI.Web/Models/Request/LibraryRemoveTracksRequest.cs index 661922d4..c2c044c7 100644 --- a/SpotifyAPI.Web/Models/Request/LibraryRemoveTracksRequest.cs +++ b/SpotifyAPI.Web/Models/Request/LibraryRemoveTracksRequest.cs @@ -15,3 +15,4 @@ namespace SpotifyAPI.Web public IList Ids { get; } } } + diff --git a/SpotifyAPI.Web/Models/Request/LibrarySaveAlbumsRequest.cs b/SpotifyAPI.Web/Models/Request/LibrarySaveAlbumsRequest.cs index ea442c72..be999422 100644 --- a/SpotifyAPI.Web/Models/Request/LibrarySaveAlbumsRequest.cs +++ b/SpotifyAPI.Web/Models/Request/LibrarySaveAlbumsRequest.cs @@ -15,3 +15,4 @@ namespace SpotifyAPI.Web public IList Ids { get; } } } + diff --git a/SpotifyAPI.Web/Models/Request/LibrarySaveShowsRequest.cs b/SpotifyAPI.Web/Models/Request/LibrarySaveShowsRequest.cs index 84adb029..0f19c64d 100644 --- a/SpotifyAPI.Web/Models/Request/LibrarySaveShowsRequest.cs +++ b/SpotifyAPI.Web/Models/Request/LibrarySaveShowsRequest.cs @@ -15,3 +15,4 @@ namespace SpotifyAPI.Web public IList Ids { get; } } } + diff --git a/SpotifyAPI.Web/Models/Request/LibrarySaveTracksRequest.cs b/SpotifyAPI.Web/Models/Request/LibrarySaveTracksRequest.cs index 93d3842b..54589e61 100644 --- a/SpotifyAPI.Web/Models/Request/LibrarySaveTracksRequest.cs +++ b/SpotifyAPI.Web/Models/Request/LibrarySaveTracksRequest.cs @@ -15,3 +15,4 @@ namespace SpotifyAPI.Web public IList Ids { get; } } } + diff --git a/SpotifyAPI.Web/Models/Request/LibraryShowsRequest.cs b/SpotifyAPI.Web/Models/Request/LibraryShowsRequest.cs index 356ada6e..c59c309e 100644 --- a/SpotifyAPI.Web/Models/Request/LibraryShowsRequest.cs +++ b/SpotifyAPI.Web/Models/Request/LibraryShowsRequest.cs @@ -9,6 +9,7 @@ namespace SpotifyAPI.Web public int? Offset { get; set; } [QueryParam("market")] - public string Market { get; set; } + public string? Market { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/LibraryTracksRequest.cs b/SpotifyAPI.Web/Models/Request/LibraryTracksRequest.cs index da2468f4..04016a52 100644 --- a/SpotifyAPI.Web/Models/Request/LibraryTracksRequest.cs +++ b/SpotifyAPI.Web/Models/Request/LibraryTracksRequest.cs @@ -9,6 +9,7 @@ namespace SpotifyAPI.Web public int? Offset { get; set; } [QueryParam("market")] - public string Market { get; set; } + public string? Market { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/LoginRequest.cs b/SpotifyAPI.Web/Models/Request/LoginRequest.cs index df8454c7..4ba13fca 100644 --- a/SpotifyAPI.Web/Models/Request/LoginRequest.cs +++ b/SpotifyAPI.Web/Models/Request/LoginRequest.cs @@ -21,8 +21,8 @@ namespace SpotifyAPI.Web public Uri RedirectUri { get; } public ResponseType ResponseTypeParam { get; } public string ClientId { get; } - public string State { get; set; } - public ICollection Scope { get; set; } + public string? State { get; set; } + public ICollection? Scope { get; set; } public bool? ShowDialog { get; set; } public Uri ToUri() @@ -54,3 +54,4 @@ namespace SpotifyAPI.Web } } } + diff --git a/SpotifyAPI.Web/Models/Request/NewReleasesRequest.cs b/SpotifyAPI.Web/Models/Request/NewReleasesRequest.cs index dc20a39b..84cff1de 100644 --- a/SpotifyAPI.Web/Models/Request/NewReleasesRequest.cs +++ b/SpotifyAPI.Web/Models/Request/NewReleasesRequest.cs @@ -1,14 +1,15 @@ namespace SpotifyAPI.Web { - public class NewReleasesRequest : RequestParams - { - [QueryParam("country")] - public string Country { get; set; } + public class NewReleasesRequest : RequestParams + { + [QueryParam("country")] + public string? Country { get; set; } - [QueryParam("limit")] - public int? Limit { get; set; } + [QueryParam("limit")] + public int? Limit { get; set; } - [QueryParam("offset")] - public int? Offset { get; set; } - } + [QueryParam("offset")] + public int? Offset { get; set; } + } } + diff --git a/SpotifyAPI.Web/Models/Request/PersonalizationTopRequest.cs b/SpotifyAPI.Web/Models/Request/PersonalizationTopRequest.cs index b08987ca..2db90af8 100644 --- a/SpotifyAPI.Web/Models/Request/PersonalizationTopRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PersonalizationTopRequest.cs @@ -24,3 +24,4 @@ namespace SpotifyAPI.Web } } } + diff --git a/SpotifyAPI.Web/Models/Request/PlayerAddToQueueRequest.cs b/SpotifyAPI.Web/Models/Request/PlayerAddToQueueRequest.cs index 01ebcce8..fecc8aac 100644 --- a/SpotifyAPI.Web/Models/Request/PlayerAddToQueueRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlayerAddToQueueRequest.cs @@ -13,6 +13,7 @@ namespace SpotifyAPI.Web public string Uri { get; } [QueryParam("device_id")] - public string DeviceId { get; set; } + public string? DeviceId { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/PlayerCurrentPlaybackRequest.cs b/SpotifyAPI.Web/Models/Request/PlayerCurrentPlaybackRequest.cs index a8a4c2fc..435cab06 100644 --- a/SpotifyAPI.Web/Models/Request/PlayerCurrentPlaybackRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlayerCurrentPlaybackRequest.cs @@ -12,7 +12,7 @@ namespace SpotifyAPI.Web } [QueryParam("market")] - public string Market { get; set; } + public string? Market { get; set; } /// /// This is set to `"track", "episode"` by default. @@ -32,3 +32,4 @@ namespace SpotifyAPI.Web } } } + diff --git a/SpotifyAPI.Web/Models/Request/PlayerCurrentlyPlayingRequest.cs b/SpotifyAPI.Web/Models/Request/PlayerCurrentlyPlayingRequest.cs index 3817be50..a394ac98 100644 --- a/SpotifyAPI.Web/Models/Request/PlayerCurrentlyPlayingRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlayerCurrentlyPlayingRequest.cs @@ -34,3 +34,4 @@ namespace SpotifyAPI.Web } } } + diff --git a/SpotifyAPI.Web/Models/Request/PlayerPausePlaybackRequest.cs b/SpotifyAPI.Web/Models/Request/PlayerPausePlaybackRequest.cs index 2b058a3c..6ebe42e0 100644 --- a/SpotifyAPI.Web/Models/Request/PlayerPausePlaybackRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlayerPausePlaybackRequest.cs @@ -3,6 +3,7 @@ namespace SpotifyAPI.Web public class PlayerPausePlaybackRequest : RequestParams { [QueryParam("device_id")] - public string DeviceId { get; set; } + public string? DeviceId { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/PlayerRecentlyPlayedRequest.cs b/SpotifyAPI.Web/Models/Request/PlayerRecentlyPlayedRequest.cs index 5df75fca..32427da1 100644 --- a/SpotifyAPI.Web/Models/Request/PlayerRecentlyPlayedRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlayerRecentlyPlayedRequest.cs @@ -12,3 +12,4 @@ namespace SpotifyAPI.Web public long? Before { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/PlayerResumePlaybackRequest.cs b/SpotifyAPI.Web/Models/Request/PlayerResumePlaybackRequest.cs index 6041ed00..eda8fa30 100644 --- a/SpotifyAPI.Web/Models/Request/PlayerResumePlaybackRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlayerResumePlaybackRequest.cs @@ -6,17 +6,17 @@ namespace SpotifyAPI.Web public class PlayerResumePlaybackRequest : RequestParams { [QueryParam("device_id")] - public string DeviceId { get; set; } + public string? DeviceId { get; set; } [BodyParam("context_uri")] - public string ContextUri { get; set; } + public string? ContextUri { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227")] [BodyParam("uris")] - public IList Uris { get; set; } + public IList? Uris { get; set; } [BodyParam("offset")] - public Offset OffsetParam { get; set; } + public Offset? OffsetParam { get; set; } [BodyParam("position_ms")] public int? PositionMs { get; set; } @@ -24,10 +24,11 @@ namespace SpotifyAPI.Web public class Offset { [JsonProperty("uri", NullValueHandling = NullValueHandling.Ignore)] - public string Uri { get; set; } + public string? Uri { get; set; } [JsonProperty("position", NullValueHandling = NullValueHandling.Ignore)] public int? Position { get; set; } } } } + diff --git a/SpotifyAPI.Web/Models/Request/PlayerSeekToRequest.cs b/SpotifyAPI.Web/Models/Request/PlayerSeekToRequest.cs index 439de03a..e1fa0837 100644 --- a/SpotifyAPI.Web/Models/Request/PlayerSeekToRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlayerSeekToRequest.cs @@ -11,6 +11,7 @@ namespace SpotifyAPI.Web public long PositonMs { get; } [QueryParam("device_id")] - public string DeviceId { get; set; } + public string? DeviceId { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/PlayerSetRepeatRequest.cs b/SpotifyAPI.Web/Models/Request/PlayerSetRepeatRequest.cs index 9d780f3b..9ec23043 100644 --- a/SpotifyAPI.Web/Models/Request/PlayerSetRepeatRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlayerSetRepeatRequest.cs @@ -10,7 +10,7 @@ namespace SpotifyAPI.Web } [QueryParam("device_id")] - public string DeviceId { get; set; } + public string? DeviceId { get; set; } [QueryParam("state")] public State StateParam { get; } @@ -28,3 +28,4 @@ namespace SpotifyAPI.Web } } } + diff --git a/SpotifyAPI.Web/Models/Request/PlayerShuffleRequest.cs b/SpotifyAPI.Web/Models/Request/PlayerShuffleRequest.cs index 3573cde1..81afe246 100644 --- a/SpotifyAPI.Web/Models/Request/PlayerShuffleRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlayerShuffleRequest.cs @@ -11,6 +11,7 @@ namespace SpotifyAPI.Web public bool State { get; } [QueryParam("device_id")] - public string DeviceId { get; set; } + public string? DeviceId { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/PlayerSkipNextRequest.cs b/SpotifyAPI.Web/Models/Request/PlayerSkipNextRequest.cs index 45d94920..9c7e6288 100644 --- a/SpotifyAPI.Web/Models/Request/PlayerSkipNextRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlayerSkipNextRequest.cs @@ -3,6 +3,7 @@ namespace SpotifyAPI.Web public class PlayerSkipNextRequest : RequestParams { [QueryParam("device_id")] - public string DeviceId { get; set; } + public string? DeviceId { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/PlayerSkipPreviousRequest.cs b/SpotifyAPI.Web/Models/Request/PlayerSkipPreviousRequest.cs index d7c6139f..865a7437 100644 --- a/SpotifyAPI.Web/Models/Request/PlayerSkipPreviousRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlayerSkipPreviousRequest.cs @@ -3,6 +3,7 @@ namespace SpotifyAPI.Web public class PlayerSkipPreviousRequest : RequestParams { [QueryParam("device_id")] - public string DeviceId { get; set; } + public string? DeviceId { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/PlayerTransferPlaybackRequest.cs b/SpotifyAPI.Web/Models/Request/PlayerTransferPlaybackRequest.cs index 8a946f34..d61fee75 100644 --- a/SpotifyAPI.Web/Models/Request/PlayerTransferPlaybackRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlayerTransferPlaybackRequest.cs @@ -18,3 +18,4 @@ namespace SpotifyAPI.Web public bool? Play { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/PlayerVolumeRequest.cs b/SpotifyAPI.Web/Models/Request/PlayerVolumeRequest.cs index b6e8b44c..3f5b18e7 100644 --- a/SpotifyAPI.Web/Models/Request/PlayerVolumeRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlayerVolumeRequest.cs @@ -11,6 +11,7 @@ namespace SpotifyAPI.Web public int VolumePercent { get; } [QueryParam("device_id")] - public string DeviceId { get; set; } + public string? DeviceId { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/PlaylistAddItemsRequest.cs b/SpotifyAPI.Web/Models/Request/PlaylistAddItemsRequest.cs index d6b6c33d..54a53ca5 100644 --- a/SpotifyAPI.Web/Models/Request/PlaylistAddItemsRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlaylistAddItemsRequest.cs @@ -18,3 +18,4 @@ namespace SpotifyAPI.Web public int? Position { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/PlaylistChangeDetailsRequest.cs b/SpotifyAPI.Web/Models/Request/PlaylistChangeDetailsRequest.cs index 82ec1062..ca84a05f 100644 --- a/SpotifyAPI.Web/Models/Request/PlaylistChangeDetailsRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlaylistChangeDetailsRequest.cs @@ -3,7 +3,7 @@ namespace SpotifyAPI.Web public class PlaylistChangeDetailsRequest : RequestParams { [BodyParam("name")] - public string Name { get; set; } + public string? Name { get; set; } [BodyParam("public")] public bool? Public { get; set; } @@ -12,6 +12,7 @@ namespace SpotifyAPI.Web public bool? Collaborative { get; set; } [BodyParam("description")] - public string Description { get; set; } + public string? Description { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/PlaylistCreateRequest.cs b/SpotifyAPI.Web/Models/Request/PlaylistCreateRequest.cs index 55fb1073..1a7c12dc 100644 --- a/SpotifyAPI.Web/Models/Request/PlaylistCreateRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlaylistCreateRequest.cs @@ -19,6 +19,7 @@ namespace SpotifyAPI.Web public bool? Collaborative { get; set; } [BodyParam("description")] - public string Description { get; set; } + public string? Description { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/PlaylistCurrentUsersRequest.cs b/SpotifyAPI.Web/Models/Request/PlaylistCurrentUsersRequest.cs index 7b180370..c2682274 100644 --- a/SpotifyAPI.Web/Models/Request/PlaylistCurrentUsersRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlaylistCurrentUsersRequest.cs @@ -9,3 +9,4 @@ namespace SpotifyAPI.Web public int? Offset { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/PlaylistGetItemsRequest.cs b/SpotifyAPI.Web/Models/Request/PlaylistGetItemsRequest.cs index 0791d570..96f23400 100644 --- a/SpotifyAPI.Web/Models/Request/PlaylistGetItemsRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlaylistGetItemsRequest.cs @@ -23,7 +23,7 @@ namespace SpotifyAPI.Web public int? Offset { get; set; } [QueryParam("market")] - public string Market { get; set; } + public string? Market { get; set; } /// /// This is set to `"track", "episode"` by default. @@ -43,3 +43,4 @@ namespace SpotifyAPI.Web } } } + diff --git a/SpotifyAPI.Web/Models/Request/PlaylistGetRequest.cs b/SpotifyAPI.Web/Models/Request/PlaylistGetRequest.cs index 8b57df6d..42a1a152 100644 --- a/SpotifyAPI.Web/Models/Request/PlaylistGetRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlaylistGetRequest.cs @@ -30,3 +30,4 @@ namespace SpotifyAPI.Web } } } + diff --git a/SpotifyAPI.Web/Models/Request/PlaylistGetUsersRequest.cs b/SpotifyAPI.Web/Models/Request/PlaylistGetUsersRequest.cs index 23fd15d0..7be3c0b9 100644 --- a/SpotifyAPI.Web/Models/Request/PlaylistGetUsersRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlaylistGetUsersRequest.cs @@ -9,3 +9,4 @@ namespace SpotifyAPI.Web public int? Offset { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/PlaylistRemoveItemsRequest.cs b/SpotifyAPI.Web/Models/Request/PlaylistRemoveItemsRequest.cs index bb4d4d75..8008d558 100644 --- a/SpotifyAPI.Web/Models/Request/PlaylistRemoveItemsRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlaylistRemoveItemsRequest.cs @@ -16,17 +16,18 @@ namespace SpotifyAPI.Web public IList Tracks { get; } [BodyParam("snapshot_id")] - public string SnapshotId { get; set; } + public string? SnapshotId { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034")] public class Item { [JsonProperty("uri", NullValueHandling = NullValueHandling.Ignore)] - public string Uri { get; set; } + public string? Uri { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227")] [JsonProperty("positions", NullValueHandling = NullValueHandling.Ignore)] - public List Positions { get; set; } + public List? Positions { get; set; } } } } + diff --git a/SpotifyAPI.Web/Models/Request/PlaylistReorderItemsRequest.cs b/SpotifyAPI.Web/Models/Request/PlaylistReorderItemsRequest.cs index 32d9ccf5..b8179ef5 100644 --- a/SpotifyAPI.Web/Models/Request/PlaylistReorderItemsRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlaylistReorderItemsRequest.cs @@ -18,6 +18,7 @@ namespace SpotifyAPI.Web public int? RangeLength { get; set; } [BodyParam("snapshot_id")] - public string SnapshotId { get; set; } + public string? SnapshotId { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/PlaylistReplaceItemsRequest.cs b/SpotifyAPI.Web/Models/Request/PlaylistReplaceItemsRequest.cs index 11489270..0ed7c15e 100644 --- a/SpotifyAPI.Web/Models/Request/PlaylistReplaceItemsRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlaylistReplaceItemsRequest.cs @@ -15,3 +15,4 @@ namespace SpotifyAPI.Web public IList Uris { get; } } } + diff --git a/SpotifyAPI.Web/Models/Request/RecommendationsRequest.cs b/SpotifyAPI.Web/Models/Request/RecommendationsRequest.cs index b6e6e19e..c8e4564c 100644 --- a/SpotifyAPI.Web/Models/Request/RecommendationsRequest.cs +++ b/SpotifyAPI.Web/Models/Request/RecommendationsRequest.cs @@ -28,7 +28,7 @@ namespace SpotifyAPI.Web public int? Limit { get; set; } [QueryParam("market")] - public string Market { get; set; } + public string? Market { get; set; } public Dictionary Min { get; } public Dictionary Max { get; } @@ -61,3 +61,4 @@ namespace SpotifyAPI.Web } } } + diff --git a/SpotifyAPI.Web/Models/Request/RequestParams.cs b/SpotifyAPI.Web/Models/Request/RequestParams.cs index feb5505b..2762e4e9 100644 --- a/SpotifyAPI.Web/Models/Request/RequestParams.cs +++ b/SpotifyAPI.Web/Models/Request/RequestParams.cs @@ -20,9 +20,8 @@ namespace SpotifyAPI.Web var obj = new JObject(); foreach (var prop in bodyProps) { - var attribute = prop.GetCustomAttribute(typeof(BodyParamAttribute)) as BodyParamAttribute; object value = prop.GetValue(this); - if (value != null) + if (value != null && prop.GetCustomAttribute(typeof(BodyParamAttribute)) is BodyParamAttribute attribute) { obj[attribute.Key ?? prop.Name] = JToken.FromObject(value); } @@ -41,9 +40,8 @@ namespace SpotifyAPI.Web var queryParams = new Dictionary(); foreach (var prop in queryProps) { - var attribute = prop.GetCustomAttribute(typeof(QueryParamAttribute)) as QueryParamAttribute; object value = prop.GetValue(this); - if (value != null) + if (value != null && prop.GetCustomAttribute(typeof(QueryParamAttribute)) is QueryParamAttribute attribute) { if (value is IList list && list.Count > 0) { @@ -91,7 +89,6 @@ namespace SpotifyAPI.Web { public string Key { get; } - public QueryParamAttribute() { } public QueryParamAttribute(string key) { Key = key; @@ -103,10 +100,10 @@ namespace SpotifyAPI.Web { public string Key { get; } - public BodyParamAttribute() { } public BodyParamAttribute(string key) { Key = key; } } } + diff --git a/SpotifyAPI.Web/Models/Request/SearchRequest.cs b/SpotifyAPI.Web/Models/Request/SearchRequest.cs index 5407a942..fbdf75cf 100644 --- a/SpotifyAPI.Web/Models/Request/SearchRequest.cs +++ b/SpotifyAPI.Web/Models/Request/SearchRequest.cs @@ -20,7 +20,7 @@ namespace SpotifyAPI.Web public string Query { get; set; } [QueryParam("market")] - public string Market { get; set; } + public string? Market { get; set; } [QueryParam("limit")] public int? Limit { get; set; } @@ -57,3 +57,4 @@ namespace SpotifyAPI.Web } } } + diff --git a/SpotifyAPI.Web/Models/Request/ShowEpisodesRequest.cs b/SpotifyAPI.Web/Models/Request/ShowEpisodesRequest.cs index 5f1748db..71c08cef 100644 --- a/SpotifyAPI.Web/Models/Request/ShowEpisodesRequest.cs +++ b/SpotifyAPI.Web/Models/Request/ShowEpisodesRequest.cs @@ -9,6 +9,7 @@ namespace SpotifyAPI.Web public int? Offset { get; set; } [QueryParam("market")] - public string Market { get; set; } + public string? Market { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/ShowRequest.cs b/SpotifyAPI.Web/Models/Request/ShowRequest.cs index 6d632dba..be0726fa 100644 --- a/SpotifyAPI.Web/Models/Request/ShowRequest.cs +++ b/SpotifyAPI.Web/Models/Request/ShowRequest.cs @@ -3,6 +3,7 @@ namespace SpotifyAPI.Web public class ShowRequest : RequestParams { [QueryParam("market")] - public string Market { get; set; } + public string? Market { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/ShowsRequest.cs b/SpotifyAPI.Web/Models/Request/ShowsRequest.cs index eb98f7f1..eccf38fc 100644 --- a/SpotifyAPI.Web/Models/Request/ShowsRequest.cs +++ b/SpotifyAPI.Web/Models/Request/ShowsRequest.cs @@ -15,6 +15,7 @@ namespace SpotifyAPI.Web public IList Ids { get; } [QueryParam("market")] - public string Market { get; set; } + public string? Market { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/TrackRequest.cs b/SpotifyAPI.Web/Models/Request/TrackRequest.cs index 423e5046..5a546e68 100644 --- a/SpotifyAPI.Web/Models/Request/TrackRequest.cs +++ b/SpotifyAPI.Web/Models/Request/TrackRequest.cs @@ -3,6 +3,7 @@ namespace SpotifyAPI.Web public class TrackRequest : RequestParams { [QueryParam("market")] - public string Market { get; set; } + public string? Market { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/TracksAudioFeaturesRequest.cs b/SpotifyAPI.Web/Models/Request/TracksAudioFeaturesRequest.cs index 38449896..ae72beb4 100644 --- a/SpotifyAPI.Web/Models/Request/TracksAudioFeaturesRequest.cs +++ b/SpotifyAPI.Web/Models/Request/TracksAudioFeaturesRequest.cs @@ -12,6 +12,7 @@ namespace SpotifyAPI.Web } [QueryParam("ids")] - public IList Ids { get; private set; } + public IList Ids { get; } } } + diff --git a/SpotifyAPI.Web/Models/Request/TracksRequest.cs b/SpotifyAPI.Web/Models/Request/TracksRequest.cs index 965e6938..9e8aff66 100644 --- a/SpotifyAPI.Web/Models/Request/TracksRequest.cs +++ b/SpotifyAPI.Web/Models/Request/TracksRequest.cs @@ -15,6 +15,7 @@ namespace SpotifyAPI.Web public IList Ids { get; } [QueryParam("market")] - public string Market { get; set; } + public string? Market { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Request/UnfollowRequest.cs b/SpotifyAPI.Web/Models/Request/UnfollowRequest.cs index a36a272a..514d74cf 100644 --- a/SpotifyAPI.Web/Models/Request/UnfollowRequest.cs +++ b/SpotifyAPI.Web/Models/Request/UnfollowRequest.cs @@ -27,3 +27,4 @@ namespace SpotifyAPI.Web } } } + diff --git a/SpotifyAPI.Web/Models/Response/Actions.cs b/SpotifyAPI.Web/Models/Response/Actions.cs index 6677ba29..2114a482 100644 --- a/SpotifyAPI.Web/Models/Response/Actions.cs +++ b/SpotifyAPI.Web/Models/Response/Actions.cs @@ -4,6 +4,7 @@ namespace SpotifyAPI.Web { public class Actions { - public Dictionary Disallows { get; set; } + public Dictionary Disallows { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/AlbumsResponse.cs b/SpotifyAPI.Web/Models/Response/AlbumsResponse.cs index 93f51153..887a6ed2 100644 --- a/SpotifyAPI.Web/Models/Response/AlbumsResponse.cs +++ b/SpotifyAPI.Web/Models/Response/AlbumsResponse.cs @@ -4,6 +4,7 @@ namespace SpotifyAPI.Web { public class AlbumsResponse { - public List Albums { get; set; } + public List Albums { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/ArtistsRelatedArtistsResponse.cs b/SpotifyAPI.Web/Models/Response/ArtistsRelatedArtistsResponse.cs index dcbf8a83..ea033668 100644 --- a/SpotifyAPI.Web/Models/Response/ArtistsRelatedArtistsResponse.cs +++ b/SpotifyAPI.Web/Models/Response/ArtistsRelatedArtistsResponse.cs @@ -4,6 +4,7 @@ namespace SpotifyAPI.Web { public class ArtistsRelatedArtistsResponse { - public List Artists { get; set; } + public List Artists { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/ArtistsResponse.cs b/SpotifyAPI.Web/Models/Response/ArtistsResponse.cs index 67d8b488..c47e70f4 100644 --- a/SpotifyAPI.Web/Models/Response/ArtistsResponse.cs +++ b/SpotifyAPI.Web/Models/Response/ArtistsResponse.cs @@ -4,6 +4,7 @@ namespace SpotifyAPI.Web { public class ArtistsResponse { - public List Artists { get; set; } + public List Artists { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/ArtistsTopTracksResponse.cs b/SpotifyAPI.Web/Models/Response/ArtistsTopTracksResponse.cs index 6f6d017e..abf120dc 100644 --- a/SpotifyAPI.Web/Models/Response/ArtistsTopTracksResponse.cs +++ b/SpotifyAPI.Web/Models/Response/ArtistsTopTracksResponse.cs @@ -4,6 +4,7 @@ namespace SpotifyAPI.Web { public class ArtistsTopTracksResponse { - public List Tracks { get; set; } + public List Tracks { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/AuthorizationCodeRefreshResponse.cs b/SpotifyAPI.Web/Models/Response/AuthorizationCodeRefreshResponse.cs index 737d23fc..b50b96af 100644 --- a/SpotifyAPI.Web/Models/Response/AuthorizationCodeRefreshResponse.cs +++ b/SpotifyAPI.Web/Models/Response/AuthorizationCodeRefreshResponse.cs @@ -1,14 +1,13 @@ using System; -using System.Collections.Generic; namespace SpotifyAPI.Web { public class AuthorizationCodeRefreshResponse { - public string AccessToken { get; set; } - public string TokenType { get; set; } + public string AccessToken { get; set; } = default!; + public string TokenType { get; set; } = default!; public int ExpiresIn { get; set; } - public string Scope { get; set; } + public string Scope { get; set; } = default!; /// /// Auto-Initalized to UTC Now @@ -19,3 +18,4 @@ namespace SpotifyAPI.Web public bool IsExpired { get => CreatedAt.AddSeconds(ExpiresIn) <= DateTime.UtcNow; } } } + diff --git a/SpotifyAPI.Web/Models/Response/AuthorizationCodeTokenResponse.cs b/SpotifyAPI.Web/Models/Response/AuthorizationCodeTokenResponse.cs index a380197d..63198867 100644 --- a/SpotifyAPI.Web/Models/Response/AuthorizationCodeTokenResponse.cs +++ b/SpotifyAPI.Web/Models/Response/AuthorizationCodeTokenResponse.cs @@ -5,11 +5,11 @@ namespace SpotifyAPI.Web { public class AuthorizationCodeTokenResponse { - public string AccessToken { get; set; } - public string TokenType { get; set; } + public string AccessToken { get; set; } = default!; + public string TokenType { get; set; } = default!; public int ExpiresIn { get; set; } - public string Scope { get; set; } - public string RefreshToken { get; set; } + public string Scope { get; set; } = default!; + public string RefreshToken { get; set; } = default!; /// /// Auto-Initalized to UTC Now @@ -20,3 +20,4 @@ namespace SpotifyAPI.Web public bool IsExpired { get => CreatedAt.AddSeconds(ExpiresIn) <= DateTime.UtcNow; } } } + diff --git a/SpotifyAPI.Web/Models/Response/CategoriesResponse.cs b/SpotifyAPI.Web/Models/Response/CategoriesResponse.cs index a609a431..92b2d6f4 100644 --- a/SpotifyAPI.Web/Models/Response/CategoriesResponse.cs +++ b/SpotifyAPI.Web/Models/Response/CategoriesResponse.cs @@ -2,6 +2,7 @@ namespace SpotifyAPI.Web { public class CategoriesResponse { - public Paging Categories { get; set; } + public Paging Categories { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/Category.cs b/SpotifyAPI.Web/Models/Response/Category.cs index 826a150d..66e300fe 100644 --- a/SpotifyAPI.Web/Models/Response/Category.cs +++ b/SpotifyAPI.Web/Models/Response/Category.cs @@ -4,9 +4,10 @@ namespace SpotifyAPI.Web { public class Category { - public string Href { get; set; } - public List Icons { get; set; } - public string Id { get; set; } - public string Name { get; set; } + public string Href { get; set; } = default!; + public List Icons { get; set; } = default!; + public string Id { get; set; } = default!; + public string Name { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/CategoryPlaylistsResponse.cs b/SpotifyAPI.Web/Models/Response/CategoryPlaylistsResponse.cs index f798afa2..1f895bc0 100644 --- a/SpotifyAPI.Web/Models/Response/CategoryPlaylistsResponse.cs +++ b/SpotifyAPI.Web/Models/Response/CategoryPlaylistsResponse.cs @@ -2,6 +2,7 @@ namespace SpotifyAPI.Web { public class CategoryPlaylistsResponse { - public Paging Playlists { get; set; } + public Paging Playlists { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/Context.cs b/SpotifyAPI.Web/Models/Response/Context.cs index 0f4df7e4..924f9f8c 100644 --- a/SpotifyAPI.Web/Models/Response/Context.cs +++ b/SpotifyAPI.Web/Models/Response/Context.cs @@ -4,9 +4,10 @@ namespace SpotifyAPI.Web { public class Context { - public Dictionary ExternalUrls { get; set; } - public string Href { get; set; } - public string Type { get; set; } - public string Uri { get; set; } + public Dictionary ExternalUrls { get; set; } = default!; + public string Href { get; set; } = default!; + public string Type { get; set; } = default!; + public string Uri { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/Copyright.cs b/SpotifyAPI.Web/Models/Response/Copyright.cs index d7ee53ef..59dac4c0 100644 --- a/SpotifyAPI.Web/Models/Response/Copyright.cs +++ b/SpotifyAPI.Web/Models/Response/Copyright.cs @@ -2,7 +2,8 @@ namespace SpotifyAPI.Web { public class Copyright { - public string Text { get; set; } - public string Type { get; set; } + public string Text { get; set; } = default!; + public string Type { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/CredentialsTokenResponse.cs b/SpotifyAPI.Web/Models/Response/CredentialsTokenResponse.cs index 308a5685..1f51069b 100644 --- a/SpotifyAPI.Web/Models/Response/CredentialsTokenResponse.cs +++ b/SpotifyAPI.Web/Models/Response/CredentialsTokenResponse.cs @@ -3,8 +3,8 @@ namespace SpotifyAPI.Web { public class CredentialsTokenResponse { - public string AccessToken { get; set; } - public string TokenType { get; set; } + public string AccessToken { get; set; } = default!; + public string TokenType { get; set; } = default!; public int ExpiresIn { get; set; } /// @@ -16,3 +16,4 @@ namespace SpotifyAPI.Web public bool IsExpired { get => CreatedAt.AddSeconds(ExpiresIn) <= DateTime.UtcNow; } } } + diff --git a/SpotifyAPI.Web/Models/Response/CurrentlyPlaying.cs b/SpotifyAPI.Web/Models/Response/CurrentlyPlaying.cs index 30957af4..e4a82932 100644 --- a/SpotifyAPI.Web/Models/Response/CurrentlyPlaying.cs +++ b/SpotifyAPI.Web/Models/Response/CurrentlyPlaying.cs @@ -5,13 +5,14 @@ namespace SpotifyAPI.Web { public class CurrentlyPlaying { - public Context Context { get; set; } - public string CurrentlyPlayingType { get; set; } + public Context Context { get; set; } = default!; + public string CurrentlyPlayingType { get; set; } = default!; public bool IsPlaying { get; set; } [JsonConverter(typeof(PlayableItemConverter))] - public IPlayableItem Item { get; set; } + public IPlayableItem Item { get; set; } = default!; public int? ProgressMs { get; set; } public long Timestamp { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Response/CurrentlyPlayingContext.cs b/SpotifyAPI.Web/Models/Response/CurrentlyPlayingContext.cs index 95f9a6c0..8e3b389e 100644 --- a/SpotifyAPI.Web/Models/Response/CurrentlyPlayingContext.cs +++ b/SpotifyAPI.Web/Models/Response/CurrentlyPlayingContext.cs @@ -4,18 +4,19 @@ namespace SpotifyAPI.Web { public class CurrentlyPlayingContext { - public Device Device { get; set; } - public string RepeatState { get; set; } + public Device Device { get; set; } = default!; + public string RepeatState { get; set; } = default!; public bool ShuffleState { get; set; } - public Context Context { get; set; } + public Context Context { get; set; } = default!; public long Timestamp { get; set; } public int ProgressMs { get; set; } public bool IsPlaying { get; set; } [JsonConverter(typeof(PlayableItemConverter))] - public IPlayableItem Item { get; set; } + public IPlayableItem Item { get; set; } = default!; - public string CurrentlyPlayingType { get; set; } - public Actions Actions { get; set; } + public string CurrentlyPlayingType { get; set; } = default!; + public Actions Actions { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/Cursor.cs b/SpotifyAPI.Web/Models/Response/Cursor.cs index c49a5fca..20333429 100644 --- a/SpotifyAPI.Web/Models/Response/Cursor.cs +++ b/SpotifyAPI.Web/Models/Response/Cursor.cs @@ -2,7 +2,8 @@ namespace SpotifyAPI.Web { public class Cursor { - public string Before { get; set; } - public string After { get; set; } + public string Before { get; set; } = default!; + public string After { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/CursorPaging.cs b/SpotifyAPI.Web/Models/Response/CursorPaging.cs index f996b94a..7b537fcb 100644 --- a/SpotifyAPI.Web/Models/Response/CursorPaging.cs +++ b/SpotifyAPI.Web/Models/Response/CursorPaging.cs @@ -4,11 +4,12 @@ namespace SpotifyAPI.Web { public class CursorPaging { - public string Href { get; set; } - public List Items { get; set; } + public string Href { get; set; } = default!; + public List Items { get; set; } = default!; public int Limit { get; set; } - public string Next { get; set; } - public Cursor Cursors { get; set; } + public string Next { get; set; } = default!; + public Cursor Cursors { get; set; } = default!; public int Total { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Response/Device.cs b/SpotifyAPI.Web/Models/Response/Device.cs index f1dafc0a..670e8566 100644 --- a/SpotifyAPI.Web/Models/Response/Device.cs +++ b/SpotifyAPI.Web/Models/Response/Device.cs @@ -2,12 +2,13 @@ namespace SpotifyAPI.Web { public class Device { - public string Id { get; set; } + public string Id { get; set; } = default!; public bool IsActive { get; set; } public bool IsPrivateSession { get; set; } public bool IsRestricted { get; set; } - public string Name { get; set; } - public string Type { get; set; } + public string Name { get; set; } = default!; + public string Type { get; set; } = default!; public int? VolumePercent { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Response/DeviceResponse.cs b/SpotifyAPI.Web/Models/Response/DeviceResponse.cs index 5755f65e..fa901bcf 100644 --- a/SpotifyAPI.Web/Models/Response/DeviceResponse.cs +++ b/SpotifyAPI.Web/Models/Response/DeviceResponse.cs @@ -4,6 +4,7 @@ namespace SpotifyAPI.Web { public class DeviceResponse { - public List Devices { get; set; } + public List Devices { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/EpisodesResponse.cs b/SpotifyAPI.Web/Models/Response/EpisodesResponse.cs index 2c8e00e5..f231a5cf 100644 --- a/SpotifyAPI.Web/Models/Response/EpisodesResponse.cs +++ b/SpotifyAPI.Web/Models/Response/EpisodesResponse.cs @@ -4,6 +4,7 @@ namespace SpotifyAPI.Web { public class EpisodesResponse { - public List Episodes { get; set; } + public List Episodes { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/FeaturedPlaylistsResponse.cs b/SpotifyAPI.Web/Models/Response/FeaturedPlaylistsResponse.cs index 28cc5472..7a97d741 100644 --- a/SpotifyAPI.Web/Models/Response/FeaturedPlaylistsResponse.cs +++ b/SpotifyAPI.Web/Models/Response/FeaturedPlaylistsResponse.cs @@ -2,7 +2,8 @@ namespace SpotifyAPI.Web { public class FeaturedPlaylistsResponse { - public string Message { get; set; } - public Paging Playlists { get; set; } + public string Message { get; set; } = default!; + public Paging Playlists { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/FollowedArtistsResponse.cs b/SpotifyAPI.Web/Models/Response/FollowedArtistsResponse.cs index 36947a3f..5609b5fb 100644 --- a/SpotifyAPI.Web/Models/Response/FollowedArtistsResponse.cs +++ b/SpotifyAPI.Web/Models/Response/FollowedArtistsResponse.cs @@ -2,6 +2,7 @@ namespace SpotifyAPI.Web { public class FollowedArtistsResponse { - public CursorPaging Artists { get; set; } + public CursorPaging Artists { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/Followers.cs b/SpotifyAPI.Web/Models/Response/Followers.cs index 282dd0bb..21d7365a 100644 --- a/SpotifyAPI.Web/Models/Response/Followers.cs +++ b/SpotifyAPI.Web/Models/Response/Followers.cs @@ -2,8 +2,9 @@ namespace SpotifyAPI.Web { public class Followers { - public string Href { get; set; } + public string Href { get; set; } = default!; public int Total { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Response/FullAlbum.cs b/SpotifyAPI.Web/Models/Response/FullAlbum.cs index cf1975ff..1595a079 100644 --- a/SpotifyAPI.Web/Models/Response/FullAlbum.cs +++ b/SpotifyAPI.Web/Models/Response/FullAlbum.cs @@ -4,24 +4,25 @@ namespace SpotifyAPI.Web { public class FullAlbum { - public string AlbumType { get; set; } - public List Artists { get; set; } - public List AvailableMarkets { get; set; } - public List Copyrights { get; set; } - public Dictionary ExternalIds { get; set; } - public Dictionary ExternalUrls { get; set; } - public List Genres { get; set; } - public string Href { get; set; } - public string Id { get; set; } - public List Images { get; set; } - public string Label { get; set; } - public string Name { get; set; } + public string AlbumType { get; set; } = default!; + public List Artists { get; set; } = default!; + public List AvailableMarkets { get; set; } = default!; + public List Copyrights { get; set; } = default!; + public Dictionary ExternalIds { get; set; } = default!; + public Dictionary ExternalUrls { get; set; } = default!; + public List Genres { get; set; } = default!; + public string Href { get; set; } = default!; + public string Id { get; set; } = default!; + public List Images { get; set; } = default!; + public string Label { get; set; } = default!; + public string Name { get; set; } = default!; public int Popularity { get; set; } - public string ReleaseDate { get; set; } - public string ReleaseDatePrecision { get; set; } - public Dictionary Restrictions { get; set; } - public Paging Tracks { get; set; } - public string Type { get; set; } - public string Uri { get; set; } + public string ReleaseDate { get; set; } = default!; + public string ReleaseDatePrecision { get; set; } = default!; + public Dictionary Restrictions { get; set; } = default!; + public Paging Tracks { get; set; } = default!; + public string Type { get; set; } = default!; + public string Uri { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/FullArtist.cs b/SpotifyAPI.Web/Models/Response/FullArtist.cs index b0908318..dad28447 100644 --- a/SpotifyAPI.Web/Models/Response/FullArtist.cs +++ b/SpotifyAPI.Web/Models/Response/FullArtist.cs @@ -4,15 +4,16 @@ namespace SpotifyAPI.Web { public class FullArtist { - public Dictionary ExternalUrls { get; set; } - public Followers Followers { get; set; } - public List Genres { get; set; } - public string Href { get; set; } - public string Id { get; set; } - public List Images { get; set; } - public string Name { get; set; } + public Dictionary ExternalUrls { get; set; } = default!; + public Followers Followers { get; set; } = default!; + public List Genres { get; set; } = default!; + public string Href { get; set; } = default!; + public string Id { get; set; } = default!; + public List Images { get; set; } = default!; + public string Name { get; set; } = default!; public int Popularity { get; set; } - public string Type { get; set; } - public string Uri { get; set; } + public string Type { get; set; } = default!; + public string Uri { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/FullEpisode.cs b/SpotifyAPI.Web/Models/Response/FullEpisode.cs index 8abff439..733595df 100644 --- a/SpotifyAPI.Web/Models/Response/FullEpisode.cs +++ b/SpotifyAPI.Web/Models/Response/FullEpisode.cs @@ -6,25 +6,26 @@ namespace SpotifyAPI.Web { public class FullEpisode : IPlayableItem { - public string AudioPreviewUrl { get; set; } - public string Description { get; set; } + public string AudioPreviewUrl { get; set; } = default!; + public string Description { get; set; } = default!; public int DurationMs { get; set; } public bool Explicit { get; set; } - public Dictionary ExternalUrls { get; set; } - public string Href { get; set; } - public string Id { get; set; } - public List Images { get; set; } + public Dictionary ExternalUrls { get; set; } = default!; + public string Href { get; set; } = default!; + public string Id { get; set; } = default!; + public List Images { get; set; } = default!; public bool IsExternallyHosted { get; set; } public bool IsPlayable { get; set; } - public List Languages { get; set; } - public string Name { get; set; } - public string ReleaseDate { get; set; } - public string ReleaseDatePrecision { get; set; } - public ResumePoint ResumePoint { get; set; } - public SimpleShow Show { get; set; } + public List Languages { get; set; } = default!; + public string Name { get; set; } = default!; + public string ReleaseDate { get; set; } = default!; + public string ReleaseDatePrecision { get; set; } = default!; + public ResumePoint ResumePoint { get; set; } = default!; + public SimpleShow Show { get; set; } = default!; [JsonConverter(typeof(StringEnumConverter))] public ItemType Type { get; set; } - public string Uri { get; set; } + public string Uri { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/FullPlaylist.cs b/SpotifyAPI.Web/Models/Response/FullPlaylist.cs index e0e39c87..56c21169 100644 --- a/SpotifyAPI.Web/Models/Response/FullPlaylist.cs +++ b/SpotifyAPI.Web/Models/Response/FullPlaylist.cs @@ -4,16 +4,17 @@ namespace SpotifyAPI.Web public class FullPlaylist { public bool Collaborative { get; set; } - public Dictionary ExternalUrls { get; set; } - public string Href { get; set; } - public string Id { get; set; } - public List Images { get; set; } - public string Name { get; set; } - public PublicUser Owner { get; set; } + public Dictionary ExternalUrls { get; set; } = default!; + public string Href { get; set; } = default!; + public string Id { get; set; } = default!; + public List Images { get; set; } = default!; + public string Name { get; set; } = default!; + public PublicUser Owner { get; set; } = default!; public bool Public { get; set; } - public string SnapshotId { get; set; } - public Paging> Tracks { get; set; } - public string Type { get; set; } - public string Uri { get; set; } + public string SnapshotId { get; set; } = default!; + public Paging> Tracks { get; set; } = default!; + public string Type { get; set; } = default!; + public string Uri { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/FullShow.cs b/SpotifyAPI.Web/Models/Response/FullShow.cs index b0311391..44c4ee14 100644 --- a/SpotifyAPI.Web/Models/Response/FullShow.cs +++ b/SpotifyAPI.Web/Models/Response/FullShow.cs @@ -4,21 +4,22 @@ namespace SpotifyAPI.Web { public class FullShow { - public List AvailableMarkets { get; set; } - public List Copyrights { get; set; } - public string Description { get; set; } - public Paging Episodes { get; set; } + public List AvailableMarkets { get; set; } = default!; + public List Copyrights { get; set; } = default!; + public string Description { get; set; } = default!; + public Paging Episodes { get; set; } = default!; public bool Explicit { get; set; } - public Dictionary ExternalUrls { get; set; } - public string Href { get; set; } - public string Id { get; set; } - public List Images { get; set; } + public Dictionary ExternalUrls { get; set; } = default!; + public string Href { get; set; } = default!; + public string Id { get; set; } = default!; + public List Images { get; set; } = default!; public bool IsExternallyHosted { get; set; } - public List Languages { get; set; } - public string MediaType { get; set; } - public string Name { get; set; } - public string Publisher { get; set; } - public string Type { get; set; } - public string Uri { get; set; } + public List Languages { get; set; } = default!; + public string MediaType { get; set; } = default!; + public string Name { get; set; } = default!; + public string Publisher { get; set; } = default!; + public string Type { get; set; } = default!; + public string Uri { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/FullTrack.cs b/SpotifyAPI.Web/Models/Response/FullTrack.cs index 046246cf..71331bc8 100644 --- a/SpotifyAPI.Web/Models/Response/FullTrack.cs +++ b/SpotifyAPI.Web/Models/Response/FullTrack.cs @@ -6,27 +6,28 @@ namespace SpotifyAPI.Web { public class FullTrack : IPlayableItem { - public SimpleAlbum Album { get; set; } - public List Artists { get; set; } - public List AvailableMarkets { get; set; } + public SimpleAlbum Album { get; set; } = default!; + public List Artists { get; set; } = default!; + public List AvailableMarkets { get; set; } = default!; public int DiscNumber { get; set; } public int DurationMs { get; set; } public bool Explicit { get; set; } - public Dictionary ExternalIds { get; set; } - public Dictionary ExternalUrls { get; set; } - public string Href { get; set; } - public string Id { get; set; } + public Dictionary ExternalIds { get; set; } = default!; + public Dictionary ExternalUrls { get; set; } = default!; + public string Href { get; set; } = default!; + public string Id { get; set; } = default!; public bool IsPlayable { get; set; } - public LinkedTrack LinkedFrom { get; set; } - public Dictionary Restrictions { get; set; } - public string Name { get; set; } + public LinkedTrack LinkedFrom { get; set; } = default!; + public Dictionary Restrictions { get; set; } = default!; + public string Name { get; set; } = default!; public int Popularity { get; set; } - public string PreviewUrl { get; set; } + public string PreviewUrl { get; set; } = default!; public int TrackNumber { get; set; } [JsonConverter(typeof(StringEnumConverter))] public ItemType Type { get; set; } - public string Uri { get; set; } + public string Uri { get; set; } = default!; public bool IsLocal { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Response/Image.cs b/SpotifyAPI.Web/Models/Response/Image.cs index f904d16f..83d70e59 100644 --- a/SpotifyAPI.Web/Models/Response/Image.cs +++ b/SpotifyAPI.Web/Models/Response/Image.cs @@ -4,6 +4,7 @@ namespace SpotifyAPI.Web { public int Height { get; set; } public int Width { get; set; } - public string Url { get; set; } + public string Url { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/Interfaces/IPlaylistElement.cs b/SpotifyAPI.Web/Models/Response/Interfaces/IPlaylistElement.cs index d879619f..56a5f5ec 100644 --- a/SpotifyAPI.Web/Models/Response/Interfaces/IPlaylistElement.cs +++ b/SpotifyAPI.Web/Models/Response/Interfaces/IPlaylistElement.cs @@ -15,3 +15,4 @@ namespace SpotifyAPI.Web ItemType Type { get; } } } + diff --git a/SpotifyAPI.Web/Models/Response/LinkedTrack.cs b/SpotifyAPI.Web/Models/Response/LinkedTrack.cs index b16a7624..093f5786 100644 --- a/SpotifyAPI.Web/Models/Response/LinkedTrack.cs +++ b/SpotifyAPI.Web/Models/Response/LinkedTrack.cs @@ -3,10 +3,11 @@ namespace SpotifyAPI.Web { public class LinkedTrack { - public Dictionary ExternalUrls { get; set; } - public string Href { get; set; } - public string Id { get; set; } - public string Type { get; set; } - public string Uri { get; set; } + public Dictionary ExternalUrls { get; set; } = default!; + public string Href { get; set; } = default!; + public string Id { get; set; } = default!; + public string Type { get; set; } = default!; + public string Uri { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/NewReleasesResponse.cs b/SpotifyAPI.Web/Models/Response/NewReleasesResponse.cs index a2ae6f40..4d683c51 100644 --- a/SpotifyAPI.Web/Models/Response/NewReleasesResponse.cs +++ b/SpotifyAPI.Web/Models/Response/NewReleasesResponse.cs @@ -2,7 +2,8 @@ namespace SpotifyAPI.Web { public class NewReleasesResponse { - public string Message { get; set; } - public Paging Albums { get; set; } + public string Message { get; set; } = default!; + public Paging Albums { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/Paging.cs b/SpotifyAPI.Web/Models/Response/Paging.cs index f9d43cdc..3153532a 100644 --- a/SpotifyAPI.Web/Models/Response/Paging.cs +++ b/SpotifyAPI.Web/Models/Response/Paging.cs @@ -4,23 +4,24 @@ namespace SpotifyAPI.Web { public class Paging { - public string Href { get; set; } - public List Items { get; set; } + public string Href { get; set; } = default!; + public List Items { get; set; } = default!; public int Limit { get; set; } - public string Next { get; set; } + public string Next { get; set; } = default!; public int Offset { get; set; } - public string Previous { get; set; } + public string Previous { get; set; } = default!; public int Total { get; set; } } public class Paging { - public string Href { get; set; } - public List Items { get; set; } + public string Href { get; set; } = default!; + public List Items { get; set; } = default!; public int Limit { get; set; } - public string Next { get; set; } + public string Next { get; set; } = default!; public int Offset { get; set; } - public string Previous { get; set; } + public string Previous { get; set; } = default!; public int Total { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Response/PlayHistoryItem.cs b/SpotifyAPI.Web/Models/Response/PlayHistoryItem.cs index 71cef9a7..9aa127ce 100644 --- a/SpotifyAPI.Web/Models/Response/PlayHistoryItem.cs +++ b/SpotifyAPI.Web/Models/Response/PlayHistoryItem.cs @@ -3,8 +3,9 @@ namespace SpotifyAPI.Web { public class PlayHistoryItem { - public SimpleTrack Track { get; set; } + public SimpleTrack Track { get; set; } = default!; public DateTime PlayedAt { get; set; } - public Context Context { get; set; } + public Context Context { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/PlaylistTrack.cs b/SpotifyAPI.Web/Models/Response/PlaylistTrack.cs index 13d2d24c..ecdf5115 100644 --- a/SpotifyAPI.Web/Models/Response/PlaylistTrack.cs +++ b/SpotifyAPI.Web/Models/Response/PlaylistTrack.cs @@ -6,10 +6,11 @@ namespace SpotifyAPI.Web public class PlaylistTrack { public DateTime? AddedAt { get; set; } - public PublicUser AddedBy { get; set; } + public PublicUser AddedBy { get; set; } = default!; public bool IsLocal { get; set; } [JsonConverter(typeof(PlayableItemConverter))] - public T Track { get; set; } + public T Track { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/PrivateUser.cs b/SpotifyAPI.Web/Models/Response/PrivateUser.cs index cc494954..7995df49 100644 --- a/SpotifyAPI.Web/Models/Response/PrivateUser.cs +++ b/SpotifyAPI.Web/Models/Response/PrivateUser.cs @@ -5,16 +5,17 @@ namespace SpotifyAPI.Web { public class PrivateUser { - public string Country { get; set; } - public string DisplayName { get; set; } - public string Email { get; set; } - public Dictionary ExternalUrls { get; set; } - public Followers Followers { get; set; } - public string Href { get; set; } - public string Id { get; set; } - public List Images { get; set; } - public string Product { get; set; } - public string Type { get; set; } - public string Uri { get; set; } + public string Country { get; set; } = default!; + public string DisplayName { get; set; } = default!; + public string Email { get; set; } = default!; + public Dictionary ExternalUrls { get; set; } = default!; + public Followers Followers { get; set; } = default!; + public string Href { get; set; } = default!; + public string Id { get; set; } = default!; + public List Images { get; set; } = default!; + public string Product { get; set; } = default!; + public string Type { get; set; } = default!; + public string Uri { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/PublicUser.cs b/SpotifyAPI.Web/Models/Response/PublicUser.cs index a739c4bc..b7d0cffe 100644 --- a/SpotifyAPI.Web/Models/Response/PublicUser.cs +++ b/SpotifyAPI.Web/Models/Response/PublicUser.cs @@ -5,13 +5,14 @@ namespace SpotifyAPI.Web { public class PublicUser { - public string DisplayName { get; set; } - public Dictionary ExternalUrls { get; set; } - public Followers Followers { get; set; } - public string Href { get; set; } - public string Id { get; set; } - public List Images { get; set; } - public string Type { get; set; } - public string Uri { get; set; } + public string DisplayName { get; set; } = default!; + public Dictionary ExternalUrls { get; set; } = default!; + public Followers Followers { get; set; } = default!; + public string Href { get; set; } = default!; + public string Id { get; set; } = default!; + public List Images { get; set; } = default!; + public string Type { get; set; } = default!; + public string Uri { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/RecommendationGenresResponse.cs b/SpotifyAPI.Web/Models/Response/RecommendationGenresResponse.cs index f68644c4..07027b06 100644 --- a/SpotifyAPI.Web/Models/Response/RecommendationGenresResponse.cs +++ b/SpotifyAPI.Web/Models/Response/RecommendationGenresResponse.cs @@ -4,6 +4,7 @@ namespace SpotifyAPI.Web { public class RecommendationGenresResponse { - public List Genres { get; set; } + public List Genres { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/RecommendationSeed.cs b/SpotifyAPI.Web/Models/Response/RecommendationSeed.cs index c8ab076b..abb6c7e5 100644 --- a/SpotifyAPI.Web/Models/Response/RecommendationSeed.cs +++ b/SpotifyAPI.Web/Models/Response/RecommendationSeed.cs @@ -9,10 +9,11 @@ namespace SpotifyAPI.Web [JsonProperty("afterRelinkingSize")] public int AfterRelinkingSize { get; set; } - public string Href { get; set; } - public string Id { get; set; } + public string Href { get; set; } = default!; + public string Id { get; set; } = default!; [JsonProperty("initialPoolSize")] public int InitialPoolSize { get; set; } - public string Type { get; set; } + public string Type { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/RecommendationsResponse.cs b/SpotifyAPI.Web/Models/Response/RecommendationsResponse.cs index c79d45c8..f97b59e8 100644 --- a/SpotifyAPI.Web/Models/Response/RecommendationsResponse.cs +++ b/SpotifyAPI.Web/Models/Response/RecommendationsResponse.cs @@ -4,7 +4,8 @@ namespace SpotifyAPI.Web { public class RecommendationsResponse { - public List Seeds { get; set; } - public List Tracks { get; set; } + public List Seeds { get; set; } = default!; + public List Tracks { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/ResumePointObject.cs b/SpotifyAPI.Web/Models/Response/ResumePointObject.cs index 52afa146..a5d9173b 100644 --- a/SpotifyAPI.Web/Models/Response/ResumePointObject.cs +++ b/SpotifyAPI.Web/Models/Response/ResumePointObject.cs @@ -6,3 +6,4 @@ namespace SpotifyAPI.Web public int ResumePositionMs { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Response/SavedAlbum.cs b/SpotifyAPI.Web/Models/Response/SavedAlbum.cs index 12bac1a3..0415e27b 100644 --- a/SpotifyAPI.Web/Models/Response/SavedAlbum.cs +++ b/SpotifyAPI.Web/Models/Response/SavedAlbum.cs @@ -5,6 +5,7 @@ namespace SpotifyAPI.Web public class SavedAlbum { public DateTime AddedAt { get; set; } - public FullAlbum Album { get; set; } + public FullAlbum Album { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/SavedShow.cs b/SpotifyAPI.Web/Models/Response/SavedShow.cs index 97c5c4d0..48402d1d 100644 --- a/SpotifyAPI.Web/Models/Response/SavedShow.cs +++ b/SpotifyAPI.Web/Models/Response/SavedShow.cs @@ -5,6 +5,7 @@ namespace SpotifyAPI.Web public class SavedShow { public DateTime AddedAt { get; set; } - public FullShow Show { get; set; } + public FullShow Show { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/SavedTrack.cs b/SpotifyAPI.Web/Models/Response/SavedTrack.cs index e7a7b61e..b6d0b1b8 100644 --- a/SpotifyAPI.Web/Models/Response/SavedTrack.cs +++ b/SpotifyAPI.Web/Models/Response/SavedTrack.cs @@ -5,6 +5,7 @@ namespace SpotifyAPI.Web public class SavedTrack { public DateTime AddedAt { get; set; } - public FullTrack Track { get; set; } + public FullTrack Track { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/SearchResponse.cs b/SpotifyAPI.Web/Models/Response/SearchResponse.cs index 5cc1553b..01ba65b4 100644 --- a/SpotifyAPI.Web/Models/Response/SearchResponse.cs +++ b/SpotifyAPI.Web/Models/Response/SearchResponse.cs @@ -2,10 +2,11 @@ namespace SpotifyAPI.Web { public class SearchResponse { - public Paging Artists { get; set; } - public Paging Albums { get; set; } - public Paging Tracks { get; set; } - public Paging Shows { get; set; } - public Paging Episodes { get; set; } + public Paging Artists { get; set; } = default!; + public Paging Albums { get; set; } = default!; + public Paging Tracks { get; set; } = default!; + public Paging Shows { get; set; } = default!; + public Paging Episodes { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/Section.cs b/SpotifyAPI.Web/Models/Response/Section.cs index 49816a85..a2aaa32e 100644 --- a/SpotifyAPI.Web/Models/Response/Section.cs +++ b/SpotifyAPI.Web/Models/Response/Section.cs @@ -16,3 +16,4 @@ namespace SpotifyAPI.Web public float TimeSignatureConfidence { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Response/Segment.cs b/SpotifyAPI.Web/Models/Response/Segment.cs index 3827e169..cb90683e 100644 --- a/SpotifyAPI.Web/Models/Response/Segment.cs +++ b/SpotifyAPI.Web/Models/Response/Segment.cs @@ -11,7 +11,8 @@ namespace SpotifyAPI.Web public float LoudnessMax { get; set; } public float LoudnessMaxTime { get; set; } public float LoudnessEnd { get; set; } - public List Pitches { get; set; } - public List Timbre { get; set; } + public List Pitches { get; set; } = default!; + public List Timbre { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/ShowsResponse.cs b/SpotifyAPI.Web/Models/Response/ShowsResponse.cs index 5ed668aa..08e001ca 100644 --- a/SpotifyAPI.Web/Models/Response/ShowsResponse.cs +++ b/SpotifyAPI.Web/Models/Response/ShowsResponse.cs @@ -4,6 +4,7 @@ namespace SpotifyAPI.Web { public class ShowsResponse { - public List Shows { get; set; } + public List Shows { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/SimpleAlbum.cs b/SpotifyAPI.Web/Models/Response/SimpleAlbum.cs index 78eb47ee..b9140b69 100644 --- a/SpotifyAPI.Web/Models/Response/SimpleAlbum.cs +++ b/SpotifyAPI.Web/Models/Response/SimpleAlbum.cs @@ -4,19 +4,20 @@ namespace SpotifyAPI.Web { public class SimpleAlbum { - public string AlbumGroup { get; set; } - public string AlbumType { get; set; } - public List Artists { get; set; } - public List AvailableMarkets { get; set; } - public Dictionary ExternalUrls { get; set; } - public string Href { get; set; } - public string Id { get; set; } - public List Images { get; set; } - public string Name { get; set; } - public string ReleaseDate { get; set; } - public string ReleaseDatePrecision { get; set; } - public Dictionary Restrictions { get; set; } - public string Type { get; set; } - public string Uri { get; set; } + public string AlbumGroup { get; set; } = default!; + public string AlbumType { get; set; } = default!; + public List Artists { get; set; } = default!; + public List AvailableMarkets { get; set; } = default!; + public Dictionary ExternalUrls { get; set; } = default!; + public string Href { get; set; } = default!; + public string Id { get; set; } = default!; + public List Images { get; set; } = default!; + public string Name { get; set; } = default!; + public string ReleaseDate { get; set; } = default!; + public string ReleaseDatePrecision { get; set; } = default!; + public Dictionary Restrictions { get; set; } = default!; + public string Type { get; set; } = default!; + public string Uri { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/SimpleArtist.cs b/SpotifyAPI.Web/Models/Response/SimpleArtist.cs index b272e812..da8ae4b6 100644 --- a/SpotifyAPI.Web/Models/Response/SimpleArtist.cs +++ b/SpotifyAPI.Web/Models/Response/SimpleArtist.cs @@ -3,11 +3,12 @@ namespace SpotifyAPI.Web { public class SimpleArtist { - public Dictionary ExternalUrls { get; set; } - public string Href { get; set; } - public string Id { get; set; } - public string Name { get; set; } - public string Type { get; set; } - public string Uri { get; set; } + public Dictionary ExternalUrls { get; set; } = default!; + public string Href { get; set; } = default!; + public string Id { get; set; } = default!; + public string Name { get; set; } = default!; + public string Type { get; set; } = default!; + public string Uri { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/SimpleEpisode.cs b/SpotifyAPI.Web/Models/Response/SimpleEpisode.cs index 547ca019..eb48e0fd 100644 --- a/SpotifyAPI.Web/Models/Response/SimpleEpisode.cs +++ b/SpotifyAPI.Web/Models/Response/SimpleEpisode.cs @@ -7,27 +7,28 @@ namespace SpotifyAPI.Web { public class SimpleEpisode { - public string AudioPreviewUrl { get; set; } - public string Description { get; set; } + public string AudioPreviewUrl { get; set; } = default!; + public string Description { get; set; } = default!; public int DurationMs { get; set; } public bool Explicit { get; set; } - public Dictionary ExternalUrls { get; set; } - public string Href { get; set; } - public string Id { get; set; } - public List Images { get; set; } + public Dictionary ExternalUrls { get; set; } = default!; + public string Href { get; set; } = default!; + public string Id { get; set; } = default!; + public List Images { get; set; } = default!; public bool IsExternallyHosted { get; set; } public bool IsPlayable { get; set; } [Obsolete("This field is deprecated and might be removed in the future. Please use the languages field instead")] - public string Language { get; set; } - public List Languages { get; set; } - public string Name { get; set; } - public string ReleaseDate { get; set; } - public string ReleaseDatePrecision { get; set; } - public ResumePoint ResumePoint { get; set; } + public string Language { get; set; } = default!; + public List Languages { get; set; } = default!; + public string Name { get; set; } = default!; + public string ReleaseDate { get; set; } = default!; + public string ReleaseDatePrecision { get; set; } = default!; + public ResumePoint ResumePoint { get; set; } = default!; [JsonConverter(typeof(StringEnumConverter))] public ItemType Type { get; set; } - public string Uri { get; set; } + public string Uri { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/SimplePlaylist.cs b/SpotifyAPI.Web/Models/Response/SimplePlaylist.cs index 35217056..125fb6d3 100644 --- a/SpotifyAPI.Web/Models/Response/SimplePlaylist.cs +++ b/SpotifyAPI.Web/Models/Response/SimplePlaylist.cs @@ -7,17 +7,18 @@ namespace SpotifyAPI.Web public class SimplePlaylist { public bool Collaborative { get; set; } - public string Description { get; set; } - public Dictionary ExternalUrls { get; set; } - public string Href { get; set; } - public string Id { get; set; } - public List Images { get; set; } - public string Name { get; set; } - public PublicUser Owner { get; set; } + public string Description { get; set; } = default!; + public Dictionary ExternalUrls { get; set; } = default!; + public string Href { get; set; } = default!; + public string Id { get; set; } = default!; + public List Images { get; set; } = default!; + public string Name { get; set; } = default!; + public PublicUser Owner { get; set; } = default!; public bool? Public { get; set; } - public string SnapshotId { get; set; } - public Paging> Tracks { get; set; } - public string Type { get; set; } - public string Uri { get; set; } + public string SnapshotId { get; set; } = default!; + public Paging> Tracks { get; set; } = default!; + public string Type { get; set; } = default!; + public string Uri { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/SimpleShow.cs b/SpotifyAPI.Web/Models/Response/SimpleShow.cs index 1654ea2e..d5e56f51 100644 --- a/SpotifyAPI.Web/Models/Response/SimpleShow.cs +++ b/SpotifyAPI.Web/Models/Response/SimpleShow.cs @@ -4,20 +4,21 @@ namespace SpotifyAPI.Web { public class SimpleShow { - public List AvailableMarkets { get; set; } - public List Copyrights { get; set; } - public string Description { get; set; } + public List AvailableMarkets { get; set; } = default!; + public List Copyrights { get; set; } = default!; + public string Description { get; set; } = default!; public bool Explicit { get; set; } - public Dictionary ExternalUrls { get; set; } - public string Href { get; set; } - public string Id { get; set; } - public List Images { get; set; } + public Dictionary ExternalUrls { get; set; } = default!; + public string Href { get; set; } = default!; + public string Id { get; set; } = default!; + public List Images { get; set; } = default!; public bool IsExternallyHosted { get; set; } - public List Languages { get; set; } - public string MediaType { get; set; } - public string Name { get; set; } - public string Publisher { get; set; } - public string Type { get; set; } - public string Uri { get; set; } + public List Languages { get; set; } = default!; + public string MediaType { get; set; } = default!; + public string Name { get; set; } = default!; + public string Publisher { get; set; } = default!; + public string Type { get; set; } = default!; + public string Uri { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/SimpleTrack.cs b/SpotifyAPI.Web/Models/Response/SimpleTrack.cs index 71462dd0..c395f141 100644 --- a/SpotifyAPI.Web/Models/Response/SimpleTrack.cs +++ b/SpotifyAPI.Web/Models/Response/SimpleTrack.cs @@ -6,22 +6,23 @@ namespace SpotifyAPI.Web { public class SimpleTrack { - public List Artists { get; set; } - public List AvailableMarkets { get; set; } + public List Artists { get; set; } = default!; + public List AvailableMarkets { get; set; } = default!; public int DiscNumber { get; set; } public int DurationMs { get; set; } public bool Explicit { get; set; } - public Dictionary ExternalUrls { get; set; } - public string Href { get; set; } - public string Id { get; set; } + public Dictionary ExternalUrls { get; set; } = default!; + public string Href { get; set; } = default!; + public string Id { get; set; } = default!; public bool IsPlayable { get; set; } - public LinkedTrack LinkedFrom { get; set; } - public string Name { get; set; } - public string PreviewUrl { get; set; } + public LinkedTrack LinkedFrom { get; set; } = default!; + public string Name { get; set; } = default!; + public string PreviewUrl { get; set; } = default!; public int TrackNumber { get; set; } [JsonConverter(typeof(StringEnumConverter))] public ItemType Type { get; set; } - public string Uri { get; set; } + public string Uri { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/SnapshotResponse.cs b/SpotifyAPI.Web/Models/Response/SnapshotResponse.cs index 97ebe950..ccf6a07b 100644 --- a/SpotifyAPI.Web/Models/Response/SnapshotResponse.cs +++ b/SpotifyAPI.Web/Models/Response/SnapshotResponse.cs @@ -2,6 +2,7 @@ namespace SpotifyAPI.Web { public class SnapshotResponse { - public string SnapshotId { get; set; } + public string SnapshotId { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/TimeInterval.cs b/SpotifyAPI.Web/Models/Response/TimeInterval.cs index 0d462438..036c50df 100644 --- a/SpotifyAPI.Web/Models/Response/TimeInterval.cs +++ b/SpotifyAPI.Web/Models/Response/TimeInterval.cs @@ -7,3 +7,4 @@ namespace SpotifyAPI.Web public float Confidence { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Response/TrackAudioAnalysis.cs b/SpotifyAPI.Web/Models/Response/TrackAudioAnalysis.cs index 32e3be1a..e62fef4d 100644 --- a/SpotifyAPI.Web/Models/Response/TrackAudioAnalysis.cs +++ b/SpotifyAPI.Web/Models/Response/TrackAudioAnalysis.cs @@ -4,10 +4,11 @@ namespace SpotifyAPI.Web { public class TrackAudioAnalysis { - public List Bars { get; set; } - public List Beats { get; set; } - public List
Sections { get; set; } - public List Segments { get; set; } - public List Tatums { get; set; } + public List Bars { get; set; } = default!; + public List Beats { get; set; } = default!; + public List
Sections { get; set; } = default!; + public List Segments { get; set; } = default!; + public List Tatums { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/TrackAudioFeatures.cs b/SpotifyAPI.Web/Models/Response/TrackAudioFeatures.cs index c7027df9..99d0d650 100644 --- a/SpotifyAPI.Web/Models/Response/TrackAudioFeatures.cs +++ b/SpotifyAPI.Web/Models/Response/TrackAudioFeatures.cs @@ -3,11 +3,11 @@ namespace SpotifyAPI.Web public class TrackAudioFeatures { public float Acousticness { get; set; } - public string AnalysisUrl { get; set; } + public string AnalysisUrl { get; set; } = default!; public float Danceability { get; set; } public int DurationMs { get; set; } public float Energy { get; set; } - public string Id { get; set; } + public string Id { get; set; } = default!; public float Instrumentalness { get; set; } public int Key { get; set; } public float Liveness { get; set; } @@ -16,9 +16,10 @@ namespace SpotifyAPI.Web public float Speechiness { get; set; } public float Tempo { get; set; } public int TimeSignature { get; set; } - public string TrackHref { get; set; } - public string Type { get; set; } - public string Uri { get; set; } + public string TrackHref { get; set; } = default!; + public string Type { get; set; } = default!; + public string Uri { get; set; } = default!; public float Valence { get; set; } } } + diff --git a/SpotifyAPI.Web/Models/Response/TracksAudioFeaturesResponse.cs b/SpotifyAPI.Web/Models/Response/TracksAudioFeaturesResponse.cs index 04611821..0640dcb2 100644 --- a/SpotifyAPI.Web/Models/Response/TracksAudioFeaturesResponse.cs +++ b/SpotifyAPI.Web/Models/Response/TracksAudioFeaturesResponse.cs @@ -4,6 +4,7 @@ namespace SpotifyAPI.Web { public class TracksAudioFeaturesResponse { - public List AudioFeatures { get; set; } + public List AudioFeatures { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Response/TracksResponse.cs b/SpotifyAPI.Web/Models/Response/TracksResponse.cs index 4c075a44..6bb2d629 100644 --- a/SpotifyAPI.Web/Models/Response/TracksResponse.cs +++ b/SpotifyAPI.Web/Models/Response/TracksResponse.cs @@ -4,6 +4,7 @@ namespace SpotifyAPI.Web { public class TracksResponse { - public List Tracks { get; set; } + public List Tracks { get; set; } = default!; } } + diff --git a/SpotifyAPI.Web/Models/Scopes.cs b/SpotifyAPI.Web/Models/Scopes.cs index 6124c953..5b311b85 100644 --- a/SpotifyAPI.Web/Models/Scopes.cs +++ b/SpotifyAPI.Web/Models/Scopes.cs @@ -23,3 +23,4 @@ namespace SpotifyAPI.Web public const string UserFollowModify = "user-follow-modify"; } } + diff --git a/SpotifyAPI.Web/SpotifyAPI.Web.csproj b/SpotifyAPI.Web/SpotifyAPI.Web.csproj index 8e45743b..fc05d906 100644 --- a/SpotifyAPI.Web/SpotifyAPI.Web.csproj +++ b/SpotifyAPI.Web/SpotifyAPI.Web.csproj @@ -2,6 +2,8 @@ netstandard2.1;netstandard2.0 + 8.0 + enable SpotifyAPI.Web SpotifyAPI.Web diff --git a/SpotifyAPI.Web/Util/URIParameterFormatProvider.cs b/SpotifyAPI.Web/Util/URIParameterFormatProvider.cs index a7b861d6..6fbcd81a 100644 --- a/SpotifyAPI.Web/Util/URIParameterFormatProvider.cs +++ b/SpotifyAPI.Web/Util/URIParameterFormatProvider.cs @@ -11,7 +11,7 @@ namespace SpotifyAPI.Web _formatter = new URIParameterFormatter(); } - public object GetFormat(Type formatType) + public object? GetFormat(Type formatType) { return formatType == typeof(ICustomFormatter) ? _formatter : null; }