/// <summary>
    /// Run the code example.
    /// </summary>
    /// <param name="user">The DFP user object running the code example.</param>
    public override void Run(DfpUser user) {
      // Get the CustomTargetingService.
      CustomTargetingService customTargetingService =
          (CustomTargetingService) user.GetService(DfpService.v201405.CustomTargetingService);

      // Set the ID of the custom targeting key to get custom targeting values
      // for.
      long customTargetingKeyId = long.Parse(_T("INSERT_CUSTOM_TARGETING_KEY_ID_HERE"));

      // Create a statement to only select custom targeting values for a given
      // key.
      StatementBuilder statementBuilder = new StatementBuilder()
          .Where("customTargetingKeyId = :customTargetingKeyId")
          .OrderBy("id ASC")
          .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
         .AddValue("customTargetingKeyId", customTargetingKeyId);

      // Set default for page.
      CustomTargetingValuePage page = new CustomTargetingValuePage();

      try {
        do {
          // Get custom targeting values by statement.
          page = customTargetingService.getCustomTargetingValuesByStatement(
              statementBuilder.ToStatement());

          if (page.results != null) {
            int i = page.startIndex;
            foreach (CustomTargetingValue customTargetingValue in page.results) {
              Console.WriteLine("{0}) Custom targeting value with ID \"{1}\", name \"{2}\", and " +
                  "display name \"{3}\" was found.", i, customTargetingValue.id,
                  customTargetingValue.name, customTargetingValue.displayName);
              i++;
            }
          }

          statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
        } while (statementBuilder.GetOffset() < page.totalResultSetSize);
        Console.WriteLine("Number of results found: {0}", page.totalResultSetSize);
      } catch (Exception ex) {
        Console.WriteLine("Failed to get custom targeting values. Exception " +
            "says \"{0}\"", ex.Message);
      }
    }
    /// <summary>
    /// Run the code example.
    /// </summary>
    /// <param name="user">The DFP user object running the code example.</param>
    public override void Run(DfpUser user) {
      // Get the CustomTargetingService.
      CustomTargetingService customTargetingService =
          (CustomTargetingService) user.GetService(DfpService.v201405.CustomTargetingService);

      // Create a statement to get all custom targeting keys.
      StatementBuilder keyStatementBuilder = new StatementBuilder()
          .OrderBy("id ASC")
          .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);

      // Set default for page.
      CustomTargetingKeyPage keyPage = new CustomTargetingKeyPage();

      try {
        do {
          // Get custom targeting keys by statement.
          keyPage = customTargetingService.getCustomTargetingKeysByStatement(
              keyStatementBuilder.ToStatement());

          if (keyPage.results != null) {
            int i = keyPage.startIndex;
            foreach (CustomTargetingKey key in keyPage.results) {
              Console.WriteLine("{0}) Custom targeting key with ID \"{1}\", name \"{2}\", " +
                  "display name \"{3}\", and type \"{4}\" was found.", i, key.id, key.name,
                  key.displayName, key.type);

              // Create a statement to get all custom targeting values for a
              // custom targeting key (required) by its ID.
              StatementBuilder valueStatementBuilder = new StatementBuilder()
                  .Where("customTargetingKeyId = :customTargetingKeyId")
                  .OrderBy("id ASC")
                  .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
                  .AddValue("customTargetingKeyId", key.id);

              // Set default for page.
              CustomTargetingValuePage valuePage = new CustomTargetingValuePage();

              do {
                // Get custom targeting values by statement.
                valuePage = customTargetingService.getCustomTargetingValuesByStatement(
                    valueStatementBuilder.ToStatement());

                if (valuePage.results != null) {
                  int j = valuePage.startIndex;
                  foreach (CustomTargetingValue value in valuePage.results) {
                    Console.WriteLine("\t{0}) Custom targeting value with ID \"{1}\", name " +
                        "\"{2}\", and display name \"{3}\" was found.", j, value.id, value.name,
                        value.displayName);
                    j++;
                  }
                }
                valueStatementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
              } while (valueStatementBuilder.GetOffset() < valuePage.totalResultSetSize);
              i++;
            }
          }
          keyStatementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
        } while (keyStatementBuilder.GetOffset() < keyPage.totalResultSetSize);
        Console.WriteLine("Number of results found: {0}", keyPage.totalResultSetSize);
      } catch (Exception ex) {
        Console.WriteLine("Failed to get custom targeting keys and the values. Exception " +
            "says \"{0}\"", ex.Message);
      }
    }