internal static void Main(string[] args)
        {
            Console.WriteLine("Content API for Shopping Command Line Sample");
            Console.WriteLine("============================================");

            GoogleWebAuthorizationBroker.Folder = "ShoppingContent.Sample";
            var credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                new ClientSecrets
                {
                    ClientId = CLIENT_ID,
                    ClientSecret = CLIENT_SECRET
                },
                new string[] { ShoppingContentService.Scope.Content},
                "user",
                CancellationToken.None).Result;

            // Create the service.
            var service = new ShoppingContentService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = credential,
                ApplicationName = "Shopping Content Sample",

            });

            // Execute the calls.
            ShoppingContentApiConsumer shoppingContentApiConsumer =
                new ShoppingContentApiConsumer(service, MaxListPageSize);

            if (MCA_MERCHANT_ID == 0)
            {
                // Non-MCA calls
                shoppingContentApiConsumer.RunCalls(MERCHANT_ID, EMAIL_ADDRESS, ADWORDS_ACCOUNT_ID);
            }
            else
            {
                // MCA calls
                shoppingContentApiConsumer.RunMultiClientAccountCalls(MCA_MERCHANT_ID);
            }

            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();
        }
Ejemplo n.º 2
0
        internal static void Main(string[] args)
        {
            Console.WriteLine("Content API for Shopping Command Line Sample");
            Console.WriteLine("============================================");

            GoogleWebAuthorizationBroker.Folder = "ShoppingContent.Sample";
            var credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                new ClientSecrets
            {
                ClientId     = CLIENT_ID,
                ClientSecret = CLIENT_SECRET
            },
                new string[] { ShoppingContentService.Scope.Content },
                "user",
                CancellationToken.None).Result;

            // Create the service.
            var service = new ShoppingContentService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = credential,
                ApplicationName       = "Shopping Content Sample",
            });

            // Execute the calls.
            ShoppingContentApiConsumer shoppingContentApiConsumer =
                new ShoppingContentApiConsumer(service, MaxListPageSize);


            if (MCA_MERCHANT_ID == 0)
            {
                // Non-MCA calls
                shoppingContentApiConsumer.RunCalls(MERCHANT_ID, EMAIL_ADDRESS, ADWORDS_ACCOUNT_ID);
            }
            else
            {
                // MCA calls
                shoppingContentApiConsumer.RunMultiClientAccountCalls(MCA_MERCHANT_ID);
            }

            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();
        }