/// <summary> /// Runs the code example. /// </summary> /// <param name="user">The AdWords user.</param> /// <param name="campaignId">The campaign ID.</param> public void Run(AdWordsUser user, long campaignId) { // Get the VideoTargetingGroupCriterionService. VideoTargetingGroupCriterionService videoTargetingGroupCriterionService = (VideoTargetingGroupCriterionService)user.GetService( AdWordsService.v201406.VideoTargetingGroupCriterionService); int offset = 0; TargetingGroupCriterionPage page = new TargetingGroupCriterionPage(); try { // Create selector. TargetingGroupCriterionSelector selector = new TargetingGroupCriterionSelector(); selector.criteriaDimension = CriteriaDimension.KEYWORD; selector.campaignIds = new long[] { campaignId }; selector.paging = new Paging(); do { selector.paging.startIndex = offset; selector.paging.numberResults = PAGE_SIZE; // Get all keywords. page = videoTargetingGroupCriterionService.get(selector); // Display keywords. if (page != null && page.entries != null) { int i = offset; foreach (TargetingGroupCriterion targetingGroupCriterion in page.entries) { String negative = (targetingGroupCriterion is NegativeTargetingGroupCriterion) ? " (negative)" : ""; BaseKeyword keyword = (BaseKeyword)targetingGroupCriterion.criterion; Console.WriteLine("{0}) Criterion {1} ID {2}, targeting group ID {3} and " + "text '{4}'\n", i, negative, keyword.id, targetingGroupCriterion.targetingGroupId, keyword.text); i++; } } offset += PAGE_SIZE; } while (offset < page.totalNumEntries); Console.WriteLine("Number of keywords found: {0}", page.totalNumEntries); } catch (Exception ex) { throw new System.ApplicationException("Failed to get keywords.", ex); } }
// TODO: this needs to go away in the resolver. private void CompileBaseKeyword(ParserContext parser, ByteBuffer buffer, BaseKeyword baseKeyword, bool outputUsed) { throw new ParserException(baseKeyword, "Cannot have a reference to 'base' without invoking a field."); }