Creates the expanded Dynamic Search Ad.
420376
private static void createExpandedDSA(
      AdWordsServicesInterface adWordsServices, AdWordsSession session, AdGroup adGroup)
      throws ApiException, RemoteException {
    // Get the AdGroupAdService.
    AdGroupAdServiceInterface adGroupAdService =
        adWordsServices.get(session, AdGroupAdServiceInterface.class);

    // Create the expanded Dynamic Search Ad. This ad will have its headline and final URL
    // auto-generated at serving time according to domain name specific information provided
    // by DynamicSearchAdsSetting at the campaign level.
    ExpandedDynamicSearchAd expandedDSA = new ExpandedDynamicSearchAd();
    // Set the ad description.
    expandedDSA.setDescription("Buy your tickets now!");
    expandedDSA.setDescription2("Discount ends soon");

    // Create the ad group ad.
    AdGroupAd adGroupAd = new AdGroupAd();
    adGroupAd.setAdGroupId(adGroup.getId());
    adGroupAd.setAd(expandedDSA);

    // Optional: Set the status.
    adGroupAd.setStatus(AdGroupAdStatus.PAUSED);

    // Create the operation.
    AdGroupAdOperation operation = new AdGroupAdOperation();
    operation.setOperator(Operator.ADD);
    operation.setOperand(adGroupAd);

    // Create the ad.
    AdGroupAd newAdGroupAd =
        adGroupAdService.mutate(new AdGroupAdOperation[] {operation}).getValue(0);
    ExpandedDynamicSearchAd newExpandedDSA = (ExpandedDynamicSearchAd) newAdGroupAd.getAd();
    System.out.printf(
        "Expanded Dynamic Search Ad with ID %d and description '%s' and description 2 '%s' was "
            + "added.%n",
        newExpandedDSA.getId(), newExpandedDSA.getDescription(), newExpandedDSA.getDescription2());
  }
863484
private static function addDsaTargeting(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        $adGroupId,
        $dsaPageUrlLabel
    ) {
        $adGroupCriterionService = $adWordsServices->get($session, AdGroupCriterionService::class);

        // Create a webpage criterion.
        $webpage = new Webpage();

        $parameter = new WebpageParameter();
        $parameter->setCriterionName('Test criterion');
        $webpage->setParameter($parameter);

        // Add a condition for label=specified_label_name.
        $condition = new WebpageCondition();
        $condition->setOperand(WebpageConditionOperand::CUSTOM_LABEL);
        $condition->setArgument($dsaPageUrlLabel);
        $parameter->setConditions([$condition]);

        $criterion = new BiddableAdGroupCriterion();
        $criterion->setAdGroupId($adGroupId);
        $criterion->setCriterion($webpage);

        // Set a custom bid for this criterion.
        $biddingStrategyConfiguration = new BiddingStrategyConfiguration();

        $cpcBid = new CpcBid();
        $money = new Money();
        $money->setMicroAmount(1500000);
        $cpcBid->setBid($money);
        $biddingStrategyConfiguration->setBids([$cpcBid]);

        $criterion->setBiddingStrategyConfiguration($biddingStrategyConfiguration);

        $operation = new AdGroupCriterionOperation();
        $operation->setOperand($criterion);
        $operation->setOperator(Operator::ADD);

        // Create ad group criterion on the server and print out some information.
        $result = $adGroupCriterionService->mutate([$operation]);
        $criterion = $result->getValue()[0];
        printf(
            "Web page criterion with ID %d and status '%s' was created.\n",
            $criterion->getCriterion()->getId(),
            $criterion->getUserStatus()
        );
    }
380490
private static function createDynamicDisplayAdSettings(
        AdWordsServices $adWordsServices,
        AdWordsSession $session
    ) {
        $landscapeLogoImage = self::uploadImage(
            $adWordsServices,
            $session,
            'https://goo.gl/dEvQeF'
        );
        $dynamicSettings = new DynamicSettings();
        $dynamicSettings->setLandscapeLogoImage($landscapeLogoImage);
        $dynamicSettings->setPricePrefix('as low as');
        $dynamicSettings->setPromoText('Free shipping!');

        return $dynamicSettings;
    }
183497
public static MozuUrl addExtendedPropertiesUrl()
	{
		UrlFormatter formatter = new UrlFormatter("/api/commerce/carts/current/extendedproperties");
		return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
	}
1131130
public static ProductPartitionTree createAdGroupTree(AdWordsServicesInterface services,
      AdWordsSession session, Long adGroupId) throws ApiException, RemoteException {
    return new ProductPartitionTree(
        ProductPartitionTreeImpl.createAdGroupTree(services, session, adGroupId));
  }
1023248
@Override
	public <T> java.util.List<T> dynamicQuery(
		com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) {
		return _commercePriceListUserSegmentEntryRelLocalService.dynamicQuery(dynamicQuery);
	}
801876
private static AdGroupAd createAd(
      AdWordsServicesInterface services, AdWordsSession session, AdGroup adGroup)
      throws IOException {
    AdGroupAdServiceInterface adService = services.get(session, AdGroupAdServiceInterface.class);

    ResponsiveDisplayAd ad = new ResponsiveDisplayAd();

    // This ad format does not allow the creation of an image using the
    // Image.data field. An image must first be created using the MediaService,
    // and Image.mediaId must be populated when creating the ad.
    ad.setMarketingImage(uploadImage(services, session, "https://goo.gl/3b9Wfh"));

    ad.setShortHeadline("Travel");
    ad.setLongHeadline("Travel the World");
    ad.setDescription("Take to the air!");
    ad.setBusinessName("Interplanetary Cruises");
    ad.setFinalUrls(new String[] {"http://www.example.com/"});

    // Optional: Call to action text.
    // Valid texts: https://support.google.com/adwords/answer/7005917
    ad.setCallToActionText("Apply Now");

    // Optional: Set dynamic display ad settings, composed of landscape logo
    // image, promotion text, and price prefix.
    DynamicSettings dynamicDisplayAdSettings = createDynamicDisplayAdSettings(services, session);
    ad.setDynamicDisplayAdSettings(dynamicDisplayAdSettings);

    Image optionalImage = uploadImage(services, session, "https://goo.gl/mtt54n");

    // Optional: Create a logo image and set it to the ad.
    ad.setLogoImage(optionalImage);

    // Optional: Create a square marketing image and set it to the ad.
    ad.setSquareMarketingImage(optionalImage);

    // Whitelisted accounts only: Set color settings using hexadecimal values.
    // Set allowFlexibleColor to false if you want your ads to render by always
    // using your colors strictly.
    /*
    ad.setMainColor("#0000ff");
    ad.setAccentColor("#ffff00");
    ad.setAllowFlexibleColor(false);
    */

    // Whitelisted accounts only: Set the format setting that the ad will be
    // served in.
    /*
    ad.setFormatSetting(
        com.google.api.ads.adwords.axis.v201809.cm.DisplayAdFormatSetting.NON_NATIVE);
    */

    AdGroupAd adGroupAd = new AdGroupAd();
    adGroupAd.setAd(ad);
    adGroupAd.setAdGroupId(adGroup.getId());

    AdGroupAdOperation op = new AdGroupAdOperation();
    op.setOperand(adGroupAd);
    op.setOperator(Operator.ADD);

    AdGroupAdReturnValue result = adService.mutate(new AdGroupAdOperation[] {op});
    return result.getValue(0);
  }
28782
public void fillParams(CmsGallerySearchBean search) {

        m_localeSelection.setFormValue(search.getLocale(), false);
        m_searchInput.setFormValueAsString(search.getQuery());
        m_includeExpiredCheckBox.setChecked(search.isIncludeExpired());
        if (search.getDateCreatedStart() > 9) {
            m_dateCreatedStartDateBox.setValue(new Date(search.getDateCreatedStart()));
        }
        if (search.getDateCreatedEnd() > 0) {
            m_dateCreatedEndDateBox.setValue(new Date(search.getDateCreatedEnd()));
        }
        if (search.getDateModifiedStart() > 0) {
            m_dateModifiedStartDateBox.setValue(new Date(search.getDateModifiedStart()));
        }
        if (search.getDateModifiedEnd() > 0) {
            m_dateModifiedEndDateBox.setValue(new Date(search.getDateModifiedEnd()));
        }
        if (search.getScope() != null) {
            m_scopeSelection.setFormValue(search.getScope().name());
        }

    }
651263
function createSearchConfig(sFieldToSearch) {
		var oConfig = {
			fields: {},
			expand: true
		};

		oConfig.fields[sFieldToSearch] = {};
		return oConfig;
	}
395624
public static SearchRequest newLdaptiveSearchRequest(final String baseDn,
                                                         final SearchFilter filter) {
        return newLdaptiveSearchRequest(baseDn, filter, ReturnAttributes.ALL_USER.value(), ReturnAttributes.ALL_USER.value());
    }
826885
private static function updateCampaignDsaSetting(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        $campaignId,
        DSAFeedDetails $feedDetails
    ) {
        $campaignService = $adWordsServices->get($session, CampaignService::class);

        // Create selector.
        $selector = new Selector();
        $selector->setFields(['Id', 'Settings']);
        $selector->setPredicates(
            [new Predicate('CampaignId', PredicateOperator::IN, [$campaignId])]
        );

        $result = $campaignService->get($selector);
        if (empty($result->getEntries()) || $result->getTotalNumEntries() === 0) {
            throw new InvalidArgumentException(
                'No campaign found with ID: ' . $campaignId
            );
        }
        $campaign = $result->getEntries()[0];

        if ($campaign->getSettings() === null) {
            throw new InvalidArgumentException(
                'Campaign with ID ' . $campaignId . ' is not a DSA campaign.'
            );
        }

        $dsaSetting = null;
        foreach ($campaign->getSettings() as $setting) {
            if ($setting instanceof DynamicSearchAdsSetting) {
                $dsaSetting = $setting;
                break;
            }
        }

        if ($dsaSetting === null) {
            throw new InvalidArgumentException(
                'Campaign with ID ' . $campaignId . ' is not a DSA campaign.'
            );
        }

        // Use a page feed to specify precisely which URLs to use with your
        // Dynamic Search Ads.
        $pageFeed = new PageFeed();
        $pageFeed->setFeedIds([$feedDetails->feedId]);
        $dsaSetting->setPageFeed($pageFeed);

        // Optional: Specify whether only the supplied URLs should be used with your
        // Dynamic Search Ads.
        $dsaSetting->setUseSuppliedUrlsOnly(true);

        $updatedCampaign = new Campaign();
        $updatedCampaign->setId($campaignId);
        $updatedCampaign->setSettings($campaign->getSettings());

        $operation = new CampaignOperation();
        $operation->setOperand($updatedCampaign);
        $operation->setOperator(Operator::SET);

        // Update the campaign on the server and print out some information.
        $result = $campaignService->mutate([$operation]);
        $updatedCampaign = $result->getValue()[0];
        printf(
            "DSA page feed for campaign ID %d was updated with feed ID %d.\n",
            $updatedCampaign->getId(),
            $feedDetails->feedId
        );
    }
1062996
def create_ad_product_set(name:, filter:)
      query = { name: name, filter: filter.to_json }
      result = AdProductSet.post("/#{id}/product_sets", query: query)
      AdProductSet.find(result['id'])
    end
1271291
def search(self, filterstr, attrlist):
        """"""
        return self._paged_search_ext_s(self.settings.BASE, ldap.SCOPE_SUBTREE, filterstr=filterstr,
                                        attrlist=attrlist, page_size=self.settings.PAGE_SIZE)
209849
def add(self, search):
        
        ms = self._clone()
        ms._searches.append(search)
        return ms
335016
private static function createShowcaseAd(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        AdGroup $adGroup
    ) {
        // Create the Showcase ad.
        $adGroupAdService = $adWordsServices->get($session, AdGroupAdService::class);

        $showcaseAd = new ShowcaseAd();
        $showcaseAd->setName('Showcase ad #' . uniqid());
        $showcaseAd->setFinalUrls(['http://example.com/showcase']);
        $showcaseAd->setDisplayUrl('example.com');

        // Required: Set the ad's expanded image.
        $expandedImage = new Image();
        $expandedImage->setMediaId(
            self::uploadImage(
                $adWordsServices,
                $session,
                'https://goo.gl/IfVlpF'
            )
        );
        $showcaseAd->setExpandedImage($expandedImage);

        // Optional: Set the collapsed image.
        $collapsedImage = new Image();
        $collapsedImage->setMediaId(
            self::uploadImage(
                $adWordsServices,
                $session,
                'https://goo.gl/NqTxAE'
            )
        );
        $showcaseAd->setCollapsedImage($collapsedImage);

        // Create ad group ad.
        $adGroupAd = new AdGroupAd();
        $adGroupAd->setAdGroupId($adGroup->getId());
        $adGroupAd->setAd($showcaseAd);

        // Create an ad group ad operation.
        $adGroupAdOperation = new AdGroupAdOperation();
        $adGroupAdOperation->setOperand($adGroupAd);
        $adGroupAdOperation->setOperator(Operator::ADD);

        // Creates an ad group ad on the server.
        $adGroupAdAddResult = $adGroupAdService->mutate([$adGroupAdOperation]);
        $adGroupAd = $adGroupAdAddResult->getValue()[0];

        return $adGroupAd;
    }
30861
def CreateSmartShoppingAd(client, ad_group_id):
  
  ad_group_ad_service = client.GetService('AdGroupAdService', version='v201809')
  # Create an AdGroup Ad.
  adgroup_ad = {
      'adGroupId': ad_group_id,
      # Create a Smart Shopping ad (Goal-optimized Shopping ad).
      'ad': {
          'xsi_type': 'GoalOptimizedShoppingAd'
      }
  }

  ad_operation = {
      'operator': 'ADD',
      'operand': adgroup_ad
  }

  # Make the mutate request to add the Smart Shopping ad to the AdGroup.
  ad_result = ad_group_ad_service.mutate([ad_operation])

  for adgroup_ad in ad_result['value']:
    print 'Smart Shopping ad with ID "%s" was added.' % adgroup_ad['ad']['id']
750775
private static void addDsaTargeting(
      AdWordsServicesInterface adWordsServices,
      AdWordsSession session,
      Long adGroupId,
      String dsaPageUrlLabel)
      throws ApiException, RemoteException {
    // Get the AdGroupCriterionService.
    AdGroupCriterionServiceInterface adGroupCriterionService =
        adWordsServices.get(session, AdGroupCriterionServiceInterface.class);

    // Create a webpage criterion.
    Webpage webpage = new Webpage();

    WebpageParameter parameter = new WebpageParameter();
    parameter.setCriterionName("Test criterion");
    webpage.setParameter(parameter);

    // Add a condition for label=specified_label_name.
    WebpageCondition condition = new WebpageCondition();
    condition.setOperand(WebpageConditionOperand.CUSTOM_LABEL);
    condition.setArgument(dsaPageUrlLabel);
    parameter.setConditions(new WebpageCondition[] {condition});

    BiddableAdGroupCriterion criterion = new BiddableAdGroupCriterion();
    criterion.setAdGroupId(adGroupId);
    criterion.setCriterion(webpage);

    // Set a custom bid for this criterion.
    BiddingStrategyConfiguration biddingStrategyConfiguration = new BiddingStrategyConfiguration();

    CpcBid cpcBid = new CpcBid();
    Money money = new Money();
    money.setMicroAmount(1_500_000L);
    cpcBid.setBid(money);
    biddingStrategyConfiguration.setBids(new Bids[] {cpcBid});

    criterion.setBiddingStrategyConfiguration(biddingStrategyConfiguration);

    AdGroupCriterionOperation operation = new AdGroupCriterionOperation();
    operation.setOperand(criterion);
    operation.setOperator(Operator.ADD);

    BiddableAdGroupCriterion newCriterion =
        (BiddableAdGroupCriterion)
            adGroupCriterionService.mutate(new AdGroupCriterionOperation[] {operation}).getValue(0);
    System.out.printf(
        "Web page criterion with ID %d and status '%s' was created.%n",
        newCriterion.getCriterion().getId(), newCriterion.getUserStatus());
  }