Examples of TeamServiceInterface


Examples of com.google.api.ads.dfp.axis.v201311.TeamServiceInterface

  private static final String AD_UNIT_ID = "INSERT_AD_UNIT_ID_HERE";

  public static void runExample(
      DfpServices dfpServices, DfpSession session, long teamId, String adUnitId) throws Exception {
    // 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) {
        System.out.printf("Team with ID \"%d\" and name \"%s\" was updated.\n", updatedTeam.getId(),
            updatedTeam.getName());
      }
View Full Code Here

Examples of com.google.api.ads.dfp.axis.v201311.TeamServiceInterface

*/
public class GetAllTeams {

  public static void runExample(DfpServices dfpServices, DfpSession session) throws Exception {
    // Get the TeamService.
    TeamServiceInterface teamService =
        dfpServices.get(session, TeamServiceInterface.class);

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

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

    do {
      // Get teams by statement.
      TeamPage page = teamService.getTeamsByStatement(statementBuilder.toStatement());

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

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

      // 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

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

      // 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

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

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

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

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

      do {
        // Create a statement to get all teams.
        filterStatement.setQuery("LIMIT 500 OFFSET " + offset);

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

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

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

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

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

      // Set the ID of the team to get.
      Long teamId = Long.parseLong("INSERT_TEAM_ID_HERE");

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

      if (team != null) {
        System.out.println("Team with ID \"" + team.getId() + "\"and name \"" + team.getName()
            + "\" was found.");
      } else {
View Full Code Here

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

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

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

      // Set the ID of the ad unit to add to the teams.
      String adUnitId = "INSERT_AD_UNIT_ID_HERE";

      // Create a statement to select first 5 teams that aren't built-in.
      Statement filterStatement = new StatementBuilder("WHERE id > 0 LIMIT 5").toStatement();

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

      if (page.getResults() != null) {
        Team[] teams = page.getResults();

        // Update each local team object by adding the ad unit to it.
        for (Team team : teams) {
          // Don't add ad unit if the team has all inventory already.
          if (!team.getHasAllInventory()) {
            List<String> adUnitIds = new ArrayList<String>();
            if (team.getAdUnitIds() != null) {
              adUnitIds.addAll(Arrays.<String>asList(team.getAdUnitIds()));
            }
            adUnitIds.add(adUnitId);
            team.setAdUnitIds(adUnitIds.toArray(new String[] {}));
          }
        }

        // Update the teams on the server.
        teams = teamService.updateTeams(teams);

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

Examples of com.google.api.ads.dfp.v201211.TeamServiceInterface

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

      // Get the TeamService.
      TeamServiceInterface teamService = user.getService(DfpService.V201211.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

Examples of com.google.api.ads.dfp.v201211.TeamServiceInterface

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

      // Get the TeamService.
      TeamServiceInterface teamService = user.getService(DfpService.V201211.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

Examples of com.google.api.ads.dfp.v201211.TeamServiceInterface

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

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

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

      do {
        // Create a statement to get all teams.
        filterStatement.setQuery("LIMIT 500 OFFSET " + offset);

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

        if (page.getResults() != null) {
          int i = page.getStartIndex();
          for (Team team : page.getResults()) {
            System.out.println(i + ") Team with ID \"" + team.getId()
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.