using Sony.Filtr.Utility.Extensions; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Sony.Filtr.SpotifyWebAPI.Model { public class SearchTypes { public const string Albums = "album"; public const string Artists = "artist"; public const string Playlists = "playlist"; public const string Tracks = "track"; } public class ExternalUrls { public string spotify { get; set; } } public class Image { public int? height { get; set; } public string url { get; set; } public int? width { get; set; } } public class Album { public string album_type { get; set; } public List available_markets { get; set; } public ExternalUrls external_urls { get; set; } public string href { get; set; } public string id { get; set; } public List images { get; set; } public string name { get; set; } public string type { get; set; } public string uri { get; set; } public List artists { get; set; } } public class Artist { public ExternalUrls external_urls { get; set; } public Followers followers { 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 List images { get; set; } public int? popularity { get; set; } } public class ArtistResponse { public List artists { get; set; } } public class ExternalIds { public string isrc { get; set; } public string upc { get; set; } } public class Track { public Album album { get; set; } public List artists { get; set; } public List available_markets { get; set; } public int disc_number { get; set; } public int duration_ms { get; set; } public bool @explicit { get; set; } public ExternalIds external_ids { get; set; } public ExternalUrls external_urls { get; set; } public string href { get; set; } public string id { get; set; } public bool? is_playable { get; set; } public LinkedFrom linked_from { get; set; } public string name { get; set; } public int popularity { get; set; } public string preview_url { get; set; } public int track_number { get; set; } public string type { get; set; } public string uri { get; set; } } public class LinkedFrom { public ExternalUrls external_urls { get; set; } public string href { get; set; } public string id { get; set; } public string type { get; set; } public string uri { get; set; } } public class TracksResponse { public List tracks { get; set; } } public class AutenticationResponse { public string access_token { get; set; } public string token_type { get; set; } public int expires_in { get; set; } public string refresh_token { get; set; } } public class Followers { public string href { get; set; } public int? total { get; set; } } public class Owner { public ExternalUrls external_urls { get; set; } public string href { get; set; } public string id { get; set; } public string type { get; set; } public string uri { get; set; } } public class PlaylistTracks { public string href { get; set; } public List items { get; set; } public int limit { get; set; } public string next { get; set; } public int offset { get; set; } public object previous { get; set; } public int total { get; set; } } public class PlaylistTrackItem { public DateTime? added_at { get; set; } public AddedBy added_by { get; set; } public Track track { get; set; } public bool is_local { get; set; } } public class AddedBy { public ExternalUrls external_urls { get; set; } public string href { get; set; } public string id { get; set; } public string type { get; set; } public string uri { get; set; } } public class PlaylistResponse { public bool collaborative { get; set; } public string description { get; set; } public ExternalUrls external_urls { get; set; } public Followers followers { get; set; } public string href { get; set; } public string id { get; set; } public List images { get; set; } public string name { get; set; } public Owner owner { get; set; } public bool @public { get; set; } public string snapshot_id { get; set; } public PlaylistTracks Tracks { get; set; } public string type { get; set; } public string uri { get; set; } public bool HasSnapshotIdChanged { get; set; } public string GetImageUrl() { var image = this.images.FirstOrDefault(); return image == null ? null : image.url.ForceUrlHttps(); } public void RemoveInvalidTracks() { this.Tracks.items = this.Tracks.items.Where(IsValidTrack).ToList(); } public static bool IsValidTrack(PlaylistTrackItem track) { return track != null && track.track != null && !String.IsNullOrWhiteSpace(track.track.id) && !String.IsNullOrWhiteSpace(track.track.uri); } } public class PlaylistsResponse { public string href { get; set; } public List items { get; set; } public int limit { get; set; } public object next { get; set; } public int offset { get; set; } public object previous { get; set; } public int total { get; set; } } public class PlaylistTracksResponse { public string href { get; set; } public List items { get; set; } public int limit { get; set; } public object next { get; set; } public int offset { get; set; } public object previous { get; set; } public int total { get; set; } } public class PlaylistItem { public bool collaborative { get; set; } public ExternalUrls external_urls { get; set; } public string href { get; set; } public string id { get; set; } public List images { get; set; } public string name { get; set; } public Owner owner { get; set; } public bool @public { get; set; } public PlaylistTracks PlaylistTracks { get; set; } public string type { get; set; } public string uri { get; set; } public string snapshot_id { get; set; } } public class PublicPlaylistsResponse { public string href { get; set; } public List items { get; set; } public int limit { get; set; } public object next { get; set; } public int offset { get; set; } public object previous { get; set; } public int total { get; set; } } public class SearchTracksResponse { public SearchTracksCollection tracks { get; set; } } public class SearchTracksCollection { public string href { get; set; } public List items { get; set; } public int limit { get; set; } public object next { get; set; } public int offset { get; set; } public object previous { get; set; } public int total { get; set; } } public class SearchArtistResponse { public SearchArtistCollection artists { get; set; } } public class SearchArtistCollection { public string href { get; set; } public List items { get; set; } public int limit { get; set; } public object next { get; set; } public int offset { get; set; } public object previous { get; set; } public int total { get; set; } } public class UserResponse { public string display_name { get; set; } public ExternalUrls external_urls { 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 class SearchAlbumCollection { public string href { get; set; } public List items { get; set; } public int limit { get; set; } public object next { get; set; } public int offset { get; set; } public object previous { get; set; } public int total { get; set; } } public class SearchPlaylistCollection { public string href { get; set; } public List items { get; set; } public int limit { get; set; } public string next { get; set; } public int offset { get; set; } public object previous { get; set; } public int total { get; set; } } public class PlaylistSearchItem { public bool collaborative { get; set; } public ExternalUrls external_urls { get; set; } public string href { get; set; } public string id { get; set; } public List images { get; set; } public string name { get; set; } public Owner owner { get; set; } public bool? @public { get; set; } public string snapshot_id { get; set; } public PlaylistTracks tracks { get; set; } public string type { get; set; } public string uri { get; set; } } public class SearchAllResponse { public SearchTracksCollection tracks { get; set; } public SearchArtistCollection artists { get; set; } public SearchAlbumCollection albums { get; set; } public SearchPlaylistCollection playlists { get; set; } } public class BrowsePlaylistsResponse { public string message { get; set; } public BrowsePlaylists playlists { get; set; } } public class BrowsePlaylists { public string href { get; set; } public List items { get; set; } public int limit { get; set; } public object next { get; set; } public int offset { get; set; } public object previous { get; set; } public int total { get; set; } } public class SimplifiedPlaylist { public bool collaborative { get; set; } public ExternalUrls external_urls { get; set; } public string href { get; set; } public string id { get; set; } public List images { get; set; } public string name { get; set; } public Owner owner { get; set; } public bool? @public { get; set; } public PlaylistTracks PlaylistTracks { get; set; } public string type { get; set; } public string uri { get; set; } public string snapshot_id { get; set; } } public class BrowseCategoriesResponse { public BrowseCategories categories { get; set; } } public class BrowseCategories { public string href { get; set; } public List items { get; set; } public int limit { get; set; } public object next { get; set; } public int offset { get; set; } public object previous { get; set; } public int total { get; set; } } public class BrowseCategory { public string href { get; set; } public List icons { get; set; } public string id { get; set; } public string name { get; set; } } public class UserPrivateResponse { public string birthdate { get; set; } public string country { get; set; } public string display_name { get; set; } public string email { get; set; } public ExternalUrls external_urls { 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 class TrackInPosition { public string uri { get; set; } public IEnumerable positions { get; set; } } public class RemoveTrackOccurrencesRequest { public List positions { get; set; } public string snapshot_id { get; set; } } public class DeleteTrackRequest { public List tracks { get; set; } public string snapshot_id { get; set; } } public class AddTracksRequest { public List uris { get; set; } } public class TrackId { public string uri { get; set; } } public class ReorderRequest { public int range_start { get; set; } public int range_length { get; set; } public int insert_before { get; set; } public string snapshot_id { get; set; } } public class PlaylistDetailsRequest { public string name { get; set; } public bool @public { get; set; } } public class TrackChangeResponse { public string snapshot_id { get; set; } } public class AlbumItem { public AlbumType? album_type { get; set; } public List artists { get; set; } public List available_markets { get; set; } public ExternalUrls external_urls { get; set; } public string href { get; set; } public string id { get; set; } public List images { get; set; } public string name { get; set; } public string type { get; set; } public string uri { get; set; } } public class ArtistAlbumResponse { public string href { get; set; } public List items { get; set; } public int limit { get; set; } public string next { get; set; } public int offset { get; set; } public object previous { get; set; } public int total { get; set; } } public class FullAlbumItem { public AlbumType album_type { get; set; } public List artists { get; set; } public List available_markets { get; set; } public List copyrights { get; set; } public ExternalIds external_ids { get; set; } public ExternalUrls external_urls { 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 int popularity { get; set; } public string release_date { get; set; } public string release_date_precision { get; set; } public AlbumTracks tracks { get; set; } public string type { get; set; } public string uri { get; set; } } public class AlbumTracks { public string href { get; set; } public List items { get; set; } public int limit { get; set; } public object next { get; set; } public int offset { get; set; } public object previous { get; set; } public int total { get; set; } } public class Copyright { public string text { get; set; } public string type { get; set; } } public class AlbumResponse { public List albums { get; set; } } [Flags] public enum AlbumType { album = 0, single = 1, appears_on = 2, compilation = 4, } public class TopArtistItem { public ExternalUrls external_urls { 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 int popularity { get; set; } public string type { get; set; } public string uri { get; set; } } public class TopArtistsResponse { public List items { get; set; } public int total { get; set; } public int limit { get; set; } public int offset { get; set; } public object previous { get; set; } public string href { get; set; } public string next { get; set; } } public class TopTracksItem { public Album album { get; set; } public List artists { get; set; } public int disc_number { get; set; } public int duration_ms { get; set; } public bool @explicit { get; set; } public ExternalIds external_ids { get; set; } public ExternalUrls external_urls { get; set; } public string href { get; set; } public string id { get; set; } public bool is_playable { get; set; } public string name { get; set; } public int popularity { get; set; } public string preview_url { get; set; } public int track_number { get; set; } public string type { get; set; } public string uri { get; set; } } public class TopTracksResponse { public List items { get; set; } public int total { get; set; } public int limit { get; set; } public int offset { get; set; } public object previous { get; set; } public string href { get; set; } public string next { get; set; } } public class TrackAudioFeature { public double? danceability { get; set; } public double? energy { get; set; } public int? key { get; set; } public double? loudness { get; set; } public int? mode { get; set; } public double? speechiness { get; set; } public double? acousticness { get; set; } public double? instrumentalness { get; set; } public double? liveness { get; set; } public double? valence { get; set; } public double? tempo { get; set; } public string type { get; set; } public string id { get; set; } public string uri { get; set; } public string track_href { get; set; } public string analysis_url { get; set; } public int duration_ms { get; set; } public int? time_signature { get; set; } } public class AudioFeatureResponse { public List audio_features { get; set; } } public enum MyTopTimeRange { short_term, medium_term, long_term, } public enum MyTopType { artists, tracks, } }