/// <summary>
    /// Runs the code example.
    /// </summary>
    /// <param name="user">The AdWords user.</param>
    public void Run(AdWordsUser user) {
      // Get the AlertService.
      AlertService alertService = (AlertService) user.GetService(
          AdWordsService.v201402.AlertService);

      // Create the selector.
      AlertSelector selector = new AlertSelector();

      // Create the alert query.
      AlertQuery query = new AlertQuery();
      query.filterSpec = FilterSpec.ALL;
      query.clientSpec = ClientSpec.ALL;
      query.triggerTimeSpec = TriggerTimeSpec.ALL_TIME;
      query.severities = new AlertSeverity[] {AlertSeverity.GREEN, AlertSeverity.YELLOW,
          AlertSeverity.RED};

      // Enter all possible values of AlertType to get all alerts. If you are
      // interested only in specific alert types, then you may also do it as
      // follows:
      // query.types = new AlertType[] {AlertType.CAMPAIGN_ENDING,
      //     AlertType.CAMPAIGN_ENDED};
      query.types = (AlertType[]) Enum.GetValues(typeof(AlertType));
      selector.query = query;

      // Set paging for selector.
      selector.paging = new Paging();

      int offset = 0;
      int pageSize = 500;

      AlertPage page = new AlertPage();

      try {
        do {
          // Get account alerts.
          selector.paging.startIndex = offset;
          selector.paging.numberResults = pageSize;

          page = alertService.get(selector);

          // Display the results.
          if (page != null && page.entries != null) {
            int i = offset;
            foreach (Alert alert in page.entries) {
              Console.WriteLine("{0}) Customer Id is {1:###-###-####}, Alert type is '{2}', " +
                  "Severity is {3}", i + 1, alert.clientCustomerId, alert.alertType,
                  alert.alertSeverity);
              for (int j = 0; j < alert.details.Length; j++) {
                Console.WriteLine("  - Triggered at {0}", alert.details[j].triggerTime);
              }
              i++;
            }
          }
          offset += pageSize;
        } while (offset < page.totalNumEntries);
        Console.WriteLine("Number of alerts found: {0}", page.totalNumEntries);
      } catch (Exception ex) {
        throw new System.ApplicationException("Failed to retrieve alerts.", ex);
      }
    }
 public virtual AlertPage get(AlertSelector selector) {
   object[] results = this.Invoke("get", new object[] { selector });
   return ((AlertPage) (results[0]));
 }