mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-24 23:16:28 +00:00
Added analyzers
This commit is contained in:
parent
40397fa4f6
commit
28531ab007
@ -14,6 +14,9 @@ namespace SpotifyAPI.Web
|
|||||||
|
|
||||||
public async Task<List<T>> Paginate<T>(Paging<T> firstPage, IAPIConnector connector)
|
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 page = firstPage;
|
||||||
var results = new List<T>();
|
var results = new List<T>();
|
||||||
results.AddRange(firstPage.Items);
|
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)
|
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);
|
var firstPage = await getFirstPage().ConfigureAwait(false);
|
||||||
return await Paginate(firstPage, connector).ConfigureAwait(false);
|
return await Paginate(firstPage, connector).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
@ -5,18 +5,18 @@ namespace SpotifyAPI.Web
|
|||||||
public class FollowRequest : RequestParams
|
public class FollowRequest : RequestParams
|
||||||
{
|
{
|
||||||
[QueryParam("type")]
|
[QueryParam("type")]
|
||||||
public Types? Type { get; set; }
|
public Type? TypeParam { get; set; }
|
||||||
|
|
||||||
[BodyParam("ids")]
|
[BodyParam("ids")]
|
||||||
public List<string> Ids { get; set; }
|
public List<string> Ids { get; set; }
|
||||||
|
|
||||||
protected override void CustomEnsure()
|
protected override void CustomEnsure()
|
||||||
{
|
{
|
||||||
Ensure.ArgumentNotNull(Type, nameof(Type));
|
Ensure.ArgumentNotNull(TypeParam, nameof(TypeParam));
|
||||||
Ensure.ArgumentNotNullOrEmptyList(Ids, nameof(Ids));
|
Ensure.ArgumentNotNullOrEmptyList(Ids, nameof(Ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Types
|
public enum Type
|
||||||
{
|
{
|
||||||
[String("artist")]
|
[String("artist")]
|
||||||
Artist,
|
Artist,
|
||||||
|
@ -32,5 +32,9 @@
|
|||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3">
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3">
|
||||||
<PrivateAssets>None</PrivateAssets>
|
<PrivateAssets>None</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.0.0">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
Reference in New Issue
Block a user