コード例 #1
0
        /// <summary>
        ///     Creates a new instance of GeniusClient
        /// </summary>
        /// <param name="accessToken">Access Token to make authorized requests.</param>
        public GeniusClient(string accessToken)
        {
            IApiConnection apiConnection = new ApiConnection(accessToken);

            AccountsClient    = new AccountsClient(apiConnection);
            AnnotationsClient = new AnnotationsClient(apiConnection);
            ArtistsClient     = new ArtistsClient(apiConnection);
            VoteClient        = new VoteClient(apiConnection);
            ReferentsClient   = new ReferentsClient(apiConnection);
            SongsClient       = new SongsClient(apiConnection);
            SearchClient      = new SearchClient(apiConnection);
            WebPagesClient    = new WebPagesClient(apiConnection);
            LyricsClient      = new LyricsClient(apiConnection);
        }
コード例 #2
0
        private static void ArtistsMenu()
        {
            var artistsClient = new ArtistsClient(client);
            var isRunning     = true;

            while (isRunning)
            {
                Console.Clear();
                Console.WriteLine("Music Data System Console Client");
                Console.WriteLine("            Artists");
                Console.WriteLine();
                Console.WriteLine("( 1 ) Create Artist");
                Console.WriteLine("( 2 ) Get All Artists");
                Console.WriteLine("( 3 ) Get Artist by ID");
                Console.WriteLine("( 4 ) Update Artist");
                Console.WriteLine("( 5 ) Delete Artist");
                Console.WriteLine("( 6 ) Get Artist's Albums");
                Console.WriteLine("( 7 ) Get Artist's Songs");
                Console.WriteLine("( 8 ) Add Artist's Albums");
                Console.WriteLine("( 0 ) Exit");
                Console.WriteLine();
                Console.Write("Enter a number [0..8]:");
                var key = Console.ReadKey();

                switch (key.KeyChar)
                {
                case '1': artistsClient.CreateArtist();
                    break;

                case '2': artistsClient.GetAllArtists();
                    break;

                case '3': artistsClient.GetArtist();
                    break;

                case '4': artistsClient.UpdateArtist();
                    break;

                case '5': artistsClient.DeleteArtist();
                    break;

                case '6': artistsClient.GetArtistAlbums();
                    break;

                case '7': artistsClient.GetArtistSongs();
                    break;

                case '8': artistsClient.AddArtistAlbum();
                    break;

                case '0': isRunning = false;
                    break;

                default:
                    Console.WriteLine();
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine(" Incorrect choice!");
                    Console.ForegroundColor = ConsoleColor.Gray;
                    Thread.Sleep(1000);
                    break;
                }
            }
        }