mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-24 15:06:26 +00:00
Merge pull request #76 from eltoncezar/master
Implemented SpotifyUri in the LocalAPI
This commit is contained in:
commit
8a156ff9e5
@ -30,7 +30,7 @@ namespace SpotifyAPI.Example
|
||||
{
|
||||
RedirectUri = "http://localhost:8000",
|
||||
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"
|
||||
};
|
||||
_auth.OnResponseReceivedEvent += _auth_OnResponseReceivedEvent;
|
||||
|
@ -13,5 +13,10 @@ namespace SpotifyAPI.Local.Models
|
||||
|
||||
[JsonProperty("location")]
|
||||
public TrackResourceLocation Location { get; set; }
|
||||
|
||||
public SpotifyUri ParseUri()
|
||||
{
|
||||
return new SpotifyUri(this.Uri);
|
||||
}
|
||||
}
|
||||
}
|
30
SpotifyAPI/Local/Models/SpotifyUri.cs
Normal file
30
SpotifyAPI/Local/Models/SpotifyUri.cs
Normal 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];
|
||||
}
|
||||
}
|
||||
}
|
@ -56,6 +56,7 @@
|
||||
<Compile Include="Local\ExtendedWebClient.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Local\Models\SpotifyUri.cs" />
|
||||
<Compile Include="Local\VolumeMixerControl.cs" />
|
||||
<Compile Include="Web\IClient.cs" />
|
||||
<Compile Include="Local\Models\CFID.cs" />
|
||||
|
@ -27,7 +27,7 @@ namespace SpotifyAPI.Web.Enums
|
||||
UserReadEmail = 64,
|
||||
|
||||
[String("user-library-read")]
|
||||
UserLibrarayRead = 128,
|
||||
UserLibraryRead = 128,
|
||||
|
||||
[String("user-library-modify")]
|
||||
UserLibraryModify = 256,
|
||||
|
Loading…
Reference in New Issue
Block a user