Can u recode this in structural Approach?

On Wednesday, 19 July 2017 21:22:58 UTC+5:30, Shwetha Vastrad (AdWords API 
Team) wrote:
>
> Hi, 
>
> You can use the PHP code snippet below to add a negative IpBlock criterion 
> to your campaign.
>
> class AddIpBlock {
>
>   const CAMPAIGN_ID = 'YOUR_CAMPAIGN_ID';
>
>   public static function runExample(AdWordsServices $adWordsServices,
>       AdWordsSession $session, $campaignId, $locationFeedId) {
>     $campaignCriterionService =
>         $adWordsServices->get($session, CampaignCriterionService::class);
>
>     $campaignCriteria = [];
>
>     // Add a negative campaign criterion.
>     $ipBlock = new IpBlock();
>     $ipBlock->setIpAddress('IpAddress');
>     $negativeCriterion = new NegativeCampaignCriterion();
>     $negativeCriterion->setCampaignId($campaignId);
>     $negativeCriterion->setCriterion($ipBlock);
>
>     $operation = new CampaignCriterionOperation();
>     $operation->setOperator(Operator::ADD);
>     $operation->setOperand($negativeCriterion);
>     $operations[] = $operation;
>
>     $result = $campaignCriterionService->mutate($operations);
>
>     // Print out some information about added campaign criteria.
>     foreach ($result->getValue() as $campaignCriterion) {
>       printf(
>           "Campaign targeting criterion with ID %d and type '%s' was 
> added.\n",
>           $campaignCriterion->getCriterion()->getId(),
>           $campaignCriterion->getCriterion()->getType());
>     }
>   }
>
>   public static function main() {
>     // Generate a refreshable OAuth2 credential for authentication.
>     $oAuth2Credential = (new OAuth2TokenBuilder())
>         ->fromFile()
>         ->build();
>
>     // Construct an API session configured from a properties file and the 
> OAuth2
>     // credentials above.
>     $session = (new AdWordsSessionBuilder())
>         ->fromFile()
>         ->withOAuth2Credential($oAuth2Credential)
>         ->build();
>     self::runExample(
>         new AdWordsServices(), $session, intval(self::CAMPAIGN_ID));
>   }
> }
>
> AddIpBlock::main();
>
> Regards,
> Shwetha, AdWords API Team.
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/4f50aa00-5f15-43ff-be69-31959ffa8fa3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • ... rajit bansal
    • ... 'Dhanya Sundararaju (AdWords API Team)' via AdWords API and Google Ads API Forum

Reply via email to