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

Examples of com.google.api.ads.dfp.axis.v201211.ResultSet


  public static List<AdUnit> runExample(DfpServices dfpServices, DfpSession session)
      throws Exception {
    List<AdUnit> adUnits = Lists.newArrayList();

    // Get the InventoryService.
    InventoryServiceInterface inventoryService =
        dfpServices.get(session, InventoryServiceInterface.class);

    // Create a statement to select all ad units.
    StatementBuilder statementBuilder = new StatementBuilder()
        .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);

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

    do {
      // Get ad units by statement.
      AdUnitPage page = inventoryService.getAdUnitsByStatement(statementBuilder.toStatement());

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


  static final String AD_UNIT_ID = "INSERT_AD_UNIT_ID_HERE";

  public static void runExample(DfpServices dfpServices, DfpSession session, String adUnitId)
      throws Exception {
    // Get the InventoryService.
    InventoryServiceInterface inventoryService =
        dfpServices.get(session, InventoryServiceInterface.class);

    // Get the ad unit.
    AdUnit adUnit = inventoryService.getAdUnit(adUnitId);

    // Add the size 468x60 to the ad unit.
    List<AdUnitSize> adUnitSizes = Lists.<AdUnitSize>newArrayList(adUnit.getAdUnitSizes());

    Size size = new Size();
    size.setWidth(468);
    size.setHeight(60);

    AdUnitSize adUnitSize = new AdUnitSize();
    adUnitSize.setSize(size);
    adUnitSize.setEnvironmentType(EnvironmentType.BROWSER);
    adUnitSizes.add(adUnitSize);

    adUnit.setAdUnitSizes(adUnitSizes.toArray(new AdUnitSize[] {}));

    // Update the ad units on the server.
    AdUnit[] adUnits = inventoryService.updateAdUnits(new AdUnit[] {adUnit});

    for (AdUnit updatedAdUnit : adUnits) {
      List<String> adUnitSizeStrings = Lists.newArrayList();
      for (AdUnitSize updatedAdUnitSize : updatedAdUnit.getAdUnitSizes()) {
        adUnitSizeStrings.add(String.format("{%s x %s}", updatedAdUnitSize.getSize().getWidth(),
View Full Code Here

  public static void runExample(DfpServices dfpServices, DfpSession session) throws Exception {
    List<AdUnit> adUnits = GetAllAdUnits.runExample(dfpServices, session);

    // Get the InventoryService.
    InventoryServiceInterface inventoryService =
        dfpServices.get(session, InventoryServiceInterface.class);

    // Get the NetworkService.
    NetworkServiceInterface networkService =
        dfpServices.get(session, NetworkServiceInterface.class);

    // Get the effective root ad unit.
    AdUnit effectiveRootAdUnit =
        inventoryService.getAdUnit(
            networkService.getCurrentNetwork().getEffectiveRootAdUnitId());

    buildAndDisplayAdUnitTree(effectiveRootAdUnit, adUnits);
  }
View Full Code Here

*/
public class GetMobileAdUnitSizes {

  public static void runExample(DfpServices dfpServices, DfpSession session) throws Exception {
    // Get the InventoryService.
    InventoryServiceInterface inventoryService =
        dfpServices.get(session, InventoryServiceInterface.class);

    // Create a statement to select ad unit sizes available for the mobile
    // platform.
    StatementBuilder statementBuilder = new StatementBuilder()
        .where("targetPlatform = :targetPlatform")
        .withBindVariableValue("targetPlatform", TargetPlatform.MOBILE.toString());

    // Get all ad unit sizes.
    AdUnitSize[] adUnitSizes =
        inventoryService.getAdUnitSizesByStatement(statementBuilder.toStatement());

    if (adUnitSizes != null) {
      for (int i = 0; i < adUnitSizes.length; i++) {
        AdUnitSize adUnitSize = adUnitSizes[i];
        System.out.printf("%s) Web ad unit size of dimensions %s was found.\n", i,
View Full Code Here

        .build();

    DfpServices dfpServices = new DfpServices();

    // Get the NetworkService.
    NetworkServiceInterface networkService =
        dfpServices.get(session, NetworkServiceInterface.class);

    // Set the parent ad unit's ID for all ad units to be created under.
    String parentId = networkService.getCurrentNetwork().getEffectiveRootAdUnitId();

    runExample(dfpServices, session, parentId);
  }
View Full Code Here

        .build();

    DfpServices dfpServices = new DfpServices();

    // Get the NetworkService.
    NetworkServiceInterface networkService =
        dfpServices.get(session, NetworkServiceInterface.class);

    // Set the parent ad unit's ID for all children ad units to be fetched from.
    String parentAdUnitId = networkService.getCurrentNetwork().getEffectiveRootAdUnitId();

    runExample(dfpServices, session, parentAdUnitId);
  }
View Full Code Here

    // Get the InventoryService.
    InventoryServiceInterface inventoryService =
        dfpServices.get(session, InventoryServiceInterface.class);

    // Get the NetworkService.
    NetworkServiceInterface networkService =
        dfpServices.get(session, NetworkServiceInterface.class);

    // Set the parent ad unit's ID for all children ad units to be fetched from.
    String parentAdUnitId = networkService.getCurrentNetwork().getEffectiveRootAdUnitId();

    // Create a statement to select ad units under the parent ad unit.
    StatementBuilder statementBuilder = new StatementBuilder()
        .where("parentId = :parentId")
        .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
View Full Code Here

    // Get the InventoryService.
    InventoryServiceInterface inventoryService =
        dfpServices.get(session, InventoryServiceInterface.class);

    // Get the NetworkService.
    NetworkServiceInterface networkService =
        dfpServices.get(session, NetworkServiceInterface.class);

    // Get the effective root ad unit.
    AdUnit effectiveRootAdUnit =
        inventoryService.getAdUnit(
            networkService.getCurrentNetwork().getEffectiveRootAdUnitId());

    buildAndDisplayAdUnitTree(effectiveRootAdUnit, adUnits);
  }
View Full Code Here

*/
public class GetAllNetworks {

  public static void runExample(DfpServices dfpServices, DfpSession session) throws Exception {
    // Get the NetworkService.
    NetworkServiceInterface networkService =
        dfpServices.get(session, NetworkServiceInterface.class);

    // Get all networks that you have access to with the current login
    // credentials.
    Network[] networks = networkService.getAllNetworks();

    int i = 0;
    for (Network network : networks) {
      System.out.printf(
          "%s) Network with network code \"%s\" and display name \"%s\" was found.\n",
View Full Code Here

      if (value instanceof Boolean) {
        BooleanValue booleanValue = new BooleanValue();
        booleanValue.setValue((Boolean) value);
        return booleanValue;
      } else if (value instanceof Double || value instanceof Long || value instanceof Integer) {
        NumberValue numberValue = new NumberValue();
        numberValue.setValue(value.toString());
        return numberValue;
      } else if (value instanceof String) {
        TextValue textValue = new TextValue();
        textValue.setValue((String) value);
        return textValue;
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfp.axis.v201211.ResultSet

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.