Package com.google.api.ads.dfp.axis.v201306

Examples of com.google.api.ads.dfp.axis.v201306.Date


    if (contentBrowseCustomTargetingKeyId == 0) {
      throw new RuntimeException("Your network does not have content categories enabled.");     
    }

    // Create a statement to select the categories matching the name comedy.
    Statement categoryFilterStatement = new StatementBuilder()
        .where("customTargetingKeyId = :contentBrowseCustomTargetingKeyId and name = :category")
        .limit(1)
        .withBindVariableValue(
            "contentBrowseCustomTargetingKeyId", contentBrowseCustomTargetingKeyId)
        .withBindVariableValue("category", "comedy").toStatement();
View Full Code Here


    // Default for total result set size.
    int totalResultSetSize = 0;

    do {
      // Get suggested ad units by statement.
      SuggestedAdUnitPage page =
          suggestedAdUnitService.getSuggestedAdUnitsByStatement(statementBuilder.toStatement());

      if (page.getResults() != null) {
        totalResultSetSize = page.getTotalResultSetSize();
        int i = page.getStartIndex();
        for (SuggestedAdUnit suggestedAdUnit : page.getResults()) {
          System.out.printf("%d) Suggsted ad unit with ID \"%s\" will be approved.\n", i++,
              suggestedAdUnit.getId());
        }
      }
View Full Code Here

    // Default for total result set size.
    int totalResultSetSize = 0;

    do {
      // Get suggested ad units by statement.
      SuggestedAdUnitPage page =
          suggestedAdUnitService.getSuggestedAdUnitsByStatement(statementBuilder.toStatement());

      if (page.getResults() != null) {
        totalResultSetSize = page.getTotalResultSetSize();
        int i = page.getStartIndex();
        for (SuggestedAdUnit suggestedAdUnit : page.getResults()) {
          System.out.printf("%d) Suggested ad unit with ID \"%s\", path \"%s\", "
              + "and number of requests \"%d\" was found.\n",
              i++, suggestedAdUnit.getId(), Joiner.on('/').join(suggestedAdUnit.getPath()),
              suggestedAdUnit.getNumRequests());
        }
View Full Code Here

    // Default for total result set size.
    int totalResultSetSize = 0;

    do {
      // Get suggested ad units by statement.
      SuggestedAdUnitPage page =
          suggestedAdUnitService.getSuggestedAdUnitsByStatement(statementBuilder.toStatement());

      if (page.getResults() != null) {
        totalResultSetSize = page.getTotalResultSetSize();
        int i = page.getStartIndex();
        for (SuggestedAdUnit suggestedAdUnit : page.getResults()) {
          System.out.printf("%d) Suggested ad unit with ID \"%s\", path \"%s\", "
              + "and number of requests \"%d\" was found.\n",
              i++, suggestedAdUnit.getId(), Joiner.on('/').join(suggestedAdUnit.getPath()),
              suggestedAdUnit.getNumRequests());
        }
View Full Code Here

  private static final String NUM_REQUESTS = "INSERT_NUMBER_OF_REQUESTS_HERE";

  public static void runExample(DfpServices dfpServices, DfpSession session, long numRequests)
      throws Exception {
    // Get the SuggestedAdUnitService.
    SuggestedAdUnitServiceInterface suggestedAdUnitService =
        dfpServices.get(session, SuggestedAdUnitServiceInterface.class);

    // Create a statement to only select suggested ad units that are highly
    // requested.
    StatementBuilder statementBuilder = new StatementBuilder()
        .where("numRequests >= :numRequests")
        .orderBy("id ASC")
        .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
        .withBindVariableValue("numRequests", numRequests);

    // Default for total result set size.
    int totalResultSetSize = 0;

    do {
      // Get suggested ad units by statement.
      SuggestedAdUnitPage page =
          suggestedAdUnitService.getSuggestedAdUnitsByStatement(statementBuilder.toStatement());

      if (page.getResults() != null) {
        totalResultSetSize = page.getTotalResultSetSize();
        int i = page.getStartIndex();
        for (SuggestedAdUnit suggestedAdUnit : page.getResults()) {
          System.out.printf("%d) Suggsted ad unit with ID \"%s\" will be approved.\n", i++,
              suggestedAdUnit.getId());
        }
      }

      statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
    } while (statementBuilder.getOffset() < totalResultSetSize);

    System.out.printf("Number of suggested ad units to be approved: %d\n", totalResultSetSize);

    if (totalResultSetSize > 0) {
      // Remove limit and offset from statement.
      statementBuilder.removeLimitAndOffset();

      // Create action.
      com.google.api.ads.dfp.axis.v201306.ApproveSuggestedAdUnit action =
          new com.google.api.ads.dfp.axis.v201306.ApproveSuggestedAdUnit();

      // Perform action.
      SuggestedAdUnitUpdateResult result = suggestedAdUnitService.performSuggestedAdUnitAction(
          action, statementBuilder.toStatement());

      if (result != null && result.getNumChanges() > 0) {
        System.out.printf(
            "Number of suggested ad units approved: %d\n", result.getNewAdUnitIds().length);
View Full Code Here

*/
public class GetAllSuggestedAdUnits {

  public static void runExample(DfpServices dfpServices, DfpSession session) throws Exception {
    // Get the SuggestedAdUnitService.
    SuggestedAdUnitServiceInterface suggestedAdUnitService =
        dfpServices.get(session, SuggestedAdUnitServiceInterface.class);

    // Create a statement to select all suggested ad units.
    StatementBuilder statementBuilder = new StatementBuilder()
        .orderBy("id ASC")
        .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);

    // Default for total result set size.
    int totalResultSetSize = 0;

    do {
      // Get suggested ad units by statement.
      SuggestedAdUnitPage page =
          suggestedAdUnitService.getSuggestedAdUnitsByStatement(statementBuilder.toStatement());

      if (page.getResults() != null) {
        totalResultSetSize = page.getTotalResultSetSize();
        int i = page.getStartIndex();
        for (SuggestedAdUnit suggestedAdUnit : page.getResults()) {
View Full Code Here

  private static final String NUM_REQUESTS = "INSERT_NUMBER_OF_REQUESTS_HERE";

  public static void runExample(DfpServices dfpServices, DfpSession session, long numRequests)
      throws Exception {
    // Get the SuggestedAdUnitService.
    SuggestedAdUnitServiceInterface suggestedAdUnitService =
        dfpServices.get(session, SuggestedAdUnitServiceInterface.class);

    // Create a statement to only select suggested ad units that have a high
    // request rate.
    StatementBuilder statementBuilder = new StatementBuilder()
        .where("numRequests >= :numRequests")
        .orderBy("id ASC")
        .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
        .withBindVariableValue("numRequests", numRequests);

    // Default for total result set size.
    int totalResultSetSize = 0;

    do {
      // Get suggested ad units by statement.
      SuggestedAdUnitPage page =
          suggestedAdUnitService.getSuggestedAdUnitsByStatement(statementBuilder.toStatement());

      if (page.getResults() != null) {
        totalResultSetSize = page.getTotalResultSetSize();
        int i = page.getStartIndex();
        for (SuggestedAdUnit suggestedAdUnit : page.getResults()) {
View Full Code Here

      // Create action.
      com.google.api.ads.dfp.axis.v201306.ApproveSuggestedAdUnit action =
          new com.google.api.ads.dfp.axis.v201306.ApproveSuggestedAdUnit();

      // Perform action.
      SuggestedAdUnitUpdateResult result = suggestedAdUnitService.performSuggestedAdUnitAction(
          action, statementBuilder.toStatement());

      if (result != null && result.getNumChanges() > 0) {
        System.out.printf(
            "Number of suggested ad units approved: %d\n", result.getNewAdUnitIds().length);
      } else {
        System.out.println("No suggested ad units were approved.");
      }
    }
  }
View Full Code Here

    // Get the TeamService.
    TeamServiceInterface teamService =
        dfpServices.get(session, TeamServiceInterface.class);

    // Create a read/write team.
    Team readWriteTeam = new Team();
    readWriteTeam.setName("Read/write team #" + new Random().nextInt(Integer.MAX_VALUE));
    readWriteTeam.setTeamAccessType(TeamAccessType.READ_WRITE);
    readWriteTeam.setHasAllCompanies(false);
    readWriteTeam.setHasAllInventory(false);

    // Create a read-only team.
    Team readOnlyTeam = new Team();
    readOnlyTeam.setName("Read-only team #" + new Random().nextInt(Integer.MAX_VALUE));
    readOnlyTeam.setTeamAccessType(TeamAccessType.READ_ONLY);
    readOnlyTeam.setHasAllCompanies(false);
    readOnlyTeam.setHasAllInventory(false);

    // Create the teams on the server.
    Team[] teams = teamService.createTeams(new Team[] {readWriteTeam, readOnlyTeam});

    for (Team createdTeam : teams) {
View Full Code Here

    // Get the TeamService.
    TeamServiceInterface teamService =
        dfpServices.get(session, TeamServiceInterface.class);

    // Get the team.
    Team team = teamService.getTeam(teamId);

    // Don't add ad unit if the team has all inventory already.
    if (!team.getHasAllInventory()) {
      List<String> adUnitIds = Lists.newArrayList();
      if (team.getAdUnitIds() != null) {
        Collections.addAll(adUnitIds, team.getAdUnitIds());
      }
      adUnitIds.add(adUnitId);
      team.setAdUnitIds(adUnitIds.toArray(new String[] {}));

      // Update the team on the server.
      Team[] teams = teamService.updateTeams(new Team[] {team});

      for (Team updatedTeam : teams) {
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfp.axis.v201306.Date

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.