Skip to content

Commit cbd248a

Browse files
author
Johnny @PC
committed
- Updated. (Changelog-date: November 11th, 2014)
- Improved HTTPServer - Ordered methods in SpotifyWebApiCass - Added various models for the new endpoints
1 parent 1476c4b commit cbd248a

17 files changed

+275
-73
lines changed

SpotifyAPI/SpotifyAPI.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<ProjectGuid>{EBBE35E2-7B91-4D7D-B8FC-3A0472F5119D}</ProjectGuid>
88
<OutputType>Library</OutputType>
99
<AppDesignerFolder>Properties</AppDesignerFolder>
10-
<RootNamespace>SpotifyAPI.SpotifyLocalAPI</RootNamespace>
10+
<RootNamespace>SpotifyAPI</RootNamespace>
1111
<AssemblyName>SpotifyAPI</AssemblyName>
1212
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
@@ -65,9 +65,11 @@
6565
<Compile Include="SpotifyWebAPI\ClientCredentialsAuth.cs" />
6666
<Compile Include="SpotifyWebAPI\ImplicitGrantAuth.cs" />
6767
<Compile Include="SpotifyWebAPI\Models\BasicModel.cs" />
68+
<Compile Include="SpotifyWebAPI\Models\FeaturedPlaylists.cs" />
6869
<Compile Include="SpotifyWebAPI\Models\FullAlbum.cs" />
6970
<Compile Include="SpotifyWebAPI\Models\FullArtist.cs" />
7071
<Compile Include="SpotifyWebAPI\Models\FullTrack.cs" />
72+
<Compile Include="SpotifyWebAPI\Models\NewAlbumReleases.cs" />
7173
<Compile Include="SpotifyWebAPI\Models\SearchItem.cs" />
7274
<Compile Include="SpotifyWebAPI\Models\PrivateProfile.cs" />
7375
<Compile Include="SpotifyWebAPI\Models\GeneralModels.cs" />

SpotifyAPI/SpotifyWebAPI/ImplicitGrantAuth.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,7 @@ public void SetResponse(String accessToken, String tokenType, int expiresIn,Stri
5858
}
5959
public void StopHttpServer()
6060
{
61-
try
62-
{
63-
httpThread.Abort();
64-
}catch(ThreadAbortException e)
65-
{
66-
67-
}
61+
httpServer.Dispose();
6862
httpServer = null;
6963
}
7064
}

SpotifyAPI/SpotifyWebAPI/Models/BasicModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ namespace SpotifyAPI.SpotifyWebAPI.Models
1010
public abstract class BasicModel
1111
{
1212
[JsonProperty("error")]
13-
public Error Error { get; set; }
13+
public Error ErrorResponse { get; set; }
1414

1515
public Boolean HasError()
1616
{
17-
return Error != null;
17+
return ErrorResponse != null;
1818
}
1919
}
2020
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using Newtonsoft.Json;
7+
8+
namespace SpotifyAPI.SpotifyWebAPI.Models
9+
{
10+
public class FeaturedPlaylists : BasicModel
11+
{
12+
[JsonProperty("message")]
13+
public String Message { get; set; }
14+
[JsonProperty("playlists")]
15+
public Paging<SimplePlaylist> Playlists { get; set; }
16+
}
17+
}

SpotifyAPI/SpotifyWebAPI/Models/FullAlbum.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ public class FullAlbum : BasicModel
1515
public List<SimpleArtist> Artists { get; set; }
1616
[JsonProperty("available_markets")]
1717
public List<String> AvailableMarkets { get; set; }
18+
[JsonProperty("copyrights")]
19+
public List<Copyright> Copyrights { get; set; }
1820
[JsonProperty("external_ids")]
1921
public Dictionary<String, String> ExternalIds { get; set; }
2022
[JsonProperty("external_urls")]

SpotifyAPI/SpotifyWebAPI/Models/FullArtist.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ public class FullArtist : BasicModel
1111
{
1212
[JsonProperty("external_urls")]
1313
public Dictionary<String, String> ExternalUrls { get; set; }
14+
[JsonProperty("followers")]
15+
public Followers Followers { get; set; }
1416
[JsonProperty("genres")]
1517
public List<String> Genres { get; set; }
1618
[JsonProperty("href")]

SpotifyAPI/SpotifyWebAPI/Models/FullTrack.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ public class FullTrack : BasicModel
1414
/// </summary>
1515
[JsonProperty("album")]
1616
public SimpleAlbum Album { get; set; }
17-
[JsonProperty("artist")]
18-
public SimpleArtist Artist { get; set; }
17+
[JsonProperty("artists")]
18+
public List<SimpleArtist> Artists { get; set; }
1919
[JsonProperty("available_markets")]
2020
public List<String> AvailableMarkets { get; set; }
2121
[JsonProperty("disc_number")]

SpotifyAPI/SpotifyWebAPI/Models/GeneralModels.cs

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ public class Image
1616
[JsonProperty("height")]
1717
public int Height { get; set; }
1818
}
19+
public class ErrorResponse
20+
{
21+
[JsonProperty("error")]
22+
public Error Error { get; set; }
23+
}
24+
1925
public class Error
2026
{
2127
[JsonProperty("status")]
@@ -46,13 +52,31 @@ public class PlaylistTrack
4652
[JsonProperty("track")]
4753
public FullTrack Track { get; set; }
4854
}
49-
internal class CreatePlaylistArgs
55+
public class CreatePlaylistArgs
5056
{
5157
[JsonProperty("name")]
5258
public String Name { get; set; }
5359
[JsonProperty("public")]
5460
public Boolean Public { get; set; }
5561
}
62+
public class DeleteTrackArg
63+
{
64+
[JsonProperty("uri")]
65+
public String Uri { get; set; }
66+
[JsonProperty("positions")]
67+
public List<int> Positions { get; set; }
68+
69+
public DeleteTrackArg(String uri, params int[] positions)
70+
{
71+
this.Positions = positions.ToList();
72+
this.Uri = uri;
73+
}
74+
public bool ShouldSerializePositions()
75+
{
76+
// don't serialize the Manager property if an employee is their own manager
77+
return (Positions.Count > 0);
78+
}
79+
}
5680
public class SeveralTracks
5781
{
5882
[JsonProperty("tracks")]
@@ -68,4 +92,16 @@ public class SeveralAlbums
6892
[JsonProperty("albums")]
6993
public List<FullAlbum> Albums { get; set; }
7094
}
95+
public class Copyright
96+
{
97+
[JsonProperty("text")]
98+
public String Text { get; set; }
99+
[JsonProperty("type")]
100+
public String Type { get; set; }
101+
}
102+
103+
public class CheckUserTracks : BasicModel
104+
{
105+
public List<Boolean> Checked { get; set; }
106+
}
71107
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using Newtonsoft.Json;
7+
8+
namespace SpotifyAPI.SpotifyWebAPI.Models
9+
{
10+
public class NewAlbumReleases : BasicModel
11+
{
12+
[JsonProperty("albums")]
13+
public Paging<SimpleAlbum> Albums { get; set; }
14+
}
15+
}

SpotifyAPI/SpotifyWebAPI/Models/PrivateProfile.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ public class PrivateProfile : BasicModel
1515
public String DisplayName { get; set; }
1616
[JsonProperty("external_urls")]
1717
public Dictionary<string, string> ExternalUrls { get; set; }
18+
[JsonProperty("followers")]
19+
public Followers Followers { get; set; }
1820
[JsonProperty("href")]
1921
public String Href { get; set; }
2022
[JsonProperty("id")]

0 commit comments

Comments
 (0)