So far I have this..


class SetBidModifier {

  const CAMPAIGN_ID = '1010615735';
  // Bid modifiers are float number, not percentages, e.g., 1.5 means 50% 
more
  // bidding.
  const BID_MODIFIER = '1.5';

  public static function runExample(AdWordsServices $adWordsServices, 
AdWordsSession $session, $campaignId, $bidModifier) 
  {
    $campaignCriterionService = $adWordsServices->get($session, 
CampaignCriterionService::class);

    // Create a mobile platform. The ID can be found in the documentation.
    // https://developers.google.com/adwords/api/docs/appendix/platforms
    $mobile = new Platform();
    $mobile->setId(30001); // HighEndMobile = 30001

    $adsched = new AdSchedule();
    $adsched->setDayOfWeek(DayOfWeek::MONDAY);
    $adsched->setStartHour(24);
    $adsched->setStartMinute(MinuteOfHour::ZERO);
    $adsched->setEndHour(24);
    $adsched->setEndMinute(MinuteOfHour::ZERO);


    // Create a criterion with modified bid.
    $criterion = new CampaignCriterion();
    $criterion->setCampaignId($campaignId);
    $criterion->setCriterion($mobile);
    $criterion->setBidModifier($bidModifier);

    // Create a campaign criterion operation and add it to the operations 
list.
    $operation = new CampaignCriterionOperation();
    $operation->setOperator(Operator::SET);
    $operation->setOperand($criterion);
    $operations = [$operation];

    // Update campaign criteria on the server.
    $results = $campaignCriterionService->mutate($operations);

    // Print out some information about the updated campaign criterion.
    foreach ($results->getValue() as $campaignCriterion) {
      printf(
          "Campaign criterion with campaign ID %d, criterion ID %d, "
              . "and type '%s' was modified with bid %.2f.\n",
          $campaignCriterion->getCampaignId(),
          $campaignCriterion->getCriterion()->getId(),
          $campaignCriterion->getCriterion()->getType(),
          $campaignCriterion->getBidModifier());
    }
  }

  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), floatval(self::BID_MODIFIER));
  }
}


I just don't know how to pass the ad schedule to mutate.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
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/4e9b3104-fbc2-4a55-b19b-1d3802f70565%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to