Package com.google.api.ads.adwords.axis.v201309.cm

Examples of com.google.api.ads.adwords.axis.v201309.cm.AdGroupCriterion


        adWordsServices.get(session, CampaignFeedServiceInterface.class);

    RequestContextOperand requestContextOperand = new RequestContextOperand();
    requestContextOperand.setContextType(RequestContextOperandContextType.FEED_ITEM_ID);

    Function feedItemFunction = new Function();
    feedItemFunction.setLhsOperand(new FunctionArgumentOperand[] {requestContextOperand});
    feedItemFunction.setOperator(FunctionOperator.IN);

    List<FunctionArgumentOperand> operands = new ArrayList<FunctionArgumentOperand>();
    for (long feedItemId : siteLinksData.siteLinkFeedItemIds) {
      ConstantOperand constantOperand = new ConstantOperand();
      constantOperand.setLongValue(feedItemId);
      constantOperand.setType(ConstantOperandConstantType.LONG);
      operands.add(constantOperand);
    }
    feedItemFunction.setRhsOperand(operands.toArray(new FunctionArgumentOperand[operands.size()]));

    // Optional: to target to a platform, define a function and 'AND' it with
    // the feed item ID link:
    RequestContextOperand platformRequestContextOperand = new RequestContextOperand();
    platformRequestContextOperand.setContextType(RequestContextOperandContextType.DEVICE_PLATFORM);

    ConstantOperand platformOperand = new ConstantOperand();
    platformOperand.setStringValue("Mobile");
    platformOperand.setType(ConstantOperandConstantType.STRING);

    Function platformFunction = new Function();
    platformFunction.setLhsOperand(new FunctionArgumentOperand[] {platformRequestContextOperand});
    platformFunction.setOperator(FunctionOperator.EQUALS);
    platformFunction.setRhsOperand(new FunctionArgumentOperand[] {platformOperand});

    // Combine the two functions using an AND operation.
    FunctionOperand feedItemFunctionOperand = new FunctionOperand();
    feedItemFunctionOperand.setValue(feedItemFunction);

    FunctionOperand platformFunctionOperand = new FunctionOperand();
    platformFunctionOperand.setValue(platformFunction);

    Function combinedFunction = new Function();
    combinedFunction.setOperator(FunctionOperator.AND);
    combinedFunction.setLhsOperand(
        new FunctionArgumentOperand[] {feedItemFunctionOperand, platformFunctionOperand});

    CampaignFeed campaignFeed = new CampaignFeed();
    campaignFeed.setFeedId(siteLinksData.siteLinksFeedId);
    campaignFeed.setCampaignId(campaignId);
View Full Code Here


    platformFunction.setLhsOperand(new FunctionArgumentOperand[] {platformRequestContextOperand});
    platformFunction.setOperator(FunctionOperator.EQUALS);
    platformFunction.setRhsOperand(new FunctionArgumentOperand[] {platformOperand});

    // Combine the two functions using an AND operation.
    FunctionOperand feedItemFunctionOperand = new FunctionOperand();
    feedItemFunctionOperand.setValue(feedItemFunction);

    FunctionOperand platformFunctionOperand = new FunctionOperand();
    platformFunctionOperand.setValue(platformFunction);

    Function combinedFunction = new Function();
    combinedFunction.setOperator(FunctionOperator.AND);
    combinedFunction.setLhsOperand(
        new FunctionArgumentOperand[] {feedItemFunctionOperand, platformFunctionOperand});
View Full Code Here

    // Get the MediaService.
    MediaServiceInterface mediaService =
        adWordsServices.get(session, MediaServiceInterface.class);

    // Create image.
    Image image = new Image();
    image.setData(
        com.google.api.ads.common.lib.utils.Media.getMediaDataFromUrl("http://goo.gl/HJM3L"));
    image.setType(MediaMediaType.IMAGE);

    Media[] media = new Media[] {image};

    // Upload image.
    Media[] result = mediaService.upload(media);

    // Display images.
    image = (Image) result[0];
    Map<MediaSize, Dimensions> dimensions = Maps.toMap(image.getDimensions());
    System.out.println("Image with id '" + image.getMediaId() + "', dimensions '"
        + dimensions.get(MediaSize.FULL).getWidth() + "x"
        + dimensions.get(MediaSize.FULL).getHeight() + "', and MIME type '" + image.getMediaType()
        + "' was uploaded.");
  }
View Full Code Here

  public static void runExample(
      AdWordsServices adWordsServices, AdWordsSession session, String[] locationNames)
      throws Exception {
    // Get the LocationCriterionService.
    LocationCriterionServiceInterface locationCriterionService =
        adWordsServices.get(session, LocationCriterionServiceInterface.class);

    Selector selector = new Selector();
    selector.setFields(new String[] {"Id", "LocationName", "CanonicalName", "DisplayType",
        "ParentLocations", "Reach", "TargetingStatus"});

    selector.setPredicates(new Predicate[] {
        // Location names must match exactly, only EQUALS and IN are
        // supported.
        new Predicate("LocationName", PredicateOperator.IN, locationNames),
        // Set the locale of the returned location names.
        new Predicate("Locale", PredicateOperator.EQUALS, new String[] {"en"})});

    // Make the get request.
    LocationCriterion[] locationCriteria = locationCriterionService.get(selector);

    // Display the resulting location criteria.
    for (LocationCriterion locationCriterion : locationCriteria) {
      String parentString =
          getParentLocationString(locationCriterion.getLocation().getParentLocations());
View Full Code Here

    // Create predicates.
    Predicate typePredicate =
        new Predicate("Type", PredicateOperator.IN, new String[] {"IMAGE", "VIDEO"});
    selector.setPredicates(new Predicate[] {typePredicate});

    MediaPage page = null;

    do {
      // Get all images.
      page = mediaService.get(selector);

      // Display images.
      if (page != null && page.getEntries() != null) {
        for (Media media : page.getEntries()) {
          Map<MediaSize, Dimensions> dimensions = Maps.toMap(media.getDimensions());
          System.out.println("Media with id '" + media.getMediaId() +
              (!dimensions.isEmpty()
                  ? "', dimensions '" + dimensions.get(MediaSize.FULL).getWidth() + "x"
                    + dimensions.get(MediaSize.FULL).getHeight()
                  : "") + "', and MIME type '"
              + media.getMediaType() + "' was found.");
        }
      } else {
        System.out.println("No images/videos were found.");
      }
      offset += PAGE_SIZE;
      selector.getPaging().setStartIndex(offset);
    } while (offset < page.getTotalNumEntries());
  }
View Full Code Here

  }

  public static void runExample(
      AdWordsServices adWordsServices, AdWordsSession session) throws Exception {
    // Get the MediaService.
    MediaServiceInterface mediaService =
        adWordsServices.get(session, MediaServiceInterface.class);

    // Create image.
    Image image = new Image();
    image.setData(
        com.google.api.ads.common.lib.utils.Media.getMediaDataFromUrl("http://goo.gl/HJM3L"));
    image.setType(MediaMediaType.IMAGE);

    Media[] media = new Media[] {image};

    // Upload image.
    Media[] result = mediaService.upload(media);

    // Display images.
    image = (Image) result[0];
    Map<MediaSize, Dimensions> dimensions = Maps.toMap(image.getDimensions());
    System.out.println("Image with id '" + image.getMediaId() + "', dimensions '"
View Full Code Here

  }

  public static void runExample(
      AdWordsServices adWordsServices, AdWordsSession session) throws Exception {
    // Get the MediaService.
    MediaServiceInterface mediaService =
        adWordsServices.get(session, MediaServiceInterface.class);

    int offset = 0;

    // Create selector.
    Selector selector = new Selector();
    selector.setFields(new String[] {"MediaId", "Width", "Height", "MimeType"});
    selector.setPaging(new Paging(offset, PAGE_SIZE));
    selector.setOrdering(new OrderBy[] {new OrderBy("MediaId", SortOrder.ASCENDING)});
    selector.setPaging(new Paging(offset, PAGE_SIZE));

    // Create predicates.
    Predicate typePredicate =
        new Predicate("Type", PredicateOperator.IN, new String[] {"IMAGE", "VIDEO"});
    selector.setPredicates(new Predicate[] {typePredicate});

    MediaPage page = null;

    do {
      // Get all images.
      page = mediaService.get(selector);

      // Display images.
      if (page != null && page.getEntries() != null) {
        for (Media media : page.getEntries()) {
          Map<MediaSize, Dimensions> dimensions = Maps.toMap(media.getDimensions());
View Full Code Here

    System.out.printf("New upload conversion type with name = '%s' and ID = %d was created.\n",
        newUploadConversion.getName(), newUploadConversion.getId());

    // Associate offline conversions with the upload conversion we created.
    OfflineConversionFeed feed = new OfflineConversionFeed();
    feed.setConversionName(conversionName);
    feed.setConversionTime(conversionTime);
    feed.setConversionValue(conversionValue);
    feed.setGoogleClickId(gClid);

    OfflineConversionFeedOperation offlineConversionOperation =
        new OfflineConversionFeedOperation();
    offlineConversionOperation.setOperator(Operator.ADD);
    offlineConversionOperation.setOperand(feed);

    OfflineConversionFeedReturnValue offlineConversionReturnValue = offlineConversionFeedService
        .mutate(new OfflineConversionFeedOperation[] {offlineConversionOperation});

    OfflineConversionFeed newFeed = offlineConversionReturnValue.getValue(0);

    System.out.printf(
        "Uploaded offline conversion value of '%s' for Google Click ID = '%s' to '%s'.\n",
        newFeed.getConversionValue(), newFeed.getGoogleClickId(), newFeed.getConversionName());
  }
View Full Code Here

    feed.setConversionName(conversionName);
    feed.setConversionTime(conversionTime);
    feed.setConversionValue(conversionValue);
    feed.setGoogleClickId(gClid);

    OfflineConversionFeedOperation offlineConversionOperation =
        new OfflineConversionFeedOperation();
    offlineConversionOperation.setOperator(Operator.ADD);
    offlineConversionOperation.setOperand(feed);

    OfflineConversionFeedReturnValue offlineConversionReturnValue = offlineConversionFeedService
        .mutate(new OfflineConversionFeedOperation[] {offlineConversionOperation});

    OfflineConversionFeed newFeed = offlineConversionReturnValue.getValue(0);
View Full Code Here

    OfflineConversionFeedOperation offlineConversionOperation =
        new OfflineConversionFeedOperation();
    offlineConversionOperation.setOperator(Operator.ADD);
    offlineConversionOperation.setOperand(feed);

    OfflineConversionFeedReturnValue offlineConversionReturnValue = offlineConversionFeedService
        .mutate(new OfflineConversionFeedOperation[] {offlineConversionOperation});

    OfflineConversionFeed newFeed = offlineConversionReturnValue.getValue(0);

    System.out.printf(
        "Uploaded offline conversion value of '%s' for Google Click ID = '%s' to '%s'.\n",
        newFeed.getConversionValue(), newFeed.getGoogleClickId(), newFeed.getConversionName());
  }
View Full Code Here

TOP

Related Classes of com.google.api.ads.adwords.axis.v201309.cm.AdGroupCriterion

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.