/// <summary>
        /// Run the example.
        /// </summary>
        /// <param name="parsedArgs">Parsed arguments for the example.</param>
        protected override void Run(Dictionary <string, object> parsedArgs)
        {
            string accountId            = (string)parsedArgs["account_id"];
            long?  pretargetingConfigId = (long?)parsedArgs["pretargeting_config_id"];
            string name = $"bidders/{accountId}/pretargetingConfigs/{pretargetingConfigId}";

            NumericTargetingDimension geoTargeting = new NumericTargetingDimension();

            geoTargeting.IncludedIds = new List <long?>()
            {
                200635L,  // Austin, TX
                1014448L, // Boulder, CO
                1022183L, // Hoboken, NJ
                200622L,  // New Orleans, LA
                1023191L, // New York, NY
                9061237L, // Mountain View, CA
                1014221L  // San Francisco, CA
            };

            CreativeDimensions dimensions1 = new CreativeDimensions();

            dimensions1.Height = 480L;
            dimensions1.Width  = 320L;

            CreativeDimensions dimensions2 = new CreativeDimensions();

            dimensions2.Height = 1080L;
            dimensions2.Width  = 1920L;

            List <CreativeDimensions> creativeDimensions = new List <CreativeDimensions>()
            {
                dimensions1,
                dimensions2
            };

            PretargetingConfig body = new PretargetingConfig();

            body.DisplayName = (string)parsedArgs["display_name"];
            // Note that repeated fields such as this are completely overwritten by the contents
            // included in the patch request.
            body.IncludedFormats = new List <string>()
            {
                "HTML", "VAST"
            };
            body.GeoTargeting = geoTargeting;
            body.IncludedCreativeDimensions = creativeDimensions;

            BiddersResource.PretargetingConfigsResource.PatchRequest request =
                rtbService.Bidders.PretargetingConfigs.Patch(body, name);
            PretargetingConfig response = null;

            Console.WriteLine("Patching pretargeting configuration with name: {0}", name);

            try
            {
                response = request.Execute();
            }
            catch (System.Exception exception)
            {
                throw new ApplicationException(
                          $"Real-time Bidding API returned error response:\n{exception.Message}");
            }

            Utilities.PrintPretargetingConfiguration(response);
        }
        /// <summary>
        /// Run the example.
        /// </summary>
        /// <param name="parsedArgs">Parsed arguments for the example.</param>
        protected override void Run(Dictionary <string, object> parsedArgs)
        {
            string accountId = (string)parsedArgs["account_id"];
            string parent    = $"bidders/{accountId}";

            NumericTargetingDimension geoTargeting = new NumericTargetingDimension();

            geoTargeting.IncludedIds = (IList <long?>)parsedArgs["included_geo_ids"];
            geoTargeting.ExcludedIds = (IList <long?>)parsedArgs["excluded_geo_ids"];

            NumericTargetingDimension userListTargeting = new NumericTargetingDimension();

            userListTargeting.IncludedIds = (IList <long?>)parsedArgs["included_user_list_ids"];
            userListTargeting.ExcludedIds = (IList <long?>)parsedArgs["excluded_user_list_ids"];

            NumericTargetingDimension verticalTargeting = new NumericTargetingDimension();

            verticalTargeting.IncludedIds = (IList <long?>)parsedArgs["included_vertical_ids"];
            verticalTargeting.ExcludedIds = (IList <long?>)parsedArgs["excluded_vertical_ids"];

            CreativeDimensions dimensions = new CreativeDimensions();

            dimensions.Height = (long?)parsedArgs["included_creative_dimension_height"];
            dimensions.Width  = (long?)parsedArgs["included_creative_dimension_width"];

            StringTargetingDimension webTargeting = new StringTargetingDimension();

            webTargeting.TargetingMode = (string)parsedArgs["web_targeting_mode"];
            webTargeting.Values        = (IList <string>)parsedArgs["web_targeting_urls"];

            StringTargetingDimension mobileAppTargeting = new StringTargetingDimension();

            mobileAppTargeting.TargetingMode = (string)parsedArgs["mobile_app_targeting_mode"];
            mobileAppTargeting.Values        = (IList <string>)parsedArgs["mobile_app_targeting_app_ids"];

            NumericTargetingDimension mobileAppCategoryTargeting = new NumericTargetingDimension();

            mobileAppCategoryTargeting.IncludedIds = (IList <long?>)parsedArgs[
                "included_mobile_app_targeting_category_ids"];
            mobileAppCategoryTargeting.ExcludedIds = (IList <long?>)parsedArgs[
                "excluded_mobile_app_targeting_category_ids"];

            AppTargeting appTargeting = new AppTargeting();

            appTargeting.MobileAppTargeting         = mobileAppTargeting;
            appTargeting.MobileAppCategoryTargeting = mobileAppCategoryTargeting;

            StringTargetingDimension publisherTargeting = new StringTargetingDimension();

            publisherTargeting.TargetingMode = (string)parsedArgs["publisher_targeting_mode"];
            publisherTargeting.Values        = (IList <string>)parsedArgs["publisher_ids"];

            PretargetingConfig newConfig = new PretargetingConfig();

            newConfig.DisplayName               = (string)parsedArgs["display_name"];
            newConfig.IncludedFormats           = (IList <string>)parsedArgs["included_formats"];
            newConfig.GeoTargeting              = geoTargeting;
            newConfig.UserListTargeting         = userListTargeting;
            newConfig.InterstitialTargeting     = (string)parsedArgs["interstitial_targeting"];
            newConfig.AllowedUserTargetingModes = (IList <string>)parsedArgs[
                "allowed_user_targeting_modes"];
            newConfig.ExcludedContentLabelIds = (IList <long?>)parsedArgs[
                "excluded_content_label_ids"];
            newConfig.IncludedUserIdTypes = (IList <string>)parsedArgs["included_user_id_types"];
            newConfig.IncludedLanguages   = (IList <string>)parsedArgs["included_language_codes"];
            newConfig.IncludedMobileOperatingSystemIds = (IList <long?>)parsedArgs[
                "included_mobile_os_ids"];
            newConfig.VerticalTargeting          = verticalTargeting;
            newConfig.IncludedPlatforms          = (IList <string>)parsedArgs["included_platforms"];
            newConfig.IncludedCreativeDimensions = new List <CreativeDimensions> {
                dimensions
            };
            newConfig.IncludedEnvironments     = (IList <string>)parsedArgs["included_environments"];
            newConfig.WebTargeting             = webTargeting;
            newConfig.AppTargeting             = appTargeting;
            newConfig.PublisherTargeting       = publisherTargeting;
            newConfig.MinimumViewabilityDecile = (int?)parsedArgs["minimum_viewability_decile"];

            BiddersResource.PretargetingConfigsResource.CreateRequest request =
                rtbService.Bidders.PretargetingConfigs.Create(newConfig, parent);
            PretargetingConfig response = null;

            Console.WriteLine("Creating pretargeting configuration for bidder: {0}", parent);

            try
            {
                response = request.Execute();
            }
            catch (System.Exception exception)
            {
                throw new ApplicationException(
                          $"Real-time Bidding API returned error response:\n{exception.Message}");
            }

            Utilities.PrintPretargetingConfiguration(response);
        }