Package com.google.api.ads.dfp.v201208

Examples of com.google.api.ads.dfp.v201208.Location


      // Get DfpUser from "~/dfp.properties".
      DfpUser user = new DfpUser();

      // Get the SuggestedAdUnitService.
      SuggestedAdUnitServiceInterface suggestedAdUnitService =
          user.getService(DfpService.V201208.SUGGESTED_AD_UNIT_SERVICE);

      // Set the ID of the suggested ad unit to get.
      String suggestedAdUnitId = "INSERT_SUGGESTED_AD_UNIT_ID_HERE";

      // Get the suggested ad unit.
      SuggestedAdUnit suggestedAdUnit =
          suggestedAdUnitService.getSuggestedAdUnit(suggestedAdUnitId);

      if (suggestedAdUnit != null) {
        System.out.println("Suggested ad unit with ID \"" + suggestedAdUnit.getId()
            + "\", and number of requests \"" + suggestedAdUnit.getNumRequests()
            + "\" was found.");
View Full Code Here


      // Get DfpUser from "~/dfp.properties".
      DfpUser user = new DfpUser();

      // Get the SuggestedAdUnitService.
      SuggestedAdUnitServiceInterface suggestedAdUnitService =
          user.getService(DfpService.V201208.SUGGESTED_AD_UNIT_SERVICE);

      // Create statement to select all suggested ad units with 50 or more
      // requests.
      Statement filterStatement =
          new StatementBuilder("WHERE numRequests >= :numRequests").putValue("numRequests", 50L)
              .toStatement();

      // Get suggested ad units by statement.
      SuggestedAdUnitPage page =
          suggestedAdUnitService.getSuggestedAdUnitsByStatement(filterStatement);

      if (page.getResults() != null) {
        int i = page.getStartIndex();

        for (SuggestedAdUnit suggestedAdUnit : page.getResults()) {
          System.out.println(i + ") Suggested ad unit with ID \"" + suggestedAdUnit.getId()
              + "\" and number of requests  \"" + suggestedAdUnit.getNumRequests()
              + "\" will be approved.");
          i++;
        }

        System.out.println("Number of suggested ad units to be approved: "
            + page.getTotalResultSetSize());

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

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

        // Display results.
        if (result != null && result.getNumChanges() > 0) {
          System.out.println("Number of suggested ad units approved: " + result.getNumChanges());
        } else {
View Full Code Here

      // Get DfpUser from "~/dfp.properties".
      DfpUser user = new DfpUser();

      // Get the SuggestedAdUnitService.
      SuggestedAdUnitServiceInterface suggestedAdUnitService =
          user.getService(DfpService.V201208.SUGGESTED_AD_UNIT_SERVICE);

      // Create a statement to only select suggested ad units that have more
      // than 50 requests.
      Statement filterStatement =
          new StatementBuilder("WHERE numRequests > :numRequests LIMIT 500")
              .putValue("numRequests", 50).toStatement();

      // Get suggested ad units by statement.
      SuggestedAdUnitPage page =
          suggestedAdUnitService.getSuggestedAdUnitsByStatement(filterStatement);

      if (page.getResults() != null) {
        int i = page.getStartIndex();
        for (SuggestedAdUnit suggestedAdUnit : page.getResults()) {
          System.out.println(i + ") Suggested ad unit with ID \"" + suggestedAdUnit.getId()
View Full Code Here

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

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

        // Display results.
        if (result != null && result.getNumChanges() > 0) {
          System.out.println("Number of suggested ad units approved: " + result.getNumChanges());
        } else {
          System.out.println("No suggested ad units were approved.");
        }
      } else {
        System.out.println("No suggested ad units were approved.");
View Full Code Here

      // Create an array to store local team objects.
      Team[] teams = new Team[5];

      for (int i = 0; i < 5; i++) {
        Team team = new Team();
        team.setName("Team #" + i);
        team.setHasAllCompanies(false);
        team.setHasAllInventory(false);
        teams[i] = team;
      }

      // Create the teams on the server.
      teams = teamService.createTeams(teams);

      if (teams != null) {
        for (Team team : teams) {
          System.out.println("A team with ID \"" + team.getId() + "\", and name \""
              + team.getName() + "\" was created.");
        }
      } else {
        System.out.println("No teams created.");
      }
    } catch (Exception e) {
View Full Code Here

      Statement filterStatement =
          new StatementBuilder("ORDER BY name LIMIT 500")
              .toStatement();

      // Get teams by statement.
      TeamPage page = teamService.getTeamsByStatement(filterStatement);

      // Display results.
      if (page.getResults() != null) {
        int i = page.getStartIndex();
        for (Team team : page.getResults()) {

          System.out.println(i + ") Team with ID \"" + team.getId()
              + "\" and name \"" + team.getName()
              + "\" was found.");
          i++;
        }
      }

      System.out.println("Number of results found: " + page.getTotalResultSetSize());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

      // Get DfpUser from "~/dfp.properties".
      DfpUser user = new DfpUser();

      // Get the TeamService.
      TeamServiceInterface teamService = user.getService(DfpService.V201208.TEAM_SERVICE);

      // Create a statement to order teams by name.
      Statement filterStatement =
          new StatementBuilder("ORDER BY name LIMIT 500")
              .toStatement();

      // Get teams by statement.
      TeamPage page = teamService.getTeamsByStatement(filterStatement);

      // Display results.
      if (page.getResults() != null) {
        int i = page.getStartIndex();
        for (Team team : page.getResults()) {
View Full Code Here

      // Get DfpUser from "~/dfp.properties".
      DfpUser user = new DfpUser();

      // Get the TeamService.
      TeamServiceInterface teamService = user.getService(DfpService.V201208.TEAM_SERVICE);

      // Create an array to store local team objects.
      Team[] teams = new Team[5];

      for (int i = 0; i < 5; i++) {
        Team team = new Team();
        team.setName("Team #" + i);
        team.setHasAllCompanies(false);
        team.setHasAllInventory(false);
        teams[i] = team;
      }

      // Create the teams on the server.
      teams = teamService.createTeams(teams);

      if (teams != null) {
        for (Team team : teams) {
          System.out.println("A team with ID \"" + team.getId() + "\", and name \""
              + team.getName() + "\" was created.");
View Full Code Here

   */
  public static Value createValue(Object value) {
    if (value instanceof Value) {
      return (Value) value;
    } else if (value == null) {
      return new TextValue(null, null);
    } else {
      if (value instanceof Boolean) {
        return new BooleanValue(null, (Boolean) value);
      } else if (value instanceof Double) {
        return new NumberValue(null, value.toString());
      } else if (value instanceof String) {
        return new TextValue(null, (String) value);
      } else if (value instanceof Long) {
        return new NumberValue(null, value.toString());
      } else if (value instanceof DateTime) {
        return new DateTimeValue(null, (DateTime) value);
      } else {
View Full Code Here

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

        // Perform action.
        UpdateResult result =
            userTeamAssociationService.performUserTeamAssociationAction(action, filterStatement);

        // Display results.
        if (result != null && result.getNumChanges() > 0) {
          System.out.println("Number of teams that the user was removed from: "
              + result.getNumChanges());
        } else {
          System.out.println("No user team associations were deleted.");
        }
      }
    } catch (Exception e) {
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfp.v201208.Location

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.