Ejemplo n.º 1
0
        /// <summary>
        /// Attach Get Playlist Command
        /// </summary>
        /// <param name="client">Spotify Sdk Client</param>
        /// <param name="response">Playlist Response</param>
        /// <param name="overrideIsAttach">Override Is Attach?</param>
        public static void AttachGetPlaylistCommands(
            this ISpotifySdkClient client,
            PlaylistResponse response,
            bool?overrideIsAttach = null)
        {
            var isAttach = GetConfig(client.Config.IsAttachGetPlaylistCommands, overrideIsAttach);

            if (isAttach && response != null)
            {
                // Playlist Command
                if (client.CommandActions.Playlist != null)
                {
                    response.Command = new GenericCommand <PlaylistResponse>(
                        client.CommandActions.Playlist);
                }
                // Change a Playlist's Details Command
                if (client.CommandActions.SetPlaylist != null)
                {
                    response.SetPlaylistCommand = new GenericCommand <PlaylistResponse>(
                        client.CommandActions.SetPlaylist);
                }
                // Upload a Custom Playlist Cover Image Command
                if (client.CommandActions.SetPlaylistImage != null)
                {
                    response.SetPlaylistImageCommand = new GenericCommand <PlaylistResponse>(
                        client.CommandActions.SetPlaylistImage);
                }
                // Add User Playback Command
                response.AddUserPlaybackCommand = new GenericCommand <IPlaybackResponse>(
                    client.AddUserPlaybackHandler);
                // User Commands
                client.AttachGetUserCommands(response.Owner, isAttach);
            }
        }