mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2025-01-11 14:07:47 +00:00
Added AudioFeatures / Moved Several* to their own files
This commit is contained in:
parent
8d274164c4
commit
c8637e32a9
@ -76,6 +76,7 @@
|
||||
<Compile Include="Web\Enums\FollowType.cs" />
|
||||
<Compile Include="Web\Auth\ImplicitGrantAuth.cs" />
|
||||
<Compile Include="Web\Models\ArrayResponse.cs" />
|
||||
<Compile Include="Web\Models\AudioFeatures.cs" />
|
||||
<Compile Include="Web\Models\BasicModel.cs" />
|
||||
<Compile Include="Web\Models\Category.cs" />
|
||||
<Compile Include="Web\Models\CategoryList.cs" />
|
||||
@ -92,6 +93,10 @@
|
||||
<Compile Include="Web\Models\GeneralModels.cs" />
|
||||
<Compile Include="Web\Models\FullPlaylist.cs" />
|
||||
<Compile Include="Web\Models\PublicProfile.cs" />
|
||||
<Compile Include="Web\Models\SeveralAlbums.cs" />
|
||||
<Compile Include="Web\Models\SeveralArtists.cs" />
|
||||
<Compile Include="Web\Models\SeveralAudioFeatures.cs" />
|
||||
<Compile Include="Web\Models\SeveralTracks.cs" />
|
||||
<Compile Include="Web\Models\SimpleAlbum.cs" />
|
||||
<Compile Include="Web\Models\SimpleArtist.cs" />
|
||||
<Compile Include="Web\Models\SimpleTrack.cs" />
|
||||
|
61
SpotifyAPI/Web/Models/AudioFeatures.cs
Normal file
61
SpotifyAPI/Web/Models/AudioFeatures.cs
Normal file
@ -0,0 +1,61 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SpotifyAPI.Web.Models
|
||||
{
|
||||
public class AudioFeatures : BasicModel
|
||||
{
|
||||
[JsonProperty("acousticness")]
|
||||
public float Acousticness { get; set; }
|
||||
|
||||
[JsonProperty("analysis_url")]
|
||||
public string AnalysisUrl { get; set; }
|
||||
|
||||
[JsonProperty("danceability")]
|
||||
public float Danceability { get; set; }
|
||||
|
||||
[JsonProperty("duration_ms")]
|
||||
public int DurationMs { get; set; }
|
||||
|
||||
[JsonProperty("energy")]
|
||||
public float Energy { get; set; }
|
||||
|
||||
[JsonProperty("id")]
|
||||
public string Id { get; set; }
|
||||
|
||||
[JsonProperty("instrumentalness")]
|
||||
public float Instrumentalness { get; set; }
|
||||
|
||||
[JsonProperty("key")]
|
||||
public int Key { get; set; }
|
||||
|
||||
[JsonProperty("liveness")]
|
||||
public float Liveness { get; set; }
|
||||
|
||||
[JsonProperty("loudness")]
|
||||
public float Loudness { get; set; }
|
||||
|
||||
[JsonProperty("mode")]
|
||||
public int Mode { get; set; }
|
||||
|
||||
[JsonProperty("speechiness")]
|
||||
public float Speechiness { get; set; }
|
||||
|
||||
[JsonProperty("tempo")]
|
||||
public float Tempo { get; set; }
|
||||
|
||||
[JsonProperty("time_signature")]
|
||||
public int TimeSignature { get; set; }
|
||||
|
||||
[JsonProperty("track_href")]
|
||||
public string TrackHref { get; set; }
|
||||
|
||||
[JsonProperty("type")]
|
||||
public string Type { get; set; }
|
||||
|
||||
[JsonProperty("uri")]
|
||||
public string Uri { get; set; }
|
||||
|
||||
[JsonProperty("valence")]
|
||||
public float Valence { get; set; }
|
||||
}
|
||||
}
|
@ -88,24 +88,6 @@ namespace SpotifyAPI.Web.Models
|
||||
}
|
||||
}
|
||||
|
||||
public class SeveralTracks : BasicModel
|
||||
{
|
||||
[JsonProperty("tracks")]
|
||||
public List<FullTrack> Tracks { get; set; }
|
||||
}
|
||||
|
||||
public class SeveralArtists : BasicModel
|
||||
{
|
||||
[JsonProperty("artists")]
|
||||
public List<FullArtist> Artists { get; set; }
|
||||
}
|
||||
|
||||
public class SeveralAlbums : BasicModel
|
||||
{
|
||||
[JsonProperty("albums")]
|
||||
public List<FullAlbum> Albums { get; set; }
|
||||
}
|
||||
|
||||
public class Copyright
|
||||
{
|
||||
[JsonProperty("text")]
|
||||
|
11
SpotifyAPI/Web/Models/SeveralAlbums.cs
Normal file
11
SpotifyAPI/Web/Models/SeveralAlbums.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SpotifyAPI.Web.Models
|
||||
{
|
||||
public class SeveralAlbums : BasicModel
|
||||
{
|
||||
[JsonProperty("albums")]
|
||||
public List<FullAlbum> Albums { get; set; }
|
||||
}
|
||||
}
|
11
SpotifyAPI/Web/Models/SeveralArtists.cs
Normal file
11
SpotifyAPI/Web/Models/SeveralArtists.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SpotifyAPI.Web.Models
|
||||
{
|
||||
public class SeveralArtists : BasicModel
|
||||
{
|
||||
[JsonProperty("artists")]
|
||||
public List<FullArtist> Artists { get; set; }
|
||||
}
|
||||
}
|
11
SpotifyAPI/Web/Models/SeveralAudioFeatures.cs
Normal file
11
SpotifyAPI/Web/Models/SeveralAudioFeatures.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SpotifyAPI.Web.Models
|
||||
{
|
||||
public class SeveralAudioFeatures : BasicModel
|
||||
{
|
||||
[JsonProperty("audio_features")]
|
||||
public List<AudioFeatures> AudioFeatures { get; set; }
|
||||
}
|
||||
}
|
11
SpotifyAPI/Web/Models/SeveralTracks.cs
Normal file
11
SpotifyAPI/Web/Models/SeveralTracks.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SpotifyAPI.Web.Models
|
||||
{
|
||||
public class SeveralTracks : BasicModel
|
||||
{
|
||||
[JsonProperty("tracks")]
|
||||
public List<FullTrack> Tracks { get; set; }
|
||||
}
|
||||
}
|
@ -1578,6 +1578,50 @@ namespace SpotifyAPI.Web
|
||||
return await DownloadDataAsync<FullTrack>(_builder.GetTrack(id, market));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get audio feature information for a single track identified by its unique Spotify ID.
|
||||
/// </summary>
|
||||
/// <param name="id">The Spotify ID for the track.</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
public AudioFeatures GetAudioFeatures(string id)
|
||||
{
|
||||
return DownloadData<AudioFeatures>(_builder.GetAudioFeatures(id));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get audio feature information for a single track identified by its unique Spotify ID asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="id">The Spotify ID for the track.</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
public async Task<AudioFeatures> GetAudioFeaturesAsync(string id)
|
||||
{
|
||||
return await DownloadDataAsync<AudioFeatures>(_builder.GetAudioFeatures(id));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get audio features for multiple tracks based on their Spotify IDs.
|
||||
/// </summary>
|
||||
/// <param name="ids">A list of Spotify Track-IDs. Maximum: 100 IDs.</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
public SeveralAudioFeatures GetSeveralAudioFeatures(List<string> ids)
|
||||
{
|
||||
return DownloadData<SeveralAudioFeatures>(_builder.GetSeveralAudioFeatures(ids));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get audio features for multiple tracks based on their Spotify IDs asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="ids">A list of Spotify Track-IDs. Maximum: 100 IDs.</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
public async Task<SeveralAudioFeatures> GetSeveralAudioFeaturesAsync(List<string> ids)
|
||||
{
|
||||
return await DownloadDataAsync<SeveralAudioFeatures>(_builder.GetSeveralAudioFeatures(ids));
|
||||
}
|
||||
|
||||
#endregion Tracks
|
||||
|
||||
#region Util
|
||||
|
@ -698,6 +698,28 @@ namespace SpotifyAPI.Web
|
||||
return $"{APIBase}/tracks/{id}?market={market}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get audio feature information for a single track identified by its unique Spotify ID.
|
||||
/// </summary>
|
||||
/// <param name="id">The Spotify ID for the track.</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
public string GetAudioFeatures(string id)
|
||||
{
|
||||
return $"{APIBase}/audio-features/{id}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get audio features for multiple tracks based on their Spotify IDs.
|
||||
/// </summary>
|
||||
/// <param name="ids">A list of Spotify Track-IDs. Maximum: 100 IDs.</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
public string GetSeveralAudioFeatures(List<string> ids)
|
||||
{
|
||||
return $"{APIBase}/audio-features?ids={string.Join(",", ids.Take(100))}";
|
||||
}
|
||||
|
||||
#endregion Tracks
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user