mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-23 22:56:25 +00:00
Feature/shows and episodes (#437)
Co-authored-by: shayo <shay.ohayon@gmail.com>
This commit is contained in:
parent
482562c573
commit
3695866e55
@ -1,4 +1,4 @@
|
||||
{
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
@ -18,10 +18,10 @@
|
||||
"SpotifyAPI.Web.Examples.ASP": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"applicationUrl": "http://localhost:5000",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"applicationUrl": "http://localhost:5000"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
52
SpotifyAPI.Web/Converters/PlaybackContextConverter.cs
Normal file
52
SpotifyAPI.Web/Converters/PlaybackContextConverter.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SpotifyAPI.Web.Models;
|
||||
|
||||
namespace SpotifyAPI.Web.Converters
|
||||
{
|
||||
class PlaybackContextConverter : JsonConverter
|
||||
{
|
||||
public override bool CanConvert(Type objectType) => true;
|
||||
|
||||
public override object ReadJson(JsonReader reader, Type objectType,
|
||||
object existingValue, JsonSerializer serializer)
|
||||
{
|
||||
var token = JToken.ReadFrom(reader);
|
||||
if (token.Type == JTokenType.Null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Create an instance of MyClass, and set property as per "isFoo".
|
||||
var obj = new PlaybackContext();
|
||||
|
||||
if (token["currently_playing_type"] != null)
|
||||
{
|
||||
var type = token["currently_playing_type"].Value<string>();
|
||||
if (type == "track")
|
||||
{
|
||||
obj.Item = new FullTrack();
|
||||
}
|
||||
else if (type == "episode")
|
||||
{
|
||||
obj.Item = new FullEpisode();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception($"Received unkown currently playing type: {type}");
|
||||
}
|
||||
}
|
||||
|
||||
// Populate properties
|
||||
serializer.Populate(token.CreateReader(), obj);
|
||||
return obj;
|
||||
}
|
||||
|
||||
public override void WriteJson(JsonWriter writer, object value,
|
||||
JsonSerializer serializer)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
46
SpotifyAPI.Web/Converters/PlaylistTrackConverter.cs
Normal file
46
SpotifyAPI.Web/Converters/PlaylistTrackConverter.cs
Normal file
@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SpotifyAPI.Web.Models;
|
||||
|
||||
namespace SpotifyAPI.Web.Converters
|
||||
{
|
||||
class PlaylistTrackConverter : JsonConverter
|
||||
{
|
||||
public override bool CanConvert(Type objectType) => true;
|
||||
|
||||
public override object ReadJson(JsonReader reader, Type objectType,
|
||||
object existingValue, JsonSerializer serializer)
|
||||
{
|
||||
var token = JToken.ReadFrom(reader);
|
||||
if (token.Type == JTokenType.Null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var type = token["type"].Value<string>();
|
||||
if (type == "track")
|
||||
{
|
||||
var obj = new FullTrack();
|
||||
serializer.Populate(token.CreateReader(), obj);
|
||||
return obj;
|
||||
}
|
||||
else if (type == "episode")
|
||||
{
|
||||
var obj = new FullEpisode();
|
||||
serializer.Populate(token.CreateReader(), obj);
|
||||
return obj;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception($"Received unkown playlist track type: {type}");
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteJson(JsonWriter writer, object value,
|
||||
JsonSerializer serializer)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -63,6 +63,10 @@ namespace SpotifyAPI.Web.Enums
|
||||
AppRemoteControl = 262144,
|
||||
|
||||
[String("ugc-image-upload")]
|
||||
UgcImageUpload = 524288
|
||||
UgcImageUpload = 524288,
|
||||
|
||||
[String("user-read-playback-position")]
|
||||
UserReadPlaybackPosition = 1048576
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,13 @@ namespace SpotifyAPI.Web.Enums
|
||||
[String("playlist")]
|
||||
Playlist = 8,
|
||||
|
||||
[String("track,album,artist,playlist")]
|
||||
All = 16
|
||||
[String("show")]
|
||||
Show = 16,
|
||||
|
||||
[String("episode")]
|
||||
Episode = 32,
|
||||
|
||||
[String("track,album,artist,playlist,show,episode")]
|
||||
All = 64
|
||||
}
|
||||
}
|
||||
}
|
||||
|
63
SpotifyAPI.Web/Models/FullEpisode.cs
Normal file
63
SpotifyAPI.Web/Models/FullEpisode.cs
Normal file
@ -0,0 +1,63 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SpotifyAPI.Web.Models
|
||||
{
|
||||
public class FullEpisode : BasicModel, ITyped
|
||||
{
|
||||
[JsonProperty("audio_preview_url")]
|
||||
public string AudioPreviewUrl { get; set; }
|
||||
|
||||
[JsonProperty("description")]
|
||||
public string Description { get; set; }
|
||||
|
||||
[JsonProperty("duration_ms")]
|
||||
public int DurationMs { get; set; }
|
||||
|
||||
[JsonProperty("explicit")]
|
||||
public bool Explicit { get; set; }
|
||||
|
||||
[JsonProperty("external_urls")]
|
||||
public Dictionary<string, string> ExternalUrls { get; set; }
|
||||
|
||||
[JsonProperty("href")]
|
||||
public string Href { get; set; }
|
||||
|
||||
[JsonProperty("id")]
|
||||
public string Id { get; set; }
|
||||
|
||||
[JsonProperty("images")]
|
||||
public List<Image> Images { get; set; }
|
||||
|
||||
[JsonProperty("is_externally_hosted")]
|
||||
public bool IsExternallyHosted { get; set; }
|
||||
|
||||
[JsonProperty("is_playable")]
|
||||
public bool IsPlayable { get; set; }
|
||||
|
||||
[JsonProperty("languages")]
|
||||
public List<string> Languages { get; set; }
|
||||
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("release_date")]
|
||||
public string ReleaseDate { get; set; }
|
||||
|
||||
[JsonProperty("release_date_precision")]
|
||||
public string ReleaseDatePrecision { get; set; }
|
||||
|
||||
[JsonProperty("resume_point")]
|
||||
public ResumePointObject ResumePoint { get; set; }
|
||||
|
||||
[JsonProperty("show")]
|
||||
public SimpleShow Show { get; set; }
|
||||
|
||||
[JsonProperty("type")]
|
||||
public string Type { get; set; }
|
||||
|
||||
[JsonProperty("uri")]
|
||||
public string Uri { get; set; }
|
||||
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@ using Newtonsoft.Json;
|
||||
|
||||
namespace SpotifyAPI.Web.Models
|
||||
{
|
||||
public class FullTrack : BasicModel
|
||||
public class FullTrack : BasicModel, ITyped
|
||||
{
|
||||
[JsonProperty("album")]
|
||||
public SimpleAlbum Album { get; set; }
|
||||
@ -68,4 +68,4 @@ namespace SpotifyAPI.Web.Models
|
||||
[JsonProperty("linked_from")]
|
||||
public LinkedFrom LinkedFrom { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,9 +2,16 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using SpotifyAPI.Web.Converters;
|
||||
|
||||
namespace SpotifyAPI.Web.Models
|
||||
{
|
||||
public interface ITyped
|
||||
{
|
||||
[JsonProperty("type")]
|
||||
string Type { get; set; }
|
||||
}
|
||||
|
||||
public class Image
|
||||
{
|
||||
[JsonProperty("url")]
|
||||
@ -56,7 +63,8 @@ namespace SpotifyAPI.Web.Models
|
||||
public PublicProfile AddedBy { get; set; }
|
||||
|
||||
[JsonProperty("track")]
|
||||
public FullTrack Track { get; set; }
|
||||
[JsonConverter(typeof(PlaylistTrackConverter))]
|
||||
public ITyped Track { get; set; }
|
||||
|
||||
[JsonProperty("is_local")]
|
||||
public bool IsLocal { get; set; }
|
||||
@ -155,4 +163,4 @@ namespace SpotifyAPI.Web.Models
|
||||
[JsonProperty("uri")]
|
||||
public string Uri { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,12 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using SpotifyAPI.Web.Enums;
|
||||
using SpotifyAPI.Web.Converters;
|
||||
|
||||
namespace SpotifyAPI.Web.Models
|
||||
{
|
||||
[JsonConverter(typeof(PlaybackContextConverter))]
|
||||
public class PlaybackContext : BasicModel
|
||||
{
|
||||
[JsonProperty("device")]
|
||||
@ -29,10 +32,10 @@ namespace SpotifyAPI.Web.Models
|
||||
public bool IsPlaying { get; set; }
|
||||
|
||||
[JsonProperty("item")]
|
||||
public FullTrack Item { get; set; }
|
||||
public ITyped Item { get; set; }
|
||||
|
||||
[JsonProperty("currently_playing_type")]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public TrackType CurrentlyPlayingType { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
14
SpotifyAPI.Web/Models/ResumePointObject.cs
Normal file
14
SpotifyAPI.Web/Models/ResumePointObject.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SpotifyAPI.Web.Models
|
||||
{
|
||||
public class ResumePointObject : BasicModel
|
||||
{
|
||||
[JsonProperty("fully_played")]
|
||||
public bool FullyPlayed { get; set; }
|
||||
|
||||
[JsonProperty("resume_position_ms")]
|
||||
public int ResumePositionMs { get; set; }
|
||||
}
|
||||
}
|
@ -15,5 +15,11 @@ namespace SpotifyAPI.Web.Models
|
||||
|
||||
[JsonProperty("playlists")]
|
||||
public Paging<SimplePlaylist> Playlists { get; set; }
|
||||
|
||||
[JsonProperty("shows")]
|
||||
public Paging<SimpleShow> Shows { get; set; }
|
||||
|
||||
[JsonProperty("episodes")]
|
||||
public Paging<SimpleEpisode> Episodes { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
11
SpotifyAPI.Web/Models/SeveralShows.cs
Normal file
11
SpotifyAPI.Web/Models/SeveralShows.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SpotifyAPI.Web.Models
|
||||
{
|
||||
public class SeveralShows : BasicModel
|
||||
{
|
||||
[JsonProperty("shows")]
|
||||
public List<SimpleShow> Shows { get; set; }
|
||||
}
|
||||
}
|
60
SpotifyAPI.Web/Models/SimpleEpisode.cs
Normal file
60
SpotifyAPI.Web/Models/SimpleEpisode.cs
Normal file
@ -0,0 +1,60 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SpotifyAPI.Web.Models
|
||||
{
|
||||
public class SimpleEpisode : BasicModel
|
||||
{
|
||||
[JsonProperty("audio_preview_url")]
|
||||
public string AudioPreviewUrl { get; set; }
|
||||
|
||||
[JsonProperty("description")]
|
||||
public string Description { get; set; }
|
||||
|
||||
[JsonProperty("duration_ms")]
|
||||
public int DurationMs { get; set; }
|
||||
|
||||
[JsonProperty("explicit")]
|
||||
public bool Explicit { get; set; }
|
||||
|
||||
[JsonProperty("external_urls")]
|
||||
public Dictionary<string, string> ExternalUrls { get; set; }
|
||||
|
||||
[JsonProperty("href")]
|
||||
public string Href { get; set; }
|
||||
|
||||
[JsonProperty("id")]
|
||||
public string Id { get; set; }
|
||||
|
||||
[JsonProperty("images")]
|
||||
public List<Image> Images { get; set; }
|
||||
|
||||
[JsonProperty("is_externally_hosted")]
|
||||
public bool IsExternallyHosted { get; set; }
|
||||
|
||||
[JsonProperty("is_playable")]
|
||||
public bool IsPlayable { get; set; }
|
||||
|
||||
[JsonProperty("languages")]
|
||||
public List<string> Languages { get; set; }
|
||||
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("release_date")]
|
||||
public string ReleaseDate { get; set; }
|
||||
|
||||
[JsonProperty("resume_point")]
|
||||
public ResumePointObject ResumePoint { get; set; }
|
||||
|
||||
[JsonProperty("show")]
|
||||
public SimpleShow Show { get; set; }
|
||||
|
||||
[JsonProperty("type")]
|
||||
public string Type { get; set; }
|
||||
|
||||
[JsonProperty("uri")]
|
||||
public string Uri { get; set; }
|
||||
|
||||
}
|
||||
}
|
54
SpotifyAPI.Web/Models/SimpleShow.cs
Normal file
54
SpotifyAPI.Web/Models/SimpleShow.cs
Normal file
@ -0,0 +1,54 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SpotifyAPI.Web.Models
|
||||
{
|
||||
public class SimpleShow : BasicModel
|
||||
{
|
||||
[JsonProperty("available_markets")]
|
||||
public List<string> AvailableMarkets { get; set; }
|
||||
|
||||
[JsonProperty("copyrights")]
|
||||
public List<Copyright> Copyrights { get; set; }
|
||||
|
||||
[JsonProperty("description")]
|
||||
public string Description { get; set; }
|
||||
|
||||
[JsonProperty("explicit")]
|
||||
public bool Explicit { get; set; }
|
||||
|
||||
[JsonProperty("external_urls")]
|
||||
public Dictionary<string, string> ExternalUrls { get; set; }
|
||||
|
||||
[JsonProperty("href")]
|
||||
public string Href { get; set; }
|
||||
|
||||
[JsonProperty("id")]
|
||||
public string Id { get; set; }
|
||||
|
||||
[JsonProperty("images")]
|
||||
public List<Image> Images { get; set; }
|
||||
|
||||
[JsonProperty("is_externally_hosted")]
|
||||
public bool IsExternallyHosted { get; set; }
|
||||
|
||||
[JsonProperty("languages")]
|
||||
public List<string> Languages { get; set; }
|
||||
|
||||
[JsonProperty("media_type")]
|
||||
public string MediaType { get; set; }
|
||||
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("publisher")]
|
||||
public string Publisher { get; set; }
|
||||
|
||||
[JsonProperty("type")]
|
||||
public string Type { get; set; }
|
||||
|
||||
[JsonProperty("uri")]
|
||||
public string Uri { get; set; }
|
||||
|
||||
}
|
||||
}
|
@ -5,6 +5,9 @@ namespace SpotifyAPI.Web.Models
|
||||
{
|
||||
public class SimpleTrack : BasicModel
|
||||
{
|
||||
[JsonProperty("album")]
|
||||
public SimpleAlbum Album { get; set; }
|
||||
|
||||
[JsonProperty("artists")]
|
||||
public List<SimpleArtist> Artists { get; set; }
|
||||
|
||||
@ -19,6 +22,9 @@ namespace SpotifyAPI.Web.Models
|
||||
|
||||
[JsonProperty("explicit")]
|
||||
public bool Explicit { get; set; }
|
||||
|
||||
[JsonProperty("external_ids")]
|
||||
public Dictionary<string, string> ExternIds { get; set; }
|
||||
|
||||
[JsonProperty("external_urls")]
|
||||
public Dictionary<string, string> ExternUrls { get; set; }
|
||||
@ -29,9 +35,18 @@ namespace SpotifyAPI.Web.Models
|
||||
[JsonProperty("id")]
|
||||
public string Id { get; set; }
|
||||
|
||||
[JsonProperty("is_playable")]
|
||||
public bool IsPlayable { get; set; }
|
||||
|
||||
[JsonProperty("linked_from")]
|
||||
public TrackLink LinkedFrom { get; set; }
|
||||
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("popularity")]
|
||||
public int Popularity { get; set; }
|
||||
|
||||
[JsonProperty("preview_url")]
|
||||
public string PreviewUrl { get; set; }
|
||||
|
||||
|
23
SpotifyAPI.Web/Models/TrackLink.cs
Normal file
23
SpotifyAPI.Web/Models/TrackLink.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SpotifyAPI.Web.Models
|
||||
{
|
||||
public class TrackLink : BasicModel
|
||||
{
|
||||
[JsonProperty("external_urls")]
|
||||
public Dictionary<string, string> ExternalUrls { get; set; }
|
||||
|
||||
[JsonProperty("href")]
|
||||
public string Href { get; set; }
|
||||
|
||||
[JsonProperty("id")]
|
||||
public string Id { get; set; }
|
||||
|
||||
[JsonProperty("type")]
|
||||
public string Type { get; set; }
|
||||
|
||||
[JsonProperty("uri")]
|
||||
public string Uri { get; set; }
|
||||
}
|
||||
}
|
@ -613,6 +613,54 @@ namespace SpotifyAPI.Web
|
||||
|
||||
#endregion Browse
|
||||
|
||||
#region Episode
|
||||
/// <summary>
|
||||
/// Get Spotify catalog information for a single episode identified by its unique Spotify ID.
|
||||
/// </summary>
|
||||
/// <param name="id">The Spotify ID for the episode.</param>
|
||||
/// <param name="market">An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.</param>
|
||||
/// <returns></returns>
|
||||
public FullEpisode GetEpisode(string id, string market = "")
|
||||
{
|
||||
return DownloadData<FullEpisode>(_builder.GetEpisode(id, market));
|
||||
}
|
||||
/// <summary>
|
||||
/// Get Spotify catalog information for a single episode identified by its unique Spotify ID.
|
||||
/// </summary>
|
||||
/// <param name="id">The Spotify ID for the episode.</param>
|
||||
/// <param name="market">An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.</param>
|
||||
/// <returns></returns>
|
||||
public Task<FullEpisode> GetEpisodeAsync(string id, string market = "")
|
||||
{
|
||||
return DownloadDataAsync<FullEpisode>(_builder.GetEpisode(id, market));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Spotify catalog information for multiple episodes based on their Spotify IDs.
|
||||
/// </summary>
|
||||
/// <param name="id">A Spotify ID for the episodes.</param>
|
||||
/// <param name="market">Optional. An ISO 3166-1 alpha-2 country code. If a country code is specified, only shows and episodes that are available in that market will be returned. If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter. Note: If neither market or user country are provided, the content is considered unavailable for the client.Users can view the country that is associated with their account in the account settings.</param>
|
||||
/// <returns></returns>
|
||||
public ListResponse<FullEpisode> GetEpisodes(string id, string market = "")
|
||||
{
|
||||
return DownloadList<FullEpisode>(_builder.GetEpisode(id, market));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Spotify catalog information for multiple episodes based on their Spotify IDs.
|
||||
/// </summary>
|
||||
/// <param name="id">A Spotify IDs for the episode.</param>
|
||||
/// <param name="market">Optional. An ISO 3166-1 alpha-2 country code. If a country code is specified, only shows and episodes that are available in that market will be returned. If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter. Note: If neither market or user country are provided, the content is considered unavailable for the client.Users can view the country that is associated with their account in the account settings.</param>
|
||||
/// <returns></returns>
|
||||
public Task<ListResponse<FullEpisode>> GetEpisodesAsync(string id, string market = "")
|
||||
{
|
||||
return DownloadListAsync<FullEpisode>(_builder.GetEpisode(id, market));
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion Episode
|
||||
|
||||
#region Follow
|
||||
|
||||
/// <summary>
|
||||
@ -1319,26 +1367,6 @@ namespace SpotifyAPI.Web
|
||||
return DownloadDataAsync<Paging<SimplePlaylist>>(_builder.GetUserPlaylists(userId, limit, offset));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a playlist owned by a Spotify user.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user's Spotify user ID.</param>
|
||||
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||
/// <param name="fields">
|
||||
/// Filters for the query: a comma-separated list of the fields to return. If omitted, all fields are
|
||||
/// returned.
|
||||
/// </param>
|
||||
/// <param name="market">An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
[Obsolete("Calling GetPlaylist with a userId is deprecated, remove the parameter")]
|
||||
public FullPlaylist GetPlaylist(string userId, string playlistId, string fields = "", string market = "")
|
||||
{
|
||||
if (!UseAuth)
|
||||
throw new InvalidOperationException("Auth is required for GetPlaylist");
|
||||
return DownloadData<FullPlaylist>(_builder.GetPlaylist(userId, playlistId, fields, market));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a playlist owned by a Spotify user.
|
||||
/// </summary>
|
||||
@ -1357,26 +1385,6 @@ namespace SpotifyAPI.Web
|
||||
return DownloadData<FullPlaylist>(_builder.GetPlaylist(playlistId, fields, market));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a playlist owned by a Spotify user asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user's Spotify user ID.</param>
|
||||
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||
/// <param name="fields">
|
||||
/// Filters for the query: a comma-separated list of the fields to return. If omitted, all fields are
|
||||
/// returned.
|
||||
/// </param>
|
||||
/// <param name="market">An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
[Obsolete("Calling GetPlaylist with a userId is deprecated, remove the parameter")]
|
||||
public Task<FullPlaylist> GetPlaylistAsync(string userId, string playlistId, string fields = "", string market = "")
|
||||
{
|
||||
if (!UseAuth)
|
||||
throw new InvalidOperationException("Auth is required for GetPlaylist");
|
||||
return DownloadDataAsync<FullPlaylist>(_builder.GetPlaylist(userId, playlistId, fields, market));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a playlist owned by a Spotify user asynchronously.
|
||||
/// </summary>
|
||||
@ -1395,27 +1403,6 @@ namespace SpotifyAPI.Web
|
||||
return DownloadDataAsync<FullPlaylist>(_builder.GetPlaylist(playlistId, fields, market));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get full details of the tracks of a playlist owned by a Spotify user.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user's Spotify user ID.</param>
|
||||
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||
/// <param name="fields">
|
||||
/// Filters for the query: a comma-separated list of the fields to return. If omitted, all fields are
|
||||
/// returned.
|
||||
/// </param>
|
||||
/// <param name="limit">The maximum number of tracks to return. Default: 100. Minimum: 1. Maximum: 100.</param>
|
||||
/// <param name="offset">The index of the first object to return. Default: 0 (i.e., the first object)</param>
|
||||
/// <param name="market">An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
[Obsolete("Calling GetPlaylistTracks with a userId is deprecated, remove the parameter")]
|
||||
public Paging<PlaylistTrack> GetPlaylistTracks(string userId, string playlistId, string fields = "", int limit = 100, int offset = 0, string market = "")
|
||||
{
|
||||
if (!UseAuth)
|
||||
throw new InvalidOperationException("Auth is required for GetPlaylistTracks");
|
||||
return DownloadData<Paging<PlaylistTrack>>(_builder.GetPlaylistTracks(userId, playlistId, fields, limit, offset, market));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get full details of the tracks of a playlist owned by a Spotify user.
|
||||
@ -1437,28 +1424,6 @@ namespace SpotifyAPI.Web
|
||||
return DownloadData<Paging<PlaylistTrack>>(_builder.GetPlaylistTracks(playlistId, fields, limit, offset, market));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get full details of the tracks of a playlist owned by a Spotify user asyncronously.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user's Spotify user ID.</param>
|
||||
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||
/// <param name="fields">
|
||||
/// Filters for the query: a comma-separated list of the fields to return. If omitted, all fields are
|
||||
/// returned.
|
||||
/// </param>
|
||||
/// <param name="limit">The maximum number of tracks to return. Default: 100. Minimum: 1. Maximum: 100.</param>
|
||||
/// <param name="offset">The index of the first object to return. Default: 0 (i.e., the first object)</param>
|
||||
/// <param name="market">An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
[Obsolete("Calling GetPlaylistTracks with a userId is deprecated, remove the parameter")]
|
||||
public Task<Paging<PlaylistTrack>> GetPlaylistTracksAsync(string userId, string playlistId, string fields = "", int limit = 100, int offset = 0, string market = "")
|
||||
{
|
||||
if (!UseAuth)
|
||||
throw new InvalidOperationException("Auth is required for GetPlaylistTracks");
|
||||
return DownloadDataAsync<Paging<PlaylistTrack>>(_builder.GetPlaylistTracks(userId, playlistId, fields, limit, offset, market));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get full details of the tracks of a playlist owned by a Spotify user asyncronously.
|
||||
/// </summary>
|
||||
@ -1529,33 +1494,6 @@ namespace SpotifyAPI.Web
|
||||
return UploadDataAsync<FullPlaylist>(_builder.CreatePlaylist(userId, playlistName, isPublic), body.ToString(Formatting.None));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Change a playlist’s name and public/private state. (The user must, of course, own the playlist.)
|
||||
/// </summary>
|
||||
/// <param name="userId">The user's Spotify user ID.</param>
|
||||
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||
/// <param name="newName">The new name for the playlist, for example "My New Playlist Title".</param>
|
||||
/// <param name="newPublic">If true the playlist will be public, if false it will be private.</param>
|
||||
/// <param name="newCollaborative">If true the playlist will become collaborative and other users will be able to modify the playlist in their Spotify client.
|
||||
/// Note: You can only set collaborative to true on non-public playlists.</param>
|
||||
/// <param name="newDescription">Value for playlist description as displayed in Spotify Clients and in the Web API.</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
[Obsolete("Calling UpdatePlaylist with a userId is deprecated, remove the parameter")]
|
||||
public ErrorResponse UpdatePlaylist(string userId, string playlistId, string newName = null, bool? newPublic = null, bool? newCollaborative = null, string newDescription = null)
|
||||
{
|
||||
JObject body = new JObject();
|
||||
if (newName != null)
|
||||
body.Add("name", newName);
|
||||
if (newPublic != null)
|
||||
body.Add("public", newPublic);
|
||||
if (newCollaborative != null)
|
||||
body.Add("collaborative", newCollaborative);
|
||||
if (newDescription != null)
|
||||
body.Add("description", newDescription);
|
||||
return UploadData<ErrorResponse>(_builder.UpdatePlaylist(userId, playlistId), body.ToString(Formatting.None), "PUT") ?? new ErrorResponse();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Change a playlist’s name and public/private state. (The user must, of course, own the playlist.)
|
||||
/// </summary>
|
||||
@ -1581,32 +1519,6 @@ namespace SpotifyAPI.Web
|
||||
return UploadData<ErrorResponse>(_builder.UpdatePlaylist(playlistId), body.ToString(Formatting.None), "PUT") ?? new ErrorResponse();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Change a playlist’s name and public/private state asynchronously. (The user must, of course, own the playlist.)
|
||||
/// </summary>
|
||||
/// <param name="userId">The user's Spotify user ID.</param>
|
||||
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||
/// <param name="newName">The new name for the playlist, for example "My New Playlist Title".</param>
|
||||
/// <param name="newPublic">If true the playlist will be public, if false it will be private.</param>
|
||||
/// <param name="newCollaborative">If true the playlist will become collaborative and other users will be able to modify the playlist in their Spotify client. Note: You can only set collaborative to true on non-public playlists.</param>
|
||||
/// <param name="newDescription">Value for playlist description as displayed in Spotify Clients and in the Web API.</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
[Obsolete("Calling UpdatePlaylist with a userId is deprecated, remove the parameter")]
|
||||
public async Task<ErrorResponse> UpdatePlaylistAsync(string userId, string playlistId, string newName = null, bool? newPublic = null, bool? newCollaborative = null, string newDescription = null)
|
||||
{
|
||||
JObject body = new JObject();
|
||||
if (newName != null)
|
||||
body.Add("name", newName);
|
||||
if (newPublic != null)
|
||||
body.Add("public", newPublic);
|
||||
if (newCollaborative != null)
|
||||
body.Add("collaborative", newCollaborative);
|
||||
if (newDescription != null)
|
||||
body.Add("description", newDescription);
|
||||
return await UploadDataAsync<ErrorResponse>(_builder.UpdatePlaylist(userId, playlistId), body.ToString(Formatting.None), "PUT").ConfigureAwait(false) ?? new ErrorResponse();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Change a playlist’s name and public/private state asynchronously. (The user must, of course, own the playlist.)
|
||||
/// </summary>
|
||||
@ -1631,32 +1543,6 @@ namespace SpotifyAPI.Web
|
||||
return await UploadDataAsync<ErrorResponse>(_builder.UpdatePlaylist(playlistId), body.ToString(Formatting.None), "PUT").ConfigureAwait(false) ?? new ErrorResponse();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Change a playlist’s name and public/private state. (The user must, of course, own the playlist.)
|
||||
/// </summary>
|
||||
/// <param name="userId">The user's Spotify user ID.</param>
|
||||
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||
/// <param name="base64EncodedJpgImage">The image as a base64 encoded string</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
public ErrorResponse UploadPlaylistImage(string userId, string playlistId, string base64EncodedJpgImage)
|
||||
{
|
||||
return UploadData<ErrorResponse>(_builder.UploadPlaylistImage(userId, playlistId), base64EncodedJpgImage, "PUT") ?? new ErrorResponse();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Change a playlist’s name and public/private state asynchronously. (The user must, of course, own the playlist.)
|
||||
/// </summary>
|
||||
/// <param name="userId">The user's Spotify user ID.</param>
|
||||
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||
/// <param name="base64EncodedJpgImage">The image as a base64 encoded string</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
public async Task<ErrorResponse> UploadPlaylistImageAsync(string userId, string playlistId, string base64EncodedJpgImage)
|
||||
{
|
||||
return await UploadDataAsync<ErrorResponse>(_builder.UploadPlaylistImage(userId, playlistId), base64EncodedJpgImage, "PUT").ConfigureAwait(false) ?? new ErrorResponse();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Change a playlist’s name and public/private state. (The user must, of course, own the playlist.)
|
||||
/// </summary>
|
||||
@ -1682,24 +1568,6 @@ namespace SpotifyAPI.Web
|
||||
base64EncodedJpgImage, "PUT").ConfigureAwait(false) ?? new ErrorResponse();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replace all the tracks in a playlist, overwriting its existing tracks. This powerful request can be useful for
|
||||
/// replacing tracks, re-ordering existing tracks, or clearing the playlist.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user's Spotify user ID.</param>
|
||||
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||
/// <param name="uris">A list of Spotify track URIs to set. A maximum of 100 tracks can be set in one request.</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
[Obsolete("Calling ReplacePlaylistTracks with a userId is deprecated, remove the parameter")]
|
||||
public ErrorResponse ReplacePlaylistTracks(string userId, string playlistId, List<string> uris)
|
||||
{
|
||||
JObject body = new JObject
|
||||
{ { "uris", new JArray(uris.Take(100)) }
|
||||
};
|
||||
return UploadData<ErrorResponse>(_builder.ReplacePlaylistTracks(userId, playlistId), body.ToString(Formatting.None), "PUT") ?? new ErrorResponse();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replace all the tracks in a playlist, overwriting its existing tracks. This powerful request can be useful for
|
||||
/// replacing tracks, re-ordering existing tracks, or clearing the playlist.
|
||||
@ -1716,24 +1584,6 @@ namespace SpotifyAPI.Web
|
||||
return UploadData<ErrorResponse>(_builder.ReplacePlaylistTracks(playlistId), body.ToString(Formatting.None), "PUT") ?? new ErrorResponse();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replace all the tracks in a playlist asynchronously, overwriting its existing tracks. This powerful request can be useful for
|
||||
/// replacing tracks, re-ordering existing tracks, or clearing the playlist.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user's Spotify user ID.</param>
|
||||
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||
/// <param name="uris">A list of Spotify track URIs to set. A maximum of 100 tracks can be set in one request.</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
[Obsolete("Calling ReplacePlaylistTracks with a userId is deprecated, remove the parameter")]
|
||||
public async Task<ErrorResponse> ReplacePlaylistTracksAsync(string userId, string playlistId, List<string> uris)
|
||||
{
|
||||
JObject body = new JObject
|
||||
{ { "uris", new JArray(uris.Take(100)) }
|
||||
};
|
||||
return await UploadDataAsync<ErrorResponse>(_builder.ReplacePlaylistTracks(userId, playlistId), body.ToString(Formatting.None), "PUT").ConfigureAwait(false) ?? new ErrorResponse();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replace all the tracks in a playlist asynchronously, overwriting its existing tracks. This powerful request can be useful for
|
||||
/// replacing tracks, re-ordering existing tracks, or clearing the playlist.
|
||||
@ -1750,26 +1600,6 @@ namespace SpotifyAPI.Web
|
||||
return await UploadDataAsync<ErrorResponse>(_builder.ReplacePlaylistTracks(playlistId), body.ToString(Formatting.None), "PUT").ConfigureAwait(false) ?? new ErrorResponse();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove one or more tracks from a user’s playlist.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user's Spotify user ID.</param>
|
||||
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||
/// <param name="uris">
|
||||
/// array of objects containing Spotify URI strings (and their position in the playlist). A maximum of
|
||||
/// 100 objects can be sent at once.
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
[Obsolete("Calling RemovePlaylistTracks with a userId is deprecated, remove the parameter")]
|
||||
public ErrorResponse RemovePlaylistTracks(string userId, string playlistId, List<DeleteTrackUri> uris)
|
||||
{
|
||||
JObject body = new JObject
|
||||
{ { "tracks", JArray.FromObject(uris.Take(100)) }
|
||||
};
|
||||
return UploadData<ErrorResponse>(_builder.RemovePlaylistTracks(userId, playlistId, uris), body.ToString(Formatting.None), "DELETE") ?? new ErrorResponse();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove one or more tracks from a user’s playlist.
|
||||
/// </summary>
|
||||
@ -1788,26 +1618,6 @@ namespace SpotifyAPI.Web
|
||||
return UploadData<ErrorResponse>(_builder.RemovePlaylistTracks(playlistId, uris), body.ToString(Formatting.None), "DELETE") ?? new ErrorResponse();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove one or more tracks from a user’s playlist asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user's Spotify user ID.</param>
|
||||
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||
/// <param name="uris">
|
||||
/// array of objects containing Spotify URI strings (and their position in the playlist). A maximum of
|
||||
/// 100 objects can be sent at once.
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
[Obsolete("Calling RemovePlaylistTracks with a userId is deprecated, remove the parameter")]
|
||||
public async Task<ErrorResponse> RemovePlaylistTracksAsync(string userId, string playlistId, List<DeleteTrackUri> uris)
|
||||
{
|
||||
JObject body = new JObject
|
||||
{ { "tracks", JArray.FromObject(uris.Take(100)) }
|
||||
};
|
||||
return await UploadDataAsync<ErrorResponse>(_builder.RemovePlaylistTracks(userId, playlistId, uris), body.ToString(Formatting.None), "DELETE").ConfigureAwait(false) ?? new ErrorResponse();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove one or more tracks from a user’s playlist asynchronously.
|
||||
/// </summary>
|
||||
@ -1826,20 +1636,6 @@ namespace SpotifyAPI.Web
|
||||
return await UploadDataAsync<ErrorResponse>(_builder.RemovePlaylistTracks(playlistId, uris), body.ToString(Formatting.None), "DELETE").ConfigureAwait(false) ?? new ErrorResponse();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove a track from a user’s playlist.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user's Spotify user ID.</param>
|
||||
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||
/// <param name="uri">Spotify URI</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
[Obsolete("Calling RemovePlaylistTrack with a userId is deprecated, remove the parameter")]
|
||||
public ErrorResponse RemovePlaylistTrack(string userId, string playlistId, DeleteTrackUri uri)
|
||||
{
|
||||
return RemovePlaylistTracks(playlistId, new List<DeleteTrackUri> { uri });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove a track from a user’s playlist.
|
||||
/// </summary>
|
||||
@ -1852,20 +1648,6 @@ namespace SpotifyAPI.Web
|
||||
return RemovePlaylistTracks(playlistId, new List<DeleteTrackUri> { uri });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove a track from a user’s playlist asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user's Spotify user ID.</param>
|
||||
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||
/// <param name="uri">Spotify URI</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
[Obsolete("Calling RemovePlaylistTrack with a userId is deprecated, remove the parameter")]
|
||||
public Task<ErrorResponse> RemovePlaylistTrackAsync(string userId, string playlistId, DeleteTrackUri uri)
|
||||
{
|
||||
return RemovePlaylistTracksAsync(playlistId, new List<DeleteTrackUri> { uri });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove a track from a user’s playlist asynchronously.
|
||||
/// </summary>
|
||||
@ -1878,24 +1660,6 @@ namespace SpotifyAPI.Web
|
||||
return RemovePlaylistTracksAsync(playlistId, new List<DeleteTrackUri> { uri });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add one or more tracks to a user’s playlist.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user's Spotify user ID.</param>
|
||||
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||
/// <param name="uris">A list of Spotify track URIs to add</param>
|
||||
/// <param name="position">The position to insert the tracks, a zero-based index</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
[Obsolete("Calling AddPlaylistTracks with a userId is deprecated, remove the parameter")]
|
||||
public ErrorResponse AddPlaylistTracks(string userId, string playlistId, List<string> uris, int? position = null)
|
||||
{
|
||||
JObject body = new JObject
|
||||
{ { "uris", JArray.FromObject(uris.Take(100)) }
|
||||
};
|
||||
return UploadData<ErrorResponse>(_builder.AddPlaylistTracks(userId, playlistId, uris, position), body.ToString(Formatting.None)) ?? new ErrorResponse();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add one or more tracks to a user’s playlist.
|
||||
/// </summary>
|
||||
@ -1912,24 +1676,6 @@ namespace SpotifyAPI.Web
|
||||
return UploadData<ErrorResponse>(_builder.AddPlaylistTracks(playlistId, uris, position), body.ToString(Formatting.None)) ?? new ErrorResponse();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add one or more tracks to a user’s playlist asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user's Spotify user ID.</param>
|
||||
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||
/// <param name="uris">A list of Spotify track URIs to add</param>
|
||||
/// <param name="position">The position to insert the tracks, a zero-based index</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
[Obsolete("Calling AddPlaylistTracks with a userId is deprecated, remove the parameter")]
|
||||
public async Task<ErrorResponse> AddPlaylistTracksAsync(string userId, string playlistId, List<string> uris, int? position = null)
|
||||
{
|
||||
JObject body = new JObject
|
||||
{ { "uris", JArray.FromObject(uris.Take(100)) }
|
||||
};
|
||||
return await UploadDataAsync<ErrorResponse>(_builder.AddPlaylistTracks(userId, playlistId, uris, position), body.ToString(Formatting.None)).ConfigureAwait(false) ?? new ErrorResponse();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add one or more tracks to a user’s playlist asynchronously.
|
||||
/// </summary>
|
||||
@ -1946,21 +1692,6 @@ namespace SpotifyAPI.Web
|
||||
return await UploadDataAsync<ErrorResponse>(_builder.AddPlaylistTracks(playlistId, uris, position), body.ToString(Formatting.None)).ConfigureAwait(false) ?? new ErrorResponse();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a track to a user’s playlist.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user's Spotify user ID.</param>
|
||||
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||
/// <param name="uri">A Spotify Track URI</param>
|
||||
/// <param name="position">The position to insert the tracks, a zero-based index</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
[Obsolete("Calling AddPlaylistTrack with a userId is deprecated, remove the parameter")]
|
||||
public ErrorResponse AddPlaylistTrack(string userId, string playlistId, string uri, int? position = null)
|
||||
{
|
||||
return AddPlaylistTracks(playlistId, new List<string> { uri }, position);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a track to a user’s playlist.
|
||||
/// </summary>
|
||||
@ -1974,21 +1705,6 @@ namespace SpotifyAPI.Web
|
||||
return AddPlaylistTracks(playlistId, new List<string> { uri }, position);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a track to a user’s playlist asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user's Spotify user ID.</param>
|
||||
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||
/// <param name="uri">A Spotify Track URI</param>
|
||||
/// <param name="position">The position to insert the tracks, a zero-based index</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
[Obsolete("Calling AddPlaylistTrack with a userId is deprecated, remove the parameter")]
|
||||
public Task<ErrorResponse> AddPlaylistTrackAsync(string userId, string playlistId, string uri, int? position = null)
|
||||
{
|
||||
return AddPlaylistTracksAsync(userId, playlistId, new List<string> { uri }, position);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a track to a user’s playlist asynchronously.
|
||||
/// </summary>
|
||||
@ -2002,28 +1718,6 @@ namespace SpotifyAPI.Web
|
||||
return AddPlaylistTracksAsync(playlistId, new List<string> { uri }, position);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reorder a track or a group of tracks in a playlist.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user's Spotify user ID.</param>
|
||||
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||
/// <param name="rangeStart">The position of the first track to be reordered.</param>
|
||||
/// <param name="insertBefore">The position where the tracks should be inserted. </param>
|
||||
/// <param name="rangeLength">The amount of tracks to be reordered. Defaults to 1 if not set.</param>
|
||||
/// <param name="snapshotId">The playlist's snapshot ID against which you want to make the changes.</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
[Obsolete("Calling ReorderPlaylist with a userId is deprecated, remove the parameter")]
|
||||
public Snapshot ReorderPlaylist(string userId, string playlistId, int rangeStart, int insertBefore, int rangeLength = 1, string snapshotId = "")
|
||||
{
|
||||
JObject body = new JObject
|
||||
{ { "range_start", rangeStart }, { "range_length", rangeLength }, { "insert_before", insertBefore }
|
||||
};
|
||||
if (!string.IsNullOrEmpty(snapshotId))
|
||||
body.Add("snapshot_id", snapshotId);
|
||||
return UploadData<Snapshot>(_builder.ReorderPlaylist(userId, playlistId), body.ToString(Formatting.None), "PUT");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reorder a track or a group of tracks in a playlist.
|
||||
/// </summary>
|
||||
@ -2044,28 +1738,6 @@ namespace SpotifyAPI.Web
|
||||
return UploadData<Snapshot>(_builder.ReorderPlaylist(playlistId), body.ToString(Formatting.None), "PUT");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reorder a track or a group of tracks in a playlist asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user's Spotify user ID.</param>
|
||||
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||
/// <param name="rangeStart">The position of the first track to be reordered.</param>
|
||||
/// <param name="insertBefore">The position where the tracks should be inserted. </param>
|
||||
/// <param name="rangeLength">The amount of tracks to be reordered. Defaults to 1 if not set.</param>
|
||||
/// <param name="snapshotId">The playlist's snapshot ID against which you want to make the changes.</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
[Obsolete("Calling ReorderPlaylist with a userId is deprecated, remove the parameter")]
|
||||
public Task<Snapshot> ReorderPlaylistAsync(string userId, string playlistId, int rangeStart, int insertBefore, int rangeLength = 1, string snapshotId = "")
|
||||
{
|
||||
JObject body = new JObject
|
||||
{ { "range_start", rangeStart }, { "range_length", rangeLength }, { "insert_before", insertBefore }, { "snapshot_id", snapshotId }
|
||||
};
|
||||
if (!string.IsNullOrEmpty(snapshotId))
|
||||
body.Add("snapshot_id", snapshotId);
|
||||
return UploadDataAsync<Snapshot>(_builder.ReorderPlaylist(userId, playlistId), body.ToString(Formatting.None), "PUT");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reorder a track or a group of tracks in a playlist asynchronously.
|
||||
/// </summary>
|
||||
@ -2136,6 +1808,128 @@ namespace SpotifyAPI.Web
|
||||
|
||||
#endregion Profiles
|
||||
|
||||
#region Shows
|
||||
|
||||
/// <summary>
|
||||
/// Get Spotify catalog information for a single show identified by its unique Spotify ID.
|
||||
/// </summary>
|
||||
/// <param name="id">The Spotify ID for the show.</param>
|
||||
/// <param name="market">An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.</param>
|
||||
/// <returns></returns>
|
||||
public SimpleShow GetShow(string id, string market = "")
|
||||
{
|
||||
return DownloadData<SimpleShow>(_builder.GetShow(id, market));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Spotify catalog information for a single show identified by its unique Spotify ID.
|
||||
/// </summary>
|
||||
/// <param name="id">The Spotify ID for the show.</param>
|
||||
/// <param name="market">An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.</param>
|
||||
/// <returns></returns>
|
||||
public Task<SimpleShow> GetShowAsync(string id, string market = "")
|
||||
{
|
||||
return DownloadDataAsync<SimpleShow>(_builder.GetShow(id, market));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get Spotify catalog information for multiple shows based on their Spotify IDs.
|
||||
/// </summary>
|
||||
/// <param name="ids">A comma-separated list of the Spotify IDs for the shows. Maximum: 50 IDs.</param>
|
||||
/// <param name="market">Optional. An ISO 3166-1 alpha-2 country code. If a country code is specified, only shows and episodes that are available in that market will be returned. If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter. Note: If neither market or user country are provided, the content is considered unavailable for the client.Users can view the country that is associated with their account in the account settings.</param>
|
||||
/// <returns></returns>
|
||||
public Task<SeveralShows> GetShowsAsync(List<string> ids, string market = "")
|
||||
{
|
||||
return DownloadDataAsync<SeveralShows>(_builder.GetShows(ids, market));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Spotify catalog information for multiple shows based on their Spotify IDs.
|
||||
/// </summary>
|
||||
/// <param name="ids">A comma-separated list of the Spotify IDs for the shows. Maximum: 50 IDs.</param>
|
||||
/// <param name="market">Optional. An ISO 3166-1 alpha-2 country code. If a country code is specified, only shows and episodes that are available in that market will be returned. If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter. Note: If neither market or user country are provided, the content is considered unavailable for the client.Users can view the country that is associated with their account in the account settings.</param>
|
||||
/// <returns></returns>
|
||||
public SeveralShows GetShows(List<string> ids, string market = "")
|
||||
{
|
||||
return DownloadData<SeveralShows>(_builder.GetShows(ids, market));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A Helper function that removes the spotify:XXX: prefix for several uris.
|
||||
/// </summary>
|
||||
/// <param name="uris">A list of full spotify uris</param>
|
||||
/// <returns>A list of uris without the spotify prefix.</returns>
|
||||
public List<string> RemovePrefix(List<string> uris)
|
||||
{
|
||||
List<string> fixed_uris = new List<string>();
|
||||
foreach (var uri in uris)
|
||||
{
|
||||
fixed_uris.Add(RemovePrefix(uri));
|
||||
}
|
||||
return fixed_uris;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A Helper function that removes the spotify:XXX: prefix for a single uri.
|
||||
/// </summary>
|
||||
/// <param name="uri">A spotify uri (e.g.,spotify:XXX:YYY). </param>
|
||||
/// <returns>Uri without the prefix (e.g. YYY).</returns>
|
||||
|
||||
public string RemovePrefix(string uri)
|
||||
{
|
||||
if (uri.Contains("spotify:show:"))
|
||||
{
|
||||
return uri.Replace("spotify:show:", "");
|
||||
}
|
||||
else if (uri.Contains("spotify:track:"))
|
||||
{
|
||||
return uri.Replace("spotify:track:", "");
|
||||
}
|
||||
else if (uri.Contains("spotify:album:"))
|
||||
{
|
||||
return uri.Replace("spotify:album:", "");
|
||||
}
|
||||
else if (uri.Contains("spotify:episode:"))
|
||||
{
|
||||
return uri.Replace("spotify:episode:", "");
|
||||
}
|
||||
else if (uri.Contains("spotify:playlist:"))
|
||||
{
|
||||
return uri.Replace("spotify:playlist:", "");
|
||||
}
|
||||
else
|
||||
return uri;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Spotify catalog information about an show’s episodes. Optional parameters can be used to limit the number of episodes returned.
|
||||
/// </summary>
|
||||
/// <param name="id">A list of the Spotify IDs for the tracks. Maximum: 50 IDs.</param>
|
||||
/// <param name="limit">The maximum number of episodes to return. Default: 20. Minimum: 1. Maximum: 50.</param>
|
||||
/// <param name="offset">The index of the first episode to return. Default: 0 (the first object). Use with limit to get the next set of episodes.</param>
|
||||
/// <param name="market">An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.</param>
|
||||
/// <returns></returns>
|
||||
public Paging<SimpleEpisode> GetShowEpisodes(string id, int limit = 20, int offset = 0, string market = "")
|
||||
{
|
||||
return DownloadData<Paging<SimpleEpisode>>(_builder.GetShowEpisodes(id, limit, offset, market));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Spotify catalog information about an show’s episodes. Optional parameters can be used to limit the number of episodes returned.
|
||||
/// </summary>
|
||||
/// <param name="id">A list of the Spotify IDs for the tracks. Maximum: 50 IDs.</param>
|
||||
/// <param name="limit">The maximum number of episodes to return. Default: 20. Minimum: 1. Maximum: 50.</param>
|
||||
/// <param name="offset">The index of the first episode to return. Default: 0 (the first object). Use with limit to get the next set of episodes.</param>
|
||||
/// <param name="market">An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.</param>
|
||||
/// <returns></returns>
|
||||
public Task<Paging<FullEpisode>> GetShowEpisodesAsync(string id, int limit = 20, int offset = 0, string market = "")
|
||||
{
|
||||
return DownloadDataAsync<Paging<FullEpisode>>(_builder.GetShowEpisodes(id, limit, offset, market));
|
||||
}
|
||||
|
||||
#endregion Shows
|
||||
|
||||
#region Tracks
|
||||
|
||||
/// <summary>
|
||||
|
@ -339,6 +339,37 @@ namespace SpotifyAPI.Web
|
||||
|
||||
#endregion Browse
|
||||
|
||||
|
||||
|
||||
#region Episode
|
||||
/// <summary>
|
||||
/// Get Spotify catalog information for a single episode identified by its unique Spotify ID.
|
||||
/// </summary>
|
||||
/// <param name="id">The Spotify ID for the episode.</param>
|
||||
/// <param name="market">An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.</param>
|
||||
/// <returns></returns>
|
||||
public string GetEpisode(string id, string market = "")
|
||||
{
|
||||
return string.IsNullOrEmpty(market) ?
|
||||
$"{APIBase}/episodes/{id}" :
|
||||
$"{APIBase}/episodes?market={market}&id={id}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Spotify catalog information for multiple episodes based on their Spotify IDs.
|
||||
/// </summary>
|
||||
/// <param name="ids">A comma-separated list of the Spotify IDs for the episodes. Maximum: 50 IDs.</param>
|
||||
/// <param name="market">Optional. An ISO 3166-1 alpha-2 country code. If a country code is specified, only shows and episodes that are available in that market will be returned. If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter. Note: If neither market or user country are provided, the content is considered unavailable for the client.Users can view the country that is associated with their account in the account settings.</param>
|
||||
/// <returns></returns>
|
||||
public string GetEpisodes(List<string> ids, string market = "")
|
||||
{
|
||||
return string.IsNullOrEmpty(market) ?
|
||||
$"{APIBase}/episodes?ids={string.Join(",", ids.Take(50))}" :
|
||||
$"{APIBase}/episodes?market={market}&ids={string.Join(",", ids.Take(50))}";
|
||||
}
|
||||
#endregion Episode
|
||||
|
||||
|
||||
#region Follow
|
||||
|
||||
/// <summary>
|
||||
@ -534,6 +565,39 @@ namespace SpotifyAPI.Web
|
||||
return APIBase + "/me/albums/contains?ids=" + string.Join(",", ids);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Save one or more shows to current Spotify user’s library.
|
||||
/// </summary>
|
||||
// <param name="ids">A list of the Spotify IDs.</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED (user-library-modify)</remarks>
|
||||
public string SubscribeShows(List<string> ids)
|
||||
{
|
||||
return $"{APIBase}/me/shows?ids={string.Join(",", ids.Take(50))}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if one or more shows is already saved in the current Spotify user’s library.
|
||||
/// </summary>
|
||||
// <param name="ids">A list of the Spotify IDs.</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED (user-library-modify)</remarks>
|
||||
public string CheckSubscribedShows(List<string> ids)
|
||||
{
|
||||
return $"{APIBase}/me/shows/contains?ids={string.Join(",", ids.Take(50))}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete one or more shows from current Spotify user’s library.
|
||||
/// </summary>
|
||||
/// <param name="ids">A list of the Spotify IDs.</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED (user-library-modify)</remarks>
|
||||
public string UnsubscribeShows(List<string> ids)
|
||||
{
|
||||
return $"{APIBase}/me/shows?ids={string.Join(",", ids.Take(50))}";
|
||||
}
|
||||
|
||||
#endregion Library
|
||||
|
||||
#region Personalization
|
||||
@ -622,7 +686,6 @@ namespace SpotifyAPI.Web
|
||||
/// <summary>
|
||||
/// Get a playlist owned by a Spotify user.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user's Spotify user ID.</param>
|
||||
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||
/// <param name="fields">
|
||||
/// Filters for the query: a comma-separated list of the fields to return. If omitted, all fields are
|
||||
@ -631,58 +694,14 @@ namespace SpotifyAPI.Web
|
||||
/// <param name="market">An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
public string GetPlaylist(string userId, string playlistId, string fields = "", string market = "")
|
||||
{
|
||||
StringBuilder builder = new StringBuilder(APIBase + "/users/" + userId + "/playlists/" + playlistId);
|
||||
builder.Append("?fields=" + fields);
|
||||
if (!string.IsNullOrEmpty(market))
|
||||
builder.Append("&market=" + market);
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a playlist owned by a Spotify user.
|
||||
/// </summary>
|
||||
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||
/// <param name="fields">
|
||||
/// Filters for the query: a comma-separated list of the fields to return. If omitted, all fields are
|
||||
/// returned.
|
||||
/// </param>
|
||||
/// <param name="market">An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
public string GetPlaylist(string playlistId, string fields = "", string market = "")
|
||||
public string GetPlaylist(string playlistId, string fields = "", string market = "", string additionalTypes = "track,episode")
|
||||
{
|
||||
StringBuilder builder = new StringBuilder(APIBase + "/playlists/" + playlistId);
|
||||
builder.Append("?fields=" + fields);
|
||||
if (!string.IsNullOrEmpty(market))
|
||||
builder.Append("&market=" + market);
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get full details of the tracks of a playlist owned by a Spotify user.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user's Spotify user ID.</param>
|
||||
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||
/// <param name="fields">
|
||||
/// Filters for the query: a comma-separated list of the fields to return. If omitted, all fields are
|
||||
/// returned.
|
||||
/// </param>
|
||||
/// <param name="limit">The maximum number of tracks to return. Default: 100. Minimum: 1. Maximum: 100.</param>
|
||||
/// <param name="offset">The index of the first object to return. Default: 0 (i.e., the first object)</param>
|
||||
/// <param name="market">An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
public string GetPlaylistTracks(string userId, string playlistId, string fields = "", int limit = 100, int offset = 0, string market = "")
|
||||
{
|
||||
limit = Math.Min(limit, 100);
|
||||
StringBuilder builder = new StringBuilder(APIBase + "/users/" + userId + "/playlists/" + playlistId + "/tracks");
|
||||
builder.Append("?fields=" + fields);
|
||||
builder.Append("&limit=" + limit);
|
||||
builder.Append("&offset=" + offset);
|
||||
if (!string.IsNullOrEmpty(market))
|
||||
builder.Append("&market=" + market);
|
||||
if (!string.IsNullOrEmpty(additionalTypes))
|
||||
builder.Append("&additional_types=" + additionalTypes);
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
@ -697,9 +716,10 @@ namespace SpotifyAPI.Web
|
||||
/// <param name="limit">The maximum number of tracks to return. Default: 100. Minimum: 1. Maximum: 100.</param>
|
||||
/// <param name="offset">The index of the first object to return. Default: 0 (i.e., the first object)</param>
|
||||
/// <param name="market">An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.</param>
|
||||
/// <param name="additional_types">A comma-separated list of item types that your client supports besides the default track type. Valid types are: track and episode. An unsupported type in the response is expected to be represented as null value in the item field. Note: This parameter was introduced to allow existing clients to maintain their current behaviour and might be deprecated in the future. In addition to providing this parameter, make sure that your client properly handles cases of new types in the future by checking against the currently_playing_type field..</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>AUTH NEEDED</remarks>
|
||||
public string GetPlaylistTracks(string playlistId, string fields = "", int limit = 100, int offset = 0, string market = "")
|
||||
public string GetPlaylistTracks(string playlistId, string fields = "", int limit = 100, int offset = 0, string market = "", string additional_types = "track,episode")
|
||||
{
|
||||
limit = Math.Min(limit, 100);
|
||||
StringBuilder builder = new StringBuilder(APIBase + "/playlists/" + playlistId + "/tracks");
|
||||
@ -707,7 +727,13 @@ namespace SpotifyAPI.Web
|
||||
builder.Append("&limit=" + limit);
|
||||
builder.Append("&offset=" + offset);
|
||||
if (!string.IsNullOrEmpty(market))
|
||||
{
|
||||
builder.Append("&market=" + market);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(additional_types))
|
||||
{
|
||||
builder.Append("&additional_types=" + additional_types);
|
||||
}
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
@ -912,6 +938,53 @@ namespace SpotifyAPI.Web
|
||||
|
||||
#endregion Profiles
|
||||
|
||||
#region Shows
|
||||
|
||||
/// <summary>
|
||||
/// Get Spotify catalog information for a single show identified by its unique Spotify ID.
|
||||
/// </summary>
|
||||
/// <param name="id">The Spotify ID for the show.</param>
|
||||
/// <param name="market">An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.</param>
|
||||
/// <returns></returns>
|
||||
public string GetShow(string id, string market = "")
|
||||
{
|
||||
return string.IsNullOrEmpty(market) ?
|
||||
$"{APIBase}/shows/{id}" :
|
||||
$"{APIBase}/shows?market={market}&id={id}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Spotify catalog information for multiple shows based on their Spotify IDs.
|
||||
/// </summary>
|
||||
/// <param name="ids">A comma-separated list of the Spotify IDs for the shows. Maximum: 50 IDs.</param>
|
||||
/// <param name="market">Optional. An ISO 3166-1 alpha-2 country code. If a country code is specified, only shows and episodes that are available in that market will be returned. If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter. Note: If neither market or user country are provided, the content is considered unavailable for the client.Users can view the country that is associated with their account in the account settings.</param>
|
||||
/// <returns></returns>
|
||||
public string GetShows(List<string> ids, string market = "")
|
||||
{
|
||||
return string.IsNullOrEmpty(market) ?
|
||||
$"{APIBase}/shows?ids={string.Join(",", ids.Take(50))}" :
|
||||
$"{APIBase}/shows?market={market}&ids={string.Join(",", ids.Take(50))}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Spotify catalog information about an show’s episodes. Optional parameters can be used to limit the number of episodes returned.
|
||||
/// </summary>
|
||||
/// <param name="id">A list of the Spotify IDs for the tracks. Maximum: 50 IDs.</param>
|
||||
/// <param name="limit">The maximum number of episodes to return. Default: 20. Minimum: 1. Maximum: 50.</param>
|
||||
/// <param name="offset">The index of the first episode to return. Default: 0 (the first object). Use with limit to get the next set of episodes.</param>
|
||||
/// <param name="market">An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.</param>
|
||||
/// <returns></returns>
|
||||
public string GetShowEpisodes(string id, int limit = 20, int offset = 0, string market = "")
|
||||
{
|
||||
return string.IsNullOrEmpty(market) ?
|
||||
$"{APIBase}/shows/{id}/episodes?offset={offset}&limit={limit}" :
|
||||
$"{APIBase}/shows/{id}/episodes?market={market}&offset={offset}&limit={limit}";
|
||||
}
|
||||
|
||||
#endregion Shows
|
||||
|
||||
|
||||
|
||||
#region Tracks
|
||||
|
||||
/// <summary>
|
||||
@ -988,22 +1061,24 @@ namespace SpotifyAPI.Web
|
||||
/// Get information about the user’s current playback state, including track, track progress, and active device.
|
||||
/// </summary>
|
||||
/// <param name="market">An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.</param>
|
||||
/// <param name="additional_types">A comma-separated list of item types that your client supports besides the default track type. Valid types are: track and episode. An unsupported type in the response is expected to be represented as null value in the item field. Note: This parameter was introduced to allow existing clients to maintain their current behaviour and might be deprecated in the future. In addition to providing this parameter, make sure that your client properly handles cases of new types in the future by checking against the currently_playing_type field..</param>
|
||||
/// <returns></returns>
|
||||
public string GetPlayback(string market = "")
|
||||
public string GetPlayback(string market = "", string additional_types = "track,episode")
|
||||
{
|
||||
return string.IsNullOrEmpty(market) ? $"{APIBase}/me/player" : $"{APIBase}/me/player?market={market}";
|
||||
return string.IsNullOrEmpty(market) ? $"{APIBase}/me/player?additional_types={additional_types}" : $"{APIBase}/me/player?market={market}&additional_types={additional_types}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the object currently being played on the user’s Spotify account.
|
||||
/// </summary>
|
||||
/// <param name="market">An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track Relinking.</param>
|
||||
/// <param name="additional_types">A comma-separated list of item types that your client supports besides the default track type. Valid types are: track and episode. An unsupported type in the response is expected to be represented as null value in the item field. Note: This parameter was introduced to allow existing clients to maintain their current behaviour and might be deprecated in the future. In addition to providing this parameter, make sure that your client properly handles cases of new types in the future by checking against the currently_playing_type field..</param>
|
||||
/// <returns></returns>
|
||||
public string GetPlayingTrack(string market = "")
|
||||
public string GetPlayingTrack(string market = "", string additional_types = "track,episode")
|
||||
{
|
||||
return string.IsNullOrEmpty(market) ?
|
||||
$"{APIBase}/me/player/currently-playing" :
|
||||
$"{APIBase}/me/player/currently-playing?market={market}";
|
||||
$"{APIBase}/me/player/currently-playing?additional_types={additional_types}" :
|
||||
$"{APIBase}/me/player/currently-playing?market={market}&additional_types={additional_types}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -1132,4 +1207,4 @@ namespace SpotifyAPI.Web
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user