Exemplo n.º 1
0
        /// <summary>
        ///     Add the current user as a follower of one or more artists or other Spotify users.
        /// </summary>
        /// <param name="followType">The ID type: either artist or user.</param>
        /// <param name="ids">A list of the artist or the user Spotify IDs</param>
        /// <returns></returns>
        /// <remarks>Needs Authorization</remarks>
        public ErrorResponse Follow(FollowType followType, List <String> ids)
        {
            JObject ob = new JObject
            {
                { "ids", new JArray(ids) }
            };

            return(UploadData <ErrorResponse>(APIBase + "/me/following?type=" + followType.GetStringAttribute(""), ob.ToString(Formatting.None), "PUT") ?? new ErrorResponse());
        }
 /// <summary>
 ///     Check to see if the current user is following one or more artists or other Spotify users.
 /// </summary>
 /// <param name="followType">The ID type: either artist or user.</param>
 /// <param name="ids">A list of the artist or the user Spotify IDs to check</param>
 /// <returns></returns>
 /// <remarks>AUTH NEEDED</remarks>
 public string IsFollowing(FollowType followType, List <string> ids)
 {
     return($"{APIBase}/me/following/contains?type={followType.GetStringAttribute()}&ids={string.Join(",", ids)}");
 }
 /// <summary>
 ///     Remove the current user as a follower of one or more artists or other Spotify users.
 /// </summary>
 /// <param name="followType">The ID type: either artist or user.</param>
 /// <returns></returns>
 /// <remarks>AUTH NEEDED</remarks>
 public string Unfollow(FollowType followType)
 {
     return($"{APIBase}/me/following?type={followType.GetStringAttribute()}");
 }
Exemplo n.º 4
0
 /// <summary>
 ///     Check to see if the current user is following one or more artists or other Spotify users.
 /// </summary>
 /// <param name="followType">The ID type: either artist or user.</param>
 /// <param name="ids">A list of the artist or the user Spotify IDs to check</param>
 /// <returns></returns>
 /// <remarks>AUTH NEEDED</remarks>
 public string IsFollowing(FollowType followType, List<String> ids)
 {
     return $"{APIBase}/me/following/contains?type={followType.GetStringAttribute("")}&ids={string.Join(",", ids)}";
 }
Exemplo n.º 5
0
 /// <summary>
 ///     Remove the current user as a follower of one or more artists or other Spotify users.
 /// </summary>
 /// <param name="followType">The ID type: either artist or user.</param>
 /// <returns></returns>
 /// <remarks>AUTH NEEDED</remarks>
 public string Unfollow(FollowType followType)
 {
     return $"{APIBase}/me/following?type={followType.GetStringAttribute("")}";
 }
        /// <summary>
        ///
        /// </summary>
        public ListResponse <Boolean> IsFollowing(FollowType followType, List <String> ids)
        {
            JToken res = DownloadData <JToken>("https://api.spotify.com/v1/me/following/contains?type=" + followType.GetStringAttribute("") + "&ids=" + string.Join(",", ids));

            if (res is JArray)
            {
                return(new ListResponse <Boolean> {
                    List = res.ToObject <List <Boolean> >(), ErrorResponse = null
                });
            }
            else
            {
                return(new ListResponse <Boolean> {
                    List = null, ErrorResponse = res.ToObject <Error>()
                });
            }
        }
        public ErrorResponse Unfollow(FollowType followType, List <String> ids)
        {
            JObject ob = new JObject();

            ob.Add("ids", new JArray(ids.ToArray()));
            return(UploadData <ErrorResponse>("https://api.spotify.com/v1/me/following?type=" + followType.GetStringAttribute(""), ob.ToString(Formatting.None), "DELETE"));
        }
Exemplo n.º 8
0
        /// <summary>
        ///     Check to see if the current user is following one or more artists or other Spotify users.
        /// </summary>
        /// <param name="followType">The ID type: either artist or user.</param>
        /// <param name="ids">A list of the artist or the user Spotify IDs to check</param>
        /// <returns></returns>
        /// <remarks>Needs Authorization</remarks>
        public ListResponse <Boolean> IsFollowing(FollowType followType, List <String> ids)
        {
            if (!UseAuth)
            {
                throw new InvalidOperationException("Auth is required for IsFollowing");
            }
            JToken res = DownloadData <JToken>(APIBase + "/me/following/contains?type=" + followType.GetStringAttribute("") + "&ids=" + string.Join(",", ids));

            if (res is JArray)
            {
                return new ListResponse <Boolean> {
                           List = res.ToObject <List <Boolean> >(), Error = null
                }
            }
            ;
            return(new ListResponse <Boolean> {
                List = null, Error = res["error"].ToObject <Error>()
            });
        }