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

            if (isAttach && response != null)
            {
                // Album Command
                if (client.CommandActions.Album != null)
                {
                    response.Command = new GenericCommand <AlbumResponse>(
                        client.CommandActions.Album);
                }
                // Add User Playback Command
                response.AddUserPlaybackCommand = new GenericCommand <IPlaybackResponse>(
                    client.AddUserPlaybackHandler);
                // Artist Commands
                if (response?.Artists != null)
                {
                    response.Artists.ForEach(item => client.AttachGetArtistCommands(item, isAttach));
                }
                if (response?.Artist != null)
                {
                    client.AttachGetArtistCommands(response?.Artist, isAttach);
                }
                // Track Commands
                if (response?.Tracks?.Items != null)
                {
                    response.Tracks.Items.ForEach(item => client.AttachGetTrackCommands(item, isAttach));
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Attach List Artists Commands
 /// </summary>
 /// <param name="client">Spotify Sdk Client</param>
 /// <param name="responses">Artist Responses</param>
 public static void AttachListArtistsCommands(
     this ISpotifySdkClient client,
     NavigationResponse <ArtistResponse> responses)
 {
     if (client.Config.IsAttachListArtistsCommands && responses?.Items != null)
     {
         responses.Items.ForEach(item => client.AttachGetArtistCommands(item, client.Config.IsAttachListArtistsCommands));
     }
 }