public virtual BudgetSuggestion get(BudgetSuggestionSelector selector) { object[] results = this.Invoke("get", new object[] { selector }); return ((BudgetSuggestion) (results[0])); }
/// <summary> /// Runs the code example. /// </summary> /// <param name="user">The AdWords user.</param> public void Run(AdWordsUser user) { // Get the BudgetSuggestionService. BudgetSuggestionService budgetSuggestionService = (BudgetSuggestionService) user.GetService(AdWordsService.v201506.BudgetSuggestionService); BudgetSuggestionSelector selector = new BudgetSuggestionSelector(); List<Criterion> criteria = new List<Criterion>(); // Criterion - Travel Agency product/service. See GetProductServices.cs for an example // of how to get valid product/service settings. ProductService productService = new ProductService(); productService.text = "Travel Agency"; productService.locale = "en_US"; criteria.Add(productService); // Criterion - English language. // The ID can be found in the documentation: // https://developers.google.com/adwords/api/docs/appendix/languagecodes Language language = new Language(); language.id = 1000L; criteria.Add(language); // Criterion - Mountain View, California location. // The ID can be found in the documentation: // https://developers.google.com/adwords/api/docs/appendix/geotargeting // https://developers.google.com/adwords/api/docs/appendix/cities-DMAregions Location location = new Location(); location.id = 1014044L; criteria.Add(location); selector.criteria = criteria.ToArray(); try { BudgetSuggestion budgetSuggestion = budgetSuggestionService.get(selector); Console.WriteLine("Budget suggestion for criteria is:\n" + " SuggestedBudget={0}\n" + " Min/MaxBudget={1}/{2}\n" + " Min/MaxCpc={3}/{4}\n" + " CPM={5}\n" + " CPC={6}\n" + " Impressions={7}\n", budgetSuggestion.suggestedBudget.microAmount, budgetSuggestion.minBudget.microAmount, budgetSuggestion.maxBudget.microAmount, budgetSuggestion.minCpc.microAmount, budgetSuggestion.maxCpc.microAmount, budgetSuggestion.cpm.microAmount, budgetSuggestion.cpc.microAmount, budgetSuggestion.impressions); if (budgetSuggestion.budgetQuantiles != null && budgetSuggestion.budgetQuantiles.Length > 0) { int quantileCount = 0; Console.WriteLine(" Budget quantiles:"); foreach (Money budgetQuantile in budgetSuggestion.budgetQuantiles) { Console.WriteLine(" {0}) {1}", ++quantileCount, budgetQuantile.microAmount); } } else { Console.WriteLine(" No budget quantiles found on budget suggestion"); } } catch (Exception e) { throw new System.ApplicationException("Failed to get budget suggestion.", e); } }