Example #1
0
        internal static void Main(string[] args)
        {
            Console.WriteLine("\nAdSense Management API Command Line Sample");
            Console.WriteLine("==========================================\n");

            GoogleWebAuthorizationBroker.Folder = "AdSense.Sample";
            var credential =
                GoogleWebAuthorizationBroker
                .AuthorizeAsync(new ClientSecrets {
                ClientId     = "INSERT_CLIENT_ID_HERE",
                ClientSecret = "INSERT_CLIENT_SECRET_HERE"
            },
                                new string[] { AdsenseService.Scope.Adsense }, "user",
                                CancellationToken.None)
                .Result;

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

            // Execute Publisher calls
            ManagementApiConsumer managementApiConsumer =
                new ManagementApiConsumer(service, MaxListPageSize);

            managementApiConsumer.RunCalls();

            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();
        }
        internal static void Main(string[] args)
        {
            Console.WriteLine("AdSense Management API Command Line Sample");
            Console.WriteLine("==========================================");

            GoogleWebAuthorizationBroker.Folder = "AdSense.Sample";
            var credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                new ClientSecrets
                {
                    ClientId = "INSERT_CLIENT_ID_HERE",
                    ClientSecret = "INSERT_CLIENT_SECRET_HERE"
                },
                new string[] { AdSenseService.Scope.Adsense }, 
                "user", 
                CancellationToken.None).Result;

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

            // Execute Publisher calls
            ManagementApiConsumer managementApiConsumer = new ManagementApiConsumer(service, MaxListPageSize);
            managementApiConsumer.RunCalls();

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