Merge pull request #76 from eltoncezar/master

Implemented SpotifyUri in the LocalAPI
This commit is contained in:
Jonas Dellinger 2016-03-21 14:53:03 +01:00
commit 8a156ff9e5
5 changed files with 38 additions and 2 deletions

View File

@ -30,7 +30,7 @@ namespace SpotifyAPI.Example
{ {
RedirectUri = "http://localhost:8000", RedirectUri = "http://localhost:8000",
ClientId = "26d287105e31491889f3cd293d85bfea", ClientId = "26d287105e31491889f3cd293d85bfea",
Scope = Scope.UserReadPrivate | Scope.UserReadEmail | Scope.PlaylistReadPrivate | Scope.UserLibrarayRead | Scope.UserReadPrivate | Scope.UserFollowRead | Scope.UserReadBirthdate, Scope = Scope.UserReadPrivate | Scope.UserReadEmail | Scope.PlaylistReadPrivate | Scope.UserLibraryRead | Scope.UserReadPrivate | Scope.UserFollowRead | Scope.UserReadBirthdate,
State = "XSS" State = "XSS"
}; };
_auth.OnResponseReceivedEvent += _auth_OnResponseReceivedEvent; _auth.OnResponseReceivedEvent += _auth_OnResponseReceivedEvent;

View File

@ -13,5 +13,10 @@ namespace SpotifyAPI.Local.Models
[JsonProperty("location")] [JsonProperty("location")]
public TrackResourceLocation Location { get; set; } public TrackResourceLocation Location { get; set; }
public SpotifyUri ParseUri()
{
return new SpotifyUri(this.Uri);
}
} }
} }

View File

@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SpotifyAPI.Local.Models
{
public class SpotifyUri
{
public string Base { get; internal set; }
public string Type { get; internal set; }
public string Id { get; internal set; }
public SpotifyUri(string uri)
{
if (String.IsNullOrEmpty(uri))
throw new ArgumentNullException("Uri");
string[] props = uri.Split(':');
if (props.Length != 3)
throw new ArgumentException("Unexpected Uri");
Base = props[0];
Type = props[1];
Id = props[2];
}
}
}

View File

@ -56,6 +56,7 @@
<Compile Include="Local\ExtendedWebClient.cs"> <Compile Include="Local\ExtendedWebClient.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
<Compile Include="Local\Models\SpotifyUri.cs" />
<Compile Include="Local\VolumeMixerControl.cs" /> <Compile Include="Local\VolumeMixerControl.cs" />
<Compile Include="Web\IClient.cs" /> <Compile Include="Web\IClient.cs" />
<Compile Include="Local\Models\CFID.cs" /> <Compile Include="Local\Models\CFID.cs" />

View File

@ -27,7 +27,7 @@ namespace SpotifyAPI.Web.Enums
UserReadEmail = 64, UserReadEmail = 64,
[String("user-library-read")] [String("user-library-read")]
UserLibrarayRead = 128, UserLibraryRead = 128,
[String("user-library-modify")] [String("user-library-modify")]
UserLibraryModify = 256, UserLibraryModify = 256,