Added analyzers

This commit is contained in:
Jonas Dellinger 2020-05-05 05:45:33 +02:00
parent 40397fa4f6
commit 28531ab007
3 changed files with 12 additions and 3 deletions

View File

@ -14,6 +14,9 @@ namespace SpotifyAPI.Web
public async Task<List<T>> Paginate<T>(Paging<T> firstPage, IAPIConnector connector)
{
Ensure.ArgumentNotNull(firstPage, nameof(firstPage));
Ensure.ArgumentNotNull(connector, nameof(connector));
var page = firstPage;
var results = new List<T>();
results.AddRange(firstPage.Items);
@ -28,6 +31,8 @@ namespace SpotifyAPI.Web
public async Task<List<T>> Paginate<T>(Func<Task<Paging<T>>> getFirstPage, IAPIConnector connector)
{
Ensure.ArgumentNotNull(getFirstPage, nameof(getFirstPage));
var firstPage = await getFirstPage().ConfigureAwait(false);
return await Paginate(firstPage, connector).ConfigureAwait(false);
}

View File

@ -5,18 +5,18 @@ namespace SpotifyAPI.Web
public class FollowRequest : RequestParams
{
[QueryParam("type")]
public Types? Type { get; set; }
public Type? TypeParam { get; set; }
[BodyParam("ids")]
public List<string> Ids { get; set; }
protected override void CustomEnsure()
{
Ensure.ArgumentNotNull(Type, nameof(Type));
Ensure.ArgumentNotNull(TypeParam, nameof(TypeParam));
Ensure.ArgumentNotNullOrEmptyList(Ids, nameof(Ids));
}
public enum Types
public enum Type
{
[String("artist")]
Artist,

View File

@ -32,5 +32,9 @@
<PackageReference Include="Newtonsoft.Json" Version="12.0.3">
<PrivateAssets>None</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>