/// <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 ThirdpartySlotService.
              ThirdPartySlotService thirdPartySlotService =
              (ThirdPartySlotService) user.GetService(DfpService.v201302.ThirdPartySlotService);

              // Sets defaults for page and filterStatement.
              ThirdPartySlotPage page = new ThirdPartySlotPage();
              Statement filterStatement = new Statement();
              int offset = 0;

              try {
            do {
              // Create a statement to get third party slots.
              filterStatement.query = "LIMIT 500 OFFSET " + offset.ToString();

              // Get third party slots by statement.
              page = thirdPartySlotService.getThirdPartySlotsByStatement(filterStatement);

              if (page.results != null) {
            int i = page.startIndex;
            foreach (ThirdPartySlot slot in page.results) {
              Console.WriteLine("{0}) Third party slot with ID \"{1}\" was found.", i, slot.id);
              i++;
            }
              }
              offset += 500;
            } while (offset < page.totalResultSetSize);

              } catch (Exception ex) {
            Console.WriteLine("Failed to get all third party slots. 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 ThirdpartySlotService.
      ThirdPartySlotService thirdPartySlotService =
          (ThirdPartySlotService) user.GetService(DfpService.v201302.ThirdPartySlotService);

      // Sets defaults for page and filterStatement.
      ThirdPartySlotPage page = new ThirdPartySlotPage();
      Statement filterStatement = new StatementBuilder("WHERE status = :status LIMIT 500 ")
          .AddValue("status", ThirdPartySlotStatus.ARCHIVED.ToString()).ToStatement();

      try {
        // Get third party slots by statement.
        page = thirdPartySlotService.getThirdPartySlotsByStatement(filterStatement);

        if (page.results != null) {
          int i = page.startIndex;
          foreach (ThirdPartySlot thirdPartySlot in page.results) {
            Console.WriteLine("{0}) Third party slot with ID \"{1}\" was found.",
                i, thirdPartySlot.id);
            i++;
          }
        }

        Console.WriteLine("Number of results found: " + page.totalResultSetSize);
      } catch (Exception ex) {
        Console.WriteLine("Failed to get third party slots. 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 ThirdpartySlotService.
              ThirdPartySlotService thirdPartySlotService =
              (ThirdPartySlotService) user.GetService(DfpService.v201302.ThirdPartySlotService);

              //Set the company that the third party slots to archive belong to.
              long companyId = long.Parse(_T("INSERT_COMPANY_ID_HERE"));

              // Create a statement to only select active third party slots.
              String statementText = "WHERE status = :status AND companyId = :companyId LIMIT 500";
              Statement filterStatement = new StatementBuilder("").AddValue("status",
              ThirdPartySlotStatus.ACTIVE.ToString()).AddValue("companyId", companyId).ToStatement();

              // Set defaults for page and offset.
              ThirdPartySlotPage page = new ThirdPartySlotPage();
              int offset = 0;
              List<string> thirdPartySlotIds = new List<string>();

              try {
            do {
              // Create a statement to page through active third party slots.
              filterStatement.query = statementText + " OFFSET " + offset;

              // Get third party slots by statement.
              page = thirdPartySlotService.getThirdPartySlotsByStatement(filterStatement);

              if (page.results != null) {
            foreach (ThirdPartySlot thirdPartySlot in page.results) {
              Console.WriteLine("Third party slot with ID \"{0}\" will be archived.",
                  thirdPartySlot.id);
              thirdPartySlotIds.Add(thirdPartySlot.id.ToString());
            }
              }

              offset += 500;
            } while (offset < page.totalResultSetSize);

            Console.WriteLine("Number of third party slots to be archived: " + thirdPartySlotIds.Count);

            if (thirdPartySlotIds.Count > 0) {
              // Modify statement for action.
              filterStatement.query = "WHERE id IN (" + string.Join(",", thirdPartySlotIds.ToArray()) +
              ")";

              // Create action.
              ArchiveThirdPartySlots action = new ArchiveThirdPartySlots();

              // Perform action.
              UpdateResult result = thirdPartySlotService.performThirdPartySlotAction(action,
              filterStatement);

              // Display results.
              if (result != null && result.numChanges > 0) {
            Console.WriteLine("Number of third party slots archived: " + result.numChanges);
              } else {
            Console.WriteLine("No third party slots were archived.");
              }
            }
              } catch (Exception ex) {
            Console.WriteLine("Failed to archive slots. Exception says \"{0}\"", ex.Message);
              }
        }