From 673e9a2e2fcc81187d4c4f673b8d75e022f84d31 Mon Sep 17 00:00:00 2001 From: "Thanet (Knack) Praneenararat" Date: Fri, 15 Jun 2018 17:39:11 +0900 Subject: [PATCH] Added support for v0_2. --- CHANGELOG.md | 5 + composer.json | 1 - .../GetAccountInformation.php | 2 +- .../AddExpandedTextAdWithUpgradedUrls.php | 2 +- .../UsePortfolioBiddingStrategy.php | 2 +- examples/BasicOperations/AddAdGroups.php | 2 +- examples/BasicOperations/AddCampaigns.php | 2 +- .../BasicOperations/AddExpandedTextAds.php | 2 +- examples/BasicOperations/AddKeywords.php | 2 +- examples/BasicOperations/GetAdGroups.php | 2 +- .../BasicOperations/GetArtifactMetadata.php | 2 +- examples/BasicOperations/GetCampaigns.php | 2 +- .../BasicOperations/GetExpandedTextAds.php | 2 +- examples/BasicOperations/GetKeywords.php | 2 +- examples/BasicOperations/PauseAd.php | 2 +- examples/BasicOperations/RemoveAd.php | 2 +- examples/BasicOperations/RemoveAdGroup.php | 2 +- examples/BasicOperations/RemoveCampaign.php | 2 +- examples/BasicOperations/RemoveKeyword.php | 2 +- examples/BasicOperations/UpdateAdGroup.php | 2 +- examples/BasicOperations/UpdateCampaign.php | 2 +- examples/BasicOperations/UpdateKeyword.php | 2 +- examples/HotelAds/AddHotelAd.php | 33 +++- .../HotelAds/AddHotelAdGroupBidModifiers.php | 2 +- .../HotelAds/AddHotelListingGroupTree.php | 62 +++++--- .../Recommendations/ApplyRecommendation.php | 2 +- .../GetTextAdRecommendations.php | 2 +- examples/Reporting/GetKeywordStats.php | 2 +- .../AddCampaignTargetingCriteria.php | 2 +- .../GetCampaignTargetingCriteria.php | 2 +- examples/Utils/ArgumentNames.php | 5 + examples/Utils/ArgumentParser.php | 46 ++++-- .../Ads/GoogleAds/V0/Common/Bidding.php | 21 ++- .../V0/Enums/BiddingStrategyType.php | 27 ++-- .../GoogleAds/V0/Errors/CriterionError.php | 21 +-- .../Ads/GoogleAds/V0/Resources/AdGroup.php | 24 +-- .../V0/Resources/AdGroupCriterion.php | 126 ++++++++------- .../Ads/GoogleAds/V0/Resources/Campaign.php | 63 ++++---- src/Google/Ads/GoogleAds/Util/FieldMasks.php | 34 ++-- .../Google/Ads/GoogleAds/Util/Testing/Bar.php | 26 +++ .../Ads/GoogleAds/Util/Testing/Tester.php | 13 +- .../Ads/GoogleAds/Util/Testing/tester.proto | 1 + .../Util/Testing/testdata/test_cases.json | 12 ++ .../Ads/GoogleAds/V0/Common/PercentCpc.php | 108 +++++++++++++ ...ngStrategyTypeEnum_BiddingStrategyType.php | 7 + .../CriterionErrorEnum_CriterionError.php | 7 + .../Ads/GoogleAds/V0/Resources/AdGroup.php | 38 +++++ .../V0/Resources/AdGroupCriterion.php | 102 ++++++++++++ .../Ads/GoogleAds/V0/Resources/Campaign.php | 28 ++++ .../Gapic/AdGroupAdServiceGapicClient.php | 5 +- .../AdGroupBidModifierServiceGapicClient.php | 5 +- .../AdGroupCriterionServiceGapicClient.php | 5 +- .../Gapic/AdGroupServiceGapicClient.php | 5 +- .../BiddingStrategyServiceGapicClient.php | 5 +- .../CampaignBudgetServiceGapicClient.php | 5 +- .../CampaignCriterionServiceGapicClient.php | 5 +- .../Gapic/CampaignServiceGapicClient.php | 5 +- .../Gapic/CustomerServiceGapicClient.php | 5 +- .../GeoTargetConstantServiceGapicClient.php | 5 +- .../GoogleAdsFieldServiceGapicClient.php | 5 +- .../Gapic/GoogleAdsServiceGapicClient.php | 5 +- .../Gapic/KeywordViewServiceGapicClient.php | 5 +- .../RecommendationServiceGapicClient.php | 5 +- .../Examples/Utils/ArgumentParserTest.php | 148 ++++++++++++++++++ ...FieldMasksTests.php => FieldMasksTest.php} | 2 +- 65 files changed, 811 insertions(+), 271 deletions(-) create mode 100644 src/Google/Ads/GoogleAds/V0/Common/PercentCpc.php create mode 100644 tests/Google/Ads/GoogleAds/Examples/Utils/ArgumentParserTest.php rename tests/Google/Ads/GoogleAds/Util/{FieldMasksTests.php => FieldMasksTest.php} (98%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0443c0345..812c44049 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.2.0 + +* Added support for V0_2 of Google Ads API, which includes the Percent CPC + bidding strategy. + ## 0.1.0 * Initial release with support for V0_1 of Google Ads API. diff --git a/composer.json b/composer.json index 80d3d30d9..422ef834e 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,5 @@ { "name": "googleads/google-ads-php", - "version": "0.1.0", "author": "Google LLC", "url": "https://github.com/googleads/google-ads-php", "description": "Google Ads API client for PHP", diff --git a/examples/AccountManagement/GetAccountInformation.php b/examples/AccountManagement/GetAccountInformation.php index 838d8696b..9d5115f8c 100644 --- a/examples/AccountManagement/GetAccountInformation.php +++ b/examples/AccountManagement/GetAccountInformation.php @@ -43,7 +43,7 @@ public static function main() { // Either pass the required parameters for this example on the command line, or insert them // into the constants above. - $options = ArgumentParser::parseCommandArguments([ + $options = (new ArgumentParser())->parseCommandArguments([ ArgumentNames::CUSTOMER_ID => GetOpt::REQUIRED_ARGUMENT ]); diff --git a/examples/AdvancedOperations/AddExpandedTextAdWithUpgradedUrls.php b/examples/AdvancedOperations/AddExpandedTextAdWithUpgradedUrls.php index 3e2604680..c1cd1e72c 100644 --- a/examples/AdvancedOperations/AddExpandedTextAdWithUpgradedUrls.php +++ b/examples/AdvancedOperations/AddExpandedTextAdWithUpgradedUrls.php @@ -50,7 +50,7 @@ public static function main() { // Either pass the required parameters for this example on the command line, or insert them // into the constants above. - $options = ArgumentParser::parseCommandArguments([ + $options = (new ArgumentParser())->parseCommandArguments([ ArgumentNames::CUSTOMER_ID => GetOpt::REQUIRED_ARGUMENT, ArgumentNames::AD_GROUP_ID => GetOpt::REQUIRED_ARGUMENT ]); diff --git a/examples/AdvancedOperations/UsePortfolioBiddingStrategy.php b/examples/AdvancedOperations/UsePortfolioBiddingStrategy.php index 894a9ce0b..26a21902f 100644 --- a/examples/AdvancedOperations/UsePortfolioBiddingStrategy.php +++ b/examples/AdvancedOperations/UsePortfolioBiddingStrategy.php @@ -58,7 +58,7 @@ public static function main() { // Either pass the required parameters for this example on the command line, or insert them // into the constants above. - $options = ArgumentParser::parseCommandArguments( + $options = (new ArgumentParser())->parseCommandArguments( [ ArgumentNames::CUSTOMER_ID => GetOpt::REQUIRED_ARGUMENT, ArgumentNames::CAMPAIGN_BUDGET_ID => GetOpt::OPTIONAL_ARGUMENT diff --git a/examples/BasicOperations/AddAdGroups.php b/examples/BasicOperations/AddAdGroups.php index cde1681fe..75c0ef631 100644 --- a/examples/BasicOperations/AddAdGroups.php +++ b/examples/BasicOperations/AddAdGroups.php @@ -46,7 +46,7 @@ public static function main() { // Either pass the required parameters for this example on the command line, or insert them // into the constants above. - $options = ArgumentParser::parseCommandArguments([ + $options = (new ArgumentParser())->parseCommandArguments([ ArgumentNames::CUSTOMER_ID => GetOpt::REQUIRED_ARGUMENT, ArgumentNames::CAMPAIGN_ID => GetOpt::REQUIRED_ARGUMENT ]); diff --git a/examples/BasicOperations/AddCampaigns.php b/examples/BasicOperations/AddCampaigns.php index 935a7c831..abab1720b 100644 --- a/examples/BasicOperations/AddCampaigns.php +++ b/examples/BasicOperations/AddCampaigns.php @@ -51,7 +51,7 @@ public static function main() { // Either pass the required parameters for this example on the command line, or insert them // into the constants above. - $options = ArgumentParser::parseCommandArguments([ + $options = (new ArgumentParser())->parseCommandArguments([ ArgumentNames::CUSTOMER_ID => GetOpt::REQUIRED_ARGUMENT ]); diff --git a/examples/BasicOperations/AddExpandedTextAds.php b/examples/BasicOperations/AddExpandedTextAds.php index 14478fae9..77245899f 100644 --- a/examples/BasicOperations/AddExpandedTextAds.php +++ b/examples/BasicOperations/AddExpandedTextAds.php @@ -48,7 +48,7 @@ public static function main() { // Either pass the required parameters for this example on the command line, or insert them // into the constants above. - $options = ArgumentParser::parseCommandArguments([ + $options = (new ArgumentParser())->parseCommandArguments([ ArgumentNames::CUSTOMER_ID => GetOpt::REQUIRED_ARGUMENT, ArgumentNames::AD_GROUP_ID => GetOpt::REQUIRED_ARGUMENT ]); diff --git a/examples/BasicOperations/AddKeywords.php b/examples/BasicOperations/AddKeywords.php index e7ea7b60a..b72818613 100644 --- a/examples/BasicOperations/AddKeywords.php +++ b/examples/BasicOperations/AddKeywords.php @@ -48,7 +48,7 @@ public static function main() { // Either pass the required parameters for this example on the command line, or insert them // into the constants above. - $options = ArgumentParser::parseCommandArguments([ + $options = (new ArgumentParser())->parseCommandArguments([ ArgumentNames::CUSTOMER_ID => GetOpt::REQUIRED_ARGUMENT, ArgumentNames::AD_GROUP_ID => GetOpt::REQUIRED_ARGUMENT, ArgumentNames::KEYWORD_TEXT => GetOpt::OPTIONAL_ARGUMENT diff --git a/examples/BasicOperations/GetAdGroups.php b/examples/BasicOperations/GetAdGroups.php index bcc377b82..27cf3302e 100644 --- a/examples/BasicOperations/GetAdGroups.php +++ b/examples/BasicOperations/GetAdGroups.php @@ -43,7 +43,7 @@ public static function main() { // Either pass the required parameters for this example on the command line, or insert them // into the constants above. - $options = ArgumentParser::parseCommandArguments([ + $options = (new ArgumentParser())->parseCommandArguments([ ArgumentNames::CUSTOMER_ID => GetOpt::REQUIRED_ARGUMENT, ArgumentNames::CAMPAIGN_ID => GetOpt::OPTIONAL_ARGUMENT ]); diff --git a/examples/BasicOperations/GetArtifactMetadata.php b/examples/BasicOperations/GetArtifactMetadata.php index af7d900fa..0e6b95724 100644 --- a/examples/BasicOperations/GetArtifactMetadata.php +++ b/examples/BasicOperations/GetArtifactMetadata.php @@ -47,7 +47,7 @@ public static function main() { // Either pass the required parameters for this example on the command line, or insert them // into the constants above. - $options = ArgumentParser::parseCommandArguments([ + $options = (new ArgumentParser())->parseCommandArguments([ ArgumentNames::ARTIFACT_NAME => GetOpt::REQUIRED_ARGUMENT ]); diff --git a/examples/BasicOperations/GetCampaigns.php b/examples/BasicOperations/GetCampaigns.php index 940a10ded..7c802658f 100644 --- a/examples/BasicOperations/GetCampaigns.php +++ b/examples/BasicOperations/GetCampaigns.php @@ -40,7 +40,7 @@ public static function main() { // Either pass the required parameters for this example on the command line, or insert them // into the constants above. - $options = ArgumentParser::parseCommandArguments([ + $options = (new ArgumentParser())->parseCommandArguments([ ArgumentNames::CUSTOMER_ID => GetOpt::REQUIRED_ARGUMENT ]); diff --git a/examples/BasicOperations/GetExpandedTextAds.php b/examples/BasicOperations/GetExpandedTextAds.php index 41a8b21fc..4216832d4 100644 --- a/examples/BasicOperations/GetExpandedTextAds.php +++ b/examples/BasicOperations/GetExpandedTextAds.php @@ -43,7 +43,7 @@ public static function main() { // Either pass the required parameters for this example on the command line, or insert them // into the constants above. - $options = ArgumentParser::parseCommandArguments([ + $options = (new ArgumentParser())->parseCommandArguments([ ArgumentNames::CUSTOMER_ID => GetOpt::REQUIRED_ARGUMENT, ArgumentNames::AD_GROUP_ID => GetOpt::OPTIONAL_ARGUMENT ]); diff --git a/examples/BasicOperations/GetKeywords.php b/examples/BasicOperations/GetKeywords.php index cc0c0eb3f..e271d9a92 100644 --- a/examples/BasicOperations/GetKeywords.php +++ b/examples/BasicOperations/GetKeywords.php @@ -43,7 +43,7 @@ public static function main() { // Either pass the required parameters for this example on the command line, or insert them // into the constants above. - $options = ArgumentParser::parseCommandArguments([ + $options = (new ArgumentParser())->parseCommandArguments([ ArgumentNames::CUSTOMER_ID => GetOpt::REQUIRED_ARGUMENT, ArgumentNames::AD_GROUP_ID => GetOpt::OPTIONAL_ARGUMENT ]); diff --git a/examples/BasicOperations/PauseAd.php b/examples/BasicOperations/PauseAd.php index fa4b34e39..e9cc32481 100644 --- a/examples/BasicOperations/PauseAd.php +++ b/examples/BasicOperations/PauseAd.php @@ -47,7 +47,7 @@ public static function main() { // Either pass the required parameters for this example on the command line, or insert them // into the constants above. - $options = ArgumentParser::parseCommandArguments([ + $options = (new ArgumentParser())->parseCommandArguments([ ArgumentNames::CUSTOMER_ID => GetOpt::REQUIRED_ARGUMENT, ArgumentNames::AD_GROUP_ID => GetOpt::REQUIRED_ARGUMENT, ArgumentNames::AD_ID => GetOpt::REQUIRED_ARGUMENT diff --git a/examples/BasicOperations/RemoveAd.php b/examples/BasicOperations/RemoveAd.php index a10af87e0..a68d8d4fd 100644 --- a/examples/BasicOperations/RemoveAd.php +++ b/examples/BasicOperations/RemoveAd.php @@ -45,7 +45,7 @@ public static function main() { // Either pass the required parameters for this example on the command line, or insert them // into the constants above. - $options = ArgumentParser::parseCommandArguments([ + $options = (new ArgumentParser())->parseCommandArguments([ ArgumentNames::CUSTOMER_ID => GetOpt::REQUIRED_ARGUMENT, ArgumentNames::AD_GROUP_ID => GetOpt::REQUIRED_ARGUMENT, ArgumentNames::AD_ID => GetOpt::REQUIRED_ARGUMENT diff --git a/examples/BasicOperations/RemoveAdGroup.php b/examples/BasicOperations/RemoveAdGroup.php index 9f72daa41..35cbe8c8c 100644 --- a/examples/BasicOperations/RemoveAdGroup.php +++ b/examples/BasicOperations/RemoveAdGroup.php @@ -45,7 +45,7 @@ public static function main() { // Either pass the required parameters for this example on the command line, or insert them // into the constants above. - $options = ArgumentParser::parseCommandArguments([ + $options = (new ArgumentParser())->parseCommandArguments([ ArgumentNames::CUSTOMER_ID => GetOpt::REQUIRED_ARGUMENT, ArgumentNames::AD_GROUP_ID => GetOpt::REQUIRED_ARGUMENT ]); diff --git a/examples/BasicOperations/RemoveCampaign.php b/examples/BasicOperations/RemoveCampaign.php index 7c9a888b5..b0ef0fa7d 100644 --- a/examples/BasicOperations/RemoveCampaign.php +++ b/examples/BasicOperations/RemoveCampaign.php @@ -44,7 +44,7 @@ public static function main() { // Either pass the required parameters for this example on the command line, or insert them // into the constants above. - $options = ArgumentParser::parseCommandArguments([ + $options = (new ArgumentParser())->parseCommandArguments([ ArgumentNames::CUSTOMER_ID => GetOpt::REQUIRED_ARGUMENT, ArgumentNames::CAMPAIGN_ID => GetOpt::REQUIRED_ARGUMENT ]); diff --git a/examples/BasicOperations/RemoveKeyword.php b/examples/BasicOperations/RemoveKeyword.php index 8eef78754..e1a8686c7 100644 --- a/examples/BasicOperations/RemoveKeyword.php +++ b/examples/BasicOperations/RemoveKeyword.php @@ -47,7 +47,7 @@ public static function main() { // Either pass the required parameters for this example on the command line, or insert them // into the constants above. - $options = ArgumentParser::parseCommandArguments([ + $options = (new ArgumentParser())->parseCommandArguments([ ArgumentNames::CUSTOMER_ID => GetOpt::REQUIRED_ARGUMENT, ArgumentNames::AD_GROUP_ID => GetOpt::REQUIRED_ARGUMENT, ArgumentNames::CRITERION_ID => GetOpt::REQUIRED_ARGUMENT diff --git a/examples/BasicOperations/UpdateAdGroup.php b/examples/BasicOperations/UpdateAdGroup.php index 4d72cf0de..c7d801509 100644 --- a/examples/BasicOperations/UpdateAdGroup.php +++ b/examples/BasicOperations/UpdateAdGroup.php @@ -49,7 +49,7 @@ public static function main() { // Either pass the required parameters for this example on the command line, or insert them // into the constants above. - $options = ArgumentParser::parseCommandArguments([ + $options = (new ArgumentParser())->parseCommandArguments([ ArgumentNames::CUSTOMER_ID => GetOpt::REQUIRED_ARGUMENT, ArgumentNames::AD_GROUP_ID => GetOpt::REQUIRED_ARGUMENT, ArgumentNames::CPC_BID_MICRO_AMOUNT => GetOpt::REQUIRED_ARGUMENT diff --git a/examples/BasicOperations/UpdateCampaign.php b/examples/BasicOperations/UpdateCampaign.php index 97d410316..15cde587f 100644 --- a/examples/BasicOperations/UpdateCampaign.php +++ b/examples/BasicOperations/UpdateCampaign.php @@ -47,7 +47,7 @@ public static function main() { // Either pass the required parameters for this example on the command line, or insert them // into the constants above. - $options = ArgumentParser::parseCommandArguments([ + $options = (new ArgumentParser())->parseCommandArguments([ ArgumentNames::CUSTOMER_ID => GetOpt::REQUIRED_ARGUMENT, ArgumentNames::CAMPAIGN_ID => GetOpt::REQUIRED_ARGUMENT ]); diff --git a/examples/BasicOperations/UpdateKeyword.php b/examples/BasicOperations/UpdateKeyword.php index 17b81bdb4..f82f528c9 100644 --- a/examples/BasicOperations/UpdateKeyword.php +++ b/examples/BasicOperations/UpdateKeyword.php @@ -50,7 +50,7 @@ public static function main() { // Either pass the required parameters for this example on the command line, or insert them // into the constants above. - $options = ArgumentParser::parseCommandArguments([ + $options = (new ArgumentParser())->parseCommandArguments([ ArgumentNames::CUSTOMER_ID => GetOpt::REQUIRED_ARGUMENT, ArgumentNames::AD_GROUP_ID => GetOpt::REQUIRED_ARGUMENT, ArgumentNames::CRITERION_ID => GetOpt::REQUIRED_ARGUMENT diff --git a/examples/HotelAds/AddHotelAd.php b/examples/HotelAds/AddHotelAd.php index 18ec67c79..6a7deff86 100644 --- a/examples/HotelAds/AddHotelAd.php +++ b/examples/HotelAds/AddHotelAd.php @@ -29,6 +29,7 @@ use Google\Ads\GoogleAds\V0\Common\Ad; use Google\Ads\GoogleAds\V0\Common\HotelAdInfo; use Google\Ads\GoogleAds\V0\Common\ManualCpc; +use Google\Ads\GoogleAds\V0\Common\PercentCpc; use Google\Ads\GoogleAds\V0\Enums\AdGroupAdStatusEnum_AdGroupAdStatus; use Google\Ads\GoogleAds\V0\Enums\AdGroupStatusEnum_AdGroupStatus; use Google\Ads\GoogleAds\V0\Enums\AdGroupTypeEnum_AdGroupType; @@ -66,14 +67,18 @@ class AddHotelAds // This ID is the same account ID that you use in API requests to the Travel Partner APIs // (https://developers.google.com/hotels/hotel-ads/api-reference/). const HOTEL_CENTER_ACCOUNT_ID = 'INSERT_HOTEL_CENTER_ACCOUNT_ID_HERE'; + // Specify maximum bid limit that can be set when creating a campaign using the Percent CPC + // bidding strategy. + const CPC_BID_CEILING_MICRO_AMOUNT = 20000000; public static function main() { // Either pass the required parameters for this example on the command line, or insert them // into the constants above. - $options = ArgumentParser::parseCommandArguments([ + $options = (new ArgumentParser())->parseCommandArguments([ ArgumentNames::CUSTOMER_ID => GetOpt::REQUIRED_ARGUMENT, - ArgumentNames::HOTEL_CENTER_ACCOUNT_ID => GetOpt::REQUIRED_ARGUMENT + ArgumentNames::HOTEL_CENTER_ACCOUNT_ID => GetOpt::REQUIRED_ARGUMENT, + ArgumentNames::CPC_BID_CEILING_MICRO_AMOUNT => GetOpt::OPTIONAL_ARGUMENT ]); // Generate a refreshable OAuth2 credential for authentication. @@ -89,7 +94,9 @@ public static function main() self::runExample( $googleAdsClient, $options[ArgumentNames::CUSTOMER_ID] ?: self::CUSTOMER_ID, - $options[ArgumentNames::HOTEL_CENTER_ACCOUNT_ID] ?: self::HOTEL_CENTER_ACCOUNT_ID + $options[ArgumentNames::HOTEL_CENTER_ACCOUNT_ID] ?: self::HOTEL_CENTER_ACCOUNT_ID, + $options[ArgumentNames::CPC_BID_CEILING_MICRO_AMOUNT] + ?: self::CPC_BID_CEILING_MICRO_AMOUNT ); } catch (GoogleAdsException $googleAdsException) { printf( @@ -122,11 +129,13 @@ public static function main() * @param GoogleAdsClient $googleAdsClient the Google Ads API client * @param int $customerId the client customer ID without hyphens * @param int $hotelCenterAccountId the Hotel Center account ID + * @param int $cpcBidCeilingMicroAmount the CPC bid ceiling micro amount */ public static function runExample( GoogleAdsClient $googleAdsClient, $customerId, - $hotelCenterAccountId + $hotelCenterAccountId, + $cpcBidCeilingMicroAmount ) { // Creates a budget to be used by the campaign that will be created below. $budgetResourceName = self::addCampaignBudget($googleAdsClient, $customerId); @@ -135,7 +144,8 @@ public static function runExample( $googleAdsClient, $customerId, $budgetResourceName, - $hotelCenterAccountId + $hotelCenterAccountId, + $cpcBidCeilingMicroAmount ); // Creates a hotel ad group. $adGroupResourceName = @@ -196,6 +206,7 @@ private static function addCampaignBudget(GoogleAdsClient $googleAdsClient, $cus * @param int $customerId the client customer ID * @param string $budgetResourceName the resource name of budget for a new campaign * @param int $hotelCenterAccountId the Hotel Center account ID + * @param int $cpcBidCeilingMicroAmount the CPC bid ceiling micro amount * @return string the resource name of the newly created campaign */ // [START addHotelCampaign] @@ -203,7 +214,8 @@ private static function addHotelCampaign( GoogleAdsClient $googleAdsClient, $customerId, $budgetResourceName, - $hotelCenterAccountId + $hotelCenterAccountId, + $cpcBidCeilingMicroAmount ) { // Creates a campaign. $campaign = new Campaign(); @@ -227,8 +239,13 @@ private static function addHotelCampaign( // the ads from immediately serving. Set to ENABLED once you've added // targeting and the ads are ready to serve. $campaign->setStatus(CampaignStatusEnum_CampaignStatus::PAUSED); - // Sets the bidding strategy. Only Manual CPC can be used for hotel campaigns. - $campaign->setManualCpc(new ManualCpc()); + // Sets the bidding strategy to PercentCpc. Only Manual CPC and Percent CPC can be used for + // hotel campaigns. + $percentCpc = new PercentCpc(); + $wrappedCpcBidCeilingMicros = new Int64Value(); + $wrappedCpcBidCeilingMicros->setValue($cpcBidCeilingMicroAmount); + $percentCpc->setCpcBidCeilingMicros($wrappedCpcBidCeilingMicros); + $campaign->setPercentCpc($percentCpc); // Sets the budget. $wrappedBudgetResourceName = new StringValue(); diff --git a/examples/HotelAds/AddHotelAdGroupBidModifiers.php b/examples/HotelAds/AddHotelAdGroupBidModifiers.php index 636df1507..699f53c2b 100644 --- a/examples/HotelAds/AddHotelAdGroupBidModifiers.php +++ b/examples/HotelAds/AddHotelAdGroupBidModifiers.php @@ -63,7 +63,7 @@ public static function main() { // Either pass the required parameters for this example on the command line, or insert them // into the constants above. - $options = ArgumentParser::parseCommandArguments([ + $options = (new ArgumentParser())->parseCommandArguments([ ArgumentNames::CUSTOMER_ID => GetOpt::REQUIRED_ARGUMENT, ArgumentNames::AD_GROUP_ID => GetOpt::REQUIRED_ARGUMENT, ArgumentNames::CHECK_IN_DAY_CRITERION_ID => GetOpt::OPTIONAL_ARGUMENT diff --git a/examples/HotelAds/AddHotelListingGroupTree.php b/examples/HotelAds/AddHotelListingGroupTree.php index db8700692..4374a2d93 100644 --- a/examples/HotelAds/AddHotelListingGroupTree.php +++ b/examples/HotelAds/AddHotelListingGroupTree.php @@ -61,7 +61,7 @@ class AddHotelListingGroupTree // Specify the CPC bid micro amount to be set on a created ad group criterion. // For simplicity, each ad group criterion will use the below amount equally. In practice, you // probably want to use different values for each ad group criterion. - const CPC_BID_MICRO_AMOUNT = 1000000; + const PERCENT_CPC_BID_MICRO_AMOUNT = 1000000; /** * @var int $nextTempId @@ -82,10 +82,10 @@ public static function main() { // Either pass the required parameters for this example on the command line, or insert them // into the constants above. - $options = ArgumentParser::parseCommandArguments([ + $options = (new ArgumentParser())->parseCommandArguments([ ArgumentNames::CUSTOMER_ID => GetOpt::REQUIRED_ARGUMENT, ArgumentNames::AD_GROUP_ID => GetOpt::REQUIRED_ARGUMENT, - ArgumentNames::CPC_BID_MICRO_AMOUNT => GetOpt::OPTIONAL_ARGUMENT + ArgumentNames::PERCENT_CPC_BID_MICRO_AMOUNT => GetOpt::OPTIONAL_ARGUMENT ]); // Generate a refreshable OAuth2 credential for authentication. @@ -102,7 +102,8 @@ public static function main() $googleAdsClient, $options[ArgumentNames::CUSTOMER_ID] ?: self::CUSTOMER_ID, $options[ArgumentNames::AD_GROUP_ID] ?: self::AD_GROUP_ID, - $options[ArgumentNames::CPC_BID_MICRO_AMOUNT] ?: self::CPC_BID_MICRO_AMOUNT + $options[ArgumentNames::PERCENT_CPC_BID_MICRO_AMOUNT] + ?: self::PERCENT_CPC_BID_MICRO_AMOUNT ); } catch (GoogleAdsException $googleAdsException) { printf( @@ -135,22 +136,29 @@ public static function main() * @param GoogleAdsClient $googleAdsClient the Google Ads API client * @param int $customerId the client customer ID without hyphens * @param int $adGroupId the ad group ID - * @param int $cpcBidMicroAmount the CPC bid micro amount to set on created ad group criteria + * @param int $percentCpcBidMicroAmount the percent CPC bid micro amount to set on created ad + * group criteria */ public static function runExample( GoogleAdsClient $googleAdsClient, $customerId, $adGroupId, - $cpcBidMicroAmount + $percentCpcBidMicroAmount ) { $operations = []; // Creates the root of the tree as a SUBDIVISION node. - $rootId = self::addRootNode($customerId, $adGroupId, $operations, $cpcBidMicroAmount); + $rootId = + self::addRootNode($customerId, $adGroupId, $operations, $percentCpcBidMicroAmount); // Creates child nodes of level 1, partitioned by the hotel class info. - $otherHotelClassesId = - self::addLevel1Nodes($customerId, $adGroupId, $rootId, $operations, $cpcBidMicroAmount); + $otherHotelClassesId = self::addLevel1Nodes( + $customerId, + $adGroupId, + $rootId, + $operations, + $percentCpcBidMicroAmount + ); // Creates child nodes of level 2, partitioned by the hotel country region info. self::addLevel2Nodes( @@ -158,7 +166,7 @@ public static function runExample( $adGroupId, $otherHotelClassesId, $operations, - $cpcBidMicroAmount + $percentCpcBidMicroAmount ); $adGroupCriterionServiceClient = $googleAdsClient->getAdGroupCriterionServiceClient(); @@ -177,19 +185,20 @@ public static function runExample( * @param int $customerId the customer ID * @param int $adGroupId the ad group ID * @param AdGroupCriterionOperation[] $operations the operations - * @param int $cpcBidMicroAmount the CPC bid micro amount to set on created ad group criteria + * @param int $percentCpcBidMicroAmount the CPC bid micro amount to set on created ad group + * criteria * @return int the root node's temporary ID */ private static function addRootNode( $customerId, $adGroupId, array &$operations, - $cpcBidMicroAmount + $percentCpcBidMicroAmount ) { // Creates the root of the tree as a SUBDIVISION node. $root = self::createListingGroupInfo(ListingGroupTypeEnum_ListingGroupType::SUBDIVISION); $rootAdGroupCriterion = - self::createAdGroupCriterion($customerId, $adGroupId, $root, $cpcBidMicroAmount); + self::createAdGroupCriterion($customerId, $adGroupId, $root, $percentCpcBidMicroAmount); $operation = self::generateCreateOperation($rootAdGroupCriterion); $operations[] = $operation; @@ -203,7 +212,8 @@ private static function addRootNode( * @param int $adGroupId the ad group ID * @param int $rootId the root ID for all nodes at this level * @param AdGroupCriterionOperation[] $operations the operations list - * @param int $cpcBidMicroAmount the CPC bid micro amount to set on created ad group criteria + * @param int $percentCpcBidMicroAmount the CPC bid micro amount to set on created ad group + * criteria * @return int the "other hotel classes" node's temporary ID, which serves as a parent node for * the next level */ @@ -213,7 +223,7 @@ private static function addLevel1Nodes( $adGroupId, $rootId, array &$operations, - $cpcBidMicroAmount + $percentCpcBidMicroAmount ) { // Creates hotel class info and dimension info for 5-star hotels. $fiveStarredHotelClassInfo = new HotelClassInfo(); @@ -233,7 +243,7 @@ private static function addLevel1Nodes( $customerId, $adGroupId, $fiveStarredUnit, - $cpcBidMicroAmount + $percentCpcBidMicroAmount ); // Decrements the temp ID for the next ad group criterion. self::$nextTempId--; @@ -261,7 +271,7 @@ private static function addLevel1Nodes( $customerId, $adGroupId, $otherHotelsSubDivision, - $cpcBidMicroAmount + $percentCpcBidMicroAmount ); $operation = self::generateCreateOperation($otherHotelsAdGroupCriterion); $operations[] = $operation; @@ -277,14 +287,15 @@ private static function addLevel1Nodes( * @param int $adGroupId the ad group ID * @param int $parentId the parent ID for all nodes at this level * @param AdGroupCriterionOperation[] $operations the operations list - * @param int $cpcBidMicroAmount the CPC bid micro amount to set on created ad group criteria + * @param int $percentCpcBidMicroAmount the CPC bid micro amount to set on created ad group + * criteria */ private static function addLevel2Nodes( $customerId, $adGroupId, $parentId, array &$operations, - $cpcBidMicroAmount + $percentCpcBidMicroAmount ) { // Creates hotel country region info and dimension info for hotels in Japan. $japanCountryRegionInfo = new HotelCountryRegionInfo(); @@ -310,7 +321,7 @@ private static function addLevel2Nodes( $customerId, $adGroupId, $japanHotelsUnit, - $cpcBidMicroAmount + $percentCpcBidMicroAmount ); // Decrements the temp ID for the next ad group criterion. self::$nextTempId--; @@ -332,7 +343,7 @@ private static function addLevel2Nodes( $customerId, $adGroupId, $otherHotelRegionsUnit, - $cpcBidMicroAmount + $percentCpcBidMicroAmount ); $operation = self::generateCreateOperation($otherHotelRegionsAdGroupCriterion); $operations[] = $operation; @@ -373,14 +384,15 @@ private static function createListingGroupInfo( * @param int $customerId the customer ID * @param int $adGroupId the ad group ID * @param ListingGroupInfo $listingGroupInfo the listing group info - * @param int $cpcBidMicroAmount the CPC bid micro amount to set for the ad group criterion + * @param int $percentCpcBidMicroAmount the CPC bid micro amount to set for the ad group + * criterion * @return AdGroupCriterion the created ad group criterion */ private static function createAdGroupCriterion( $customerId, $adGroupId, ListingGroupInfo $listingGroupInfo, - $cpcBidMicroAmount + $percentCpcBidMicroAmount ) { $adGroupCriterion = new AdGroupCriterion(); $adGroupCriterion->setStatus(AdGroupStatusEnum_AdGroupStatus::ENABLED); @@ -393,8 +405,8 @@ private static function createAdGroupCriterion( // Bids are valid only for UNIT nodes. if ($listingGroupInfo->getType() == ListingGroupTypeEnum_ListingGroupType::UNIT) { $wrappedValue = new Int64Value(); - $wrappedValue->setValue($cpcBidMicroAmount); - $adGroupCriterion->setCpcBidMicros($wrappedValue); + $wrappedValue->setValue($percentCpcBidMicroAmount); + $adGroupCriterion->setPercentCpcBidMicros($wrappedValue); } return $adGroupCriterion; diff --git a/examples/Recommendations/ApplyRecommendation.php b/examples/Recommendations/ApplyRecommendation.php index 608be4e82..d023de5b2 100644 --- a/examples/Recommendations/ApplyRecommendation.php +++ b/examples/Recommendations/ApplyRecommendation.php @@ -49,7 +49,7 @@ public static function main() { // Either pass the required parameters for this example on the command line, or insert them // into the constants above. - $options = ArgumentParser::parseCommandArguments([ + $options = (new ArgumentParser())->parseCommandArguments([ ArgumentNames::CUSTOMER_ID => GetOpt::REQUIRED_ARGUMENT, ArgumentNames::RECOMMENDATION_ID => GetOpt::REQUIRED_ARGUMENT ]); diff --git a/examples/Recommendations/GetTextAdRecommendations.php b/examples/Recommendations/GetTextAdRecommendations.php index 3359e1a48..c636e40a5 100644 --- a/examples/Recommendations/GetTextAdRecommendations.php +++ b/examples/Recommendations/GetTextAdRecommendations.php @@ -42,7 +42,7 @@ public static function main() { // Either pass the required parameters for this example on the command line, or insert them // into the constants above. - $options = ArgumentParser::parseCommandArguments([ + $options = (new ArgumentParser())->parseCommandArguments([ ArgumentNames::CUSTOMER_ID => GetOpt::REQUIRED_ARGUMENT ]); diff --git a/examples/Reporting/GetKeywordStats.php b/examples/Reporting/GetKeywordStats.php index b5d8ca2b5..ec21611ba 100644 --- a/examples/Reporting/GetKeywordStats.php +++ b/examples/Reporting/GetKeywordStats.php @@ -43,7 +43,7 @@ public static function main() { // Either pass the required parameters for this example on the command line, or insert them // into the constants above. - $options = ArgumentParser::parseCommandArguments([ + $options = (new ArgumentParser())->parseCommandArguments([ ArgumentNames::CUSTOMER_ID => GetOpt::REQUIRED_ARGUMENT ]); diff --git a/examples/Targeting/AddCampaignTargetingCriteria.php b/examples/Targeting/AddCampaignTargetingCriteria.php index 7a39b0b36..d8251a996 100644 --- a/examples/Targeting/AddCampaignTargetingCriteria.php +++ b/examples/Targeting/AddCampaignTargetingCriteria.php @@ -49,7 +49,7 @@ public static function main() { // Either pass the required parameters for this example on the command line, or insert them // into the constants above. - $options = ArgumentParser::parseCommandArguments([ + $options = (new ArgumentParser())->parseCommandArguments([ ArgumentNames::CUSTOMER_ID => GetOpt::REQUIRED_ARGUMENT, ArgumentNames::CAMPAIGN_ID => GetOpt::REQUIRED_ARGUMENT ]); diff --git a/examples/Targeting/GetCampaignTargetingCriteria.php b/examples/Targeting/GetCampaignTargetingCriteria.php index 2d5789197..ff4f76daf 100644 --- a/examples/Targeting/GetCampaignTargetingCriteria.php +++ b/examples/Targeting/GetCampaignTargetingCriteria.php @@ -46,7 +46,7 @@ public static function main() { // Either pass the required parameters for this example on the command line, or insert them // into the constants above. - $options = ArgumentParser::parseCommandArguments([ + $options = (new ArgumentParser())->parseCommandArguments([ ArgumentNames::CUSTOMER_ID => GetOpt::REQUIRED_ARGUMENT, ArgumentNames::CAMPAIGN_ID => GetOpt::REQUIRED_ARGUMENT ]); diff --git a/examples/Utils/ArgumentNames.php b/examples/Utils/ArgumentNames.php index ad76f18ab..c492c3031 100644 --- a/examples/Utils/ArgumentNames.php +++ b/examples/Utils/ArgumentNames.php @@ -28,11 +28,13 @@ final class ArgumentNames const CAMPAIGN_BUDGET_ID = 'campaignBudgetId'; const CAMPAIGN_ID = 'campaignId'; const CHECK_IN_DAY_CRITERION_ID = 'checkInDayCriterionId'; + const CPC_BID_CEILING_MICRO_AMOUNT = 'cpcBidCeilingMicroAmount'; const CPC_BID_MICRO_AMOUNT = 'cpcBidMicroAmount'; const CRITERION_ID = 'criterionId'; const CUSTOMER_ID = 'customerId'; const HOTEL_CENTER_ACCOUNT_ID = 'hotelCenterAccountId'; const KEYWORD_TEXT = 'keywordText'; + const PERCENT_CPC_BID_MICRO_AMOUNT = 'percentCpcBidMicroAmount'; const RECOMMENDATION_ID = 'recommendationId'; public static $ARGUMENTS_TO_DESCRIPTIONS = [ @@ -41,12 +43,15 @@ final class ArgumentNames self::ARTIFACT_NAME => 'The artifact name', self::CAMPAIGN_BUDGET_ID => 'The campaign budget ID', self::CAMPAIGN_ID => 'The campaign ID', + self::CPC_BID_CEILING_MICRO_AMOUNT => 'The CPC bid ceiling micro amount', self::CPC_BID_MICRO_AMOUNT => 'The CPC bid micro amount', self::CRITERION_ID => 'The criterion ID', self::CUSTOMER_ID => 'The customer ID without dashes', self::HOTEL_CENTER_ACCOUNT_ID => 'The hotel center account ID', self::CHECK_IN_DAY_CRITERION_ID => 'The hotel check-in day criterion ID', self::KEYWORD_TEXT => 'The keyword text', + self::PERCENT_CPC_BID_MICRO_AMOUNT => + 'The CPC bid micro amount for the Percent CPC bidding strategy', self::RECOMMENDATION_ID => 'The recommendation ID' ]; } diff --git a/examples/Utils/ArgumentParser.php b/examples/Utils/ArgumentParser.php index 6c6780fcd..4e8e0166d 100644 --- a/examples/Utils/ArgumentParser.php +++ b/examples/Utils/ArgumentParser.php @@ -18,15 +18,15 @@ namespace Google\Ads\GoogleAds\Examples\Utils; use GetOpt\ArgumentException; -use GetOpt\ArgumentException\Missing; use GetOpt\GetOpt; +use InvalidArgumentException; /** * Wraps `GetOpt` and normalizes arguments parsed by it. * * @see GetOpt */ -final class ArgumentParser +class ArgumentParser { /** * Parses any arguments specified via the command line. For those in the provided argument @@ -35,7 +35,7 @@ final class ArgumentParser * @param array $argumentNames the associative array of argument names to their types * @return array the argument names to their values */ - public static function parseCommandArguments(array $argumentNames) + public function parseCommandArguments(array $argumentNames) { $getOpt = new GetOpt(); $normalizedOptions = []; @@ -44,12 +44,14 @@ public static function parseCommandArguments(array $argumentNames) foreach ($argumentNames as $argumentName => $argumentType) { $normalizedOptions[$argumentName] = null; // Adds an option for an argument using a long option name only. - $getOpt->addOption([ - null, - $argumentName, - $argumentType, - ArgumentNames::$ARGUMENTS_TO_DESCRIPTIONS[$argumentName] - ]); + $getOpt->addOption( + [ + null, + $argumentName, + $argumentType, + ArgumentNames::$ARGUMENTS_TO_DESCRIPTIONS[$argumentName] + ] + ); if ($argumentType === GetOpt::REQUIRED_ARGUMENT) { $numRequiredArguments++; @@ -63,14 +65,15 @@ public static function parseCommandArguments(array $argumentNames) // When there are any errors regarding arguments, such as invalid argument names, or // specifying required arguments but not providing values, 'ArgumentException' will // be thrown. Show the help text in these cases. - fwrite(STDERR, $exception->getMessage() . PHP_EOL); echo PHP_EOL . $getOpt->getHelpText(); - exit; + throw $exception; } // Show help text when requested. if (!is_null($getOpt->getOption('help'))) { - echo PHP_EOL . $getOpt->getHelpText(); - exit; + $this->printHelpMessageAndExit($getOpt); + // Help text is printed, so no arguments are passed. The below line is reached only + // in tests. + return []; } $numPassedRequiredArguments = 0; @@ -83,13 +86,22 @@ public static function parseCommandArguments(array $argumentNames) // Don't allow the case when optional arguments are passed, but required arguments are not. if (count($getOpt->getOptions()) > 0 && $numPassedRequiredArguments !== $numRequiredArguments) { - fwrite( - STDERR, + echo PHP_EOL . $getOpt->getHelpText(); + throw new InvalidArgumentException( 'All required arguments must be specified.' . PHP_EOL ); - echo PHP_EOL . $getOpt->getHelpText(); - exit; } return $normalizedOptions; } + + /** + * Print the help message and exit the program. + * + * @param GetOpt $getOpt the GetOpt object to print its help text + */ + public function printHelpMessageAndExit(GetOpt $getOpt) + { + echo PHP_EOL . $getOpt->getHelpText(); + exit; + } } diff --git a/metadata/Google/Ads/GoogleAds/V0/Common/Bidding.php b/metadata/Google/Ads/GoogleAds/V0/Common/Bidding.php index 88357da1a..6d23ebb42 100644 --- a/metadata/Google/Ads/GoogleAds/V0/Common/Bidding.php +++ b/metadata/Google/Ads/GoogleAds/V0/Common/Bidding.php @@ -17,7 +17,7 @@ public static function initOnce() { \GPBMetadata\Google\Ads\GoogleAds\V0\Enums\PageOnePromotedStrategyGoal::initOnce(); \GPBMetadata\Google\Protobuf\Wrappers::initOnce(); $pool->internalAddGeneratedFile(hex2bin( - "0aa00e0a2c676f6f676c652f6164732f676f6f676c656164732f76302f63" . + "0aa60f0a2c676f6f676c652f6164732f676f6f676c656164732f76302f63" . "6f6d6d6f6e2f62696464696e672e70726f746f121e676f6f676c652e6164" . "732e676f6f676c656164732e76302e636f6d6d6f6e1a1e676f6f676c652f" . "70726f746f6275662f77726170706572732e70726f746f220d0a0b456e68" . @@ -71,13 +71,18 @@ public static function initOnce() { "280b321b2e676f6f676c652e70726f746f6275662e496e74363456616c75" . "65123b0a166370635f6269645f6365696c696e675f6d6963726f73180220" . "01280b321b2e676f6f676c652e70726f746f6275662e496e74363456616c" . - "756542c2010a22636f6d2e676f6f676c652e6164732e676f6f676c656164" . - "732e76302e636f6d6d6f6e420c42696464696e6750726f746f50015a4467" . - "6f6f676c652e676f6c616e672e6f72672f67656e70726f746f2f676f6f67" . - "6c65617069732f6164732f676f6f676c656164732f76302f636f6d6d6f6e" . - "3b636f6d6d6f6ea20203474141aa021e476f6f676c652e4164732e476f6f" . - "676c654164732e56302e436f6d6d6f6eca021e476f6f676c655c4164735c" . - "476f6f676c654164735c56305c436f6d6d6f6e620670726f746f33" + "75652283010a0a50657263656e74437063123b0a166370635f6269645f63" . + "65696c696e675f6d6963726f7318012001280b321b2e676f6f676c652e70" . + "726f746f6275662e496e74363456616c756512380a14656e68616e636564" . + "5f6370635f656e61626c656418022001280b321a2e676f6f676c652e7072" . + "6f746f6275662e426f6f6c56616c756542c2010a22636f6d2e676f6f676c" . + "652e6164732e676f6f676c656164732e76302e636f6d6d6f6e420c426964" . + "64696e6750726f746f50015a44676f6f676c652e676f6c616e672e6f7267" . + "2f67656e70726f746f2f676f6f676c65617069732f6164732f676f6f676c" . + "656164732f76302f636f6d6d6f6e3b636f6d6d6f6ea20203474141aa021e" . + "476f6f676c652e4164732e476f6f676c654164732e56302e436f6d6d6f6e" . + "ca021e476f6f676c655c4164735c476f6f676c654164735c56305c436f6d" . + "6d6f6e620670726f746f33" )); static::$is_initialized = true; diff --git a/metadata/Google/Ads/GoogleAds/V0/Enums/BiddingStrategyType.php b/metadata/Google/Ads/GoogleAds/V0/Enums/BiddingStrategyType.php index 14d1d58e7..6cf66f21c 100644 --- a/metadata/Google/Ads/GoogleAds/V0/Enums/BiddingStrategyType.php +++ b/metadata/Google/Ads/GoogleAds/V0/Enums/BiddingStrategyType.php @@ -15,26 +15,27 @@ public static function initOnce() { return; } $pool->internalAddGeneratedFile(hex2bin( - "0acf040a39676f6f676c652f6164732f676f6f676c656164732f76302f65" . + "0ae0040a39676f6f676c652f6164732f676f6f676c656164732f76302f65" . "6e756d732f62696464696e675f73747261746567795f747970652e70726f" . "746f121d676f6f676c652e6164732e676f6f676c656164732e76302e656e" . - "756d73229e020a1742696464696e67537472617465677954797065456e75" . - "6d2282020a1342696464696e67537472617465677954797065120f0a0b55" . + "756d7322af020a1742696464696e67537472617465677954797065456e75" . + "6d2293020a1342696464696e67537472617465677954797065120f0a0b55" . "4e5350454349464945441000120b0a07554e4b4e4f574e100112100a0c45" . "4e48414e4345445f4350431002120e0a0a4d414e55414c5f435043100312" . "0e0a0a4d414e55414c5f43504d100412180a144d4158494d495a455f434f" . "4e56455253494f4e53100a121d0a194d4158494d495a455f434f4e564552" . "53494f4e5f56414c5545100b12150a11504147455f4f4e455f50524f4d4f" . - "5445441005120e0a0a5441524745545f435041100612180a145441524745" . - "545f4f555452414e4b5f53484152451007120f0a0b5441524745545f524f" . - "4153100812100a0c5441524745545f5350454e44100942c9010a21636f6d" . - "2e676f6f676c652e6164732e676f6f676c656164732e76302e656e756d73" . - "421842696464696e6753747261746567795479706550726f746f50015a42" . - "676f6f676c652e676f6c616e672e6f72672f67656e70726f746f2f676f6f" . - "676c65617069732f6164732f676f6f676c656164732f76302f656e756d73" . - "3b656e756d73a20203474141aa021d476f6f676c652e4164732e476f6f67" . - "6c654164732e56302e456e756d73ca021d476f6f676c655c4164735c476f" . - "6f676c654164735c56305c456e756d73620670726f746f33" + "5445441005120f0a0b50455243454e545f435043100c120e0a0a54415247" . + "45545f435041100612180a145441524745545f4f555452414e4b5f534841" . + "52451007120f0a0b5441524745545f524f4153100812100a0c5441524745" . + "545f5350454e44100942c9010a21636f6d2e676f6f676c652e6164732e67" . + "6f6f676c656164732e76302e656e756d73421842696464696e6753747261" . + "746567795479706550726f746f50015a42676f6f676c652e676f6c616e67" . + "2e6f72672f67656e70726f746f2f676f6f676c65617069732f6164732f67" . + "6f6f676c656164732f76302f656e756d733b656e756d73a20203474141aa" . + "021d476f6f676c652e4164732e476f6f676c654164732e56302e456e756d" . + "73ca021d476f6f676c655c4164735c476f6f676c654164735c56305c456e" . + "756d73620670726f746f33" )); static::$is_initialized = true; diff --git a/metadata/Google/Ads/GoogleAds/V0/Errors/CriterionError.php b/metadata/Google/Ads/GoogleAds/V0/Errors/CriterionError.php index dcd25bf11..a2a615bcb 100644 --- a/metadata/Google/Ads/GoogleAds/V0/Errors/CriterionError.php +++ b/metadata/Google/Ads/GoogleAds/V0/Errors/CriterionError.php @@ -15,10 +15,10 @@ public static function initOnce() { return; } $pool->internalAddGeneratedFile(hex2bin( - "0aa01a0a34676f6f676c652f6164732f676f6f676c656164732f76302f65" . + "0ad01a0a34676f6f676c652f6164732f676f6f676c656164732f76302f65" . "72726f72732f637269746572696f6e5f6572726f722e70726f746f121e67" . "6f6f676c652e6164732e676f6f676c656164732e76302e6572726f727322" . - "f3170a12437269746572696f6e4572726f72456e756d22dc170a0e437269" . + "a3180a12437269746572696f6e4572726f72456e756d228c180a0e437269" . "746572696f6e4572726f72120f0a0b554e5350454349464945441000120b" . "0a07554e4b4e4f574e1001121a0a16434f4e43524554455f545950455f52" . "455155495245441002121d0a19494e56414c49445f4558434c554445445f" . @@ -120,14 +120,15 @@ public static function initOnce() { "4954485f4558495354494e475f435249544552494f4e105212410a3d484f" . "54454c5f414456414e43455f424f4f4b494e475f57494e444f575f4f5645" . "524c4150535f574954485f4558495354494e475f435249544552494f4e10" . - "5342c9010a22636f6d2e676f6f676c652e6164732e676f6f676c65616473" . - "2e76302e6572726f72734213437269746572696f6e4572726f7250726f74" . - "6f50015a44676f6f676c652e676f6c616e672e6f72672f67656e70726f74" . - "6f2f676f6f676c65617069732f6164732f676f6f676c656164732f76302f" . - "6572726f72733b6572726f7273a20203474141aa021e476f6f676c652e41" . - "64732e476f6f676c654164732e56302e4572726f7273ca021e476f6f676c" . - "655c4164735c476f6f676c654164735c56305c4572726f7273620670726f" . - "746f33" + "53122e0a2a4649454c445f494e434f4d50415449424c455f574954485f4e" . + "454741544956455f544152474554494e47105442c9010a22636f6d2e676f" . + "6f676c652e6164732e676f6f676c656164732e76302e6572726f72734213" . + "437269746572696f6e4572726f7250726f746f50015a44676f6f676c652e" . + "676f6c616e672e6f72672f67656e70726f746f2f676f6f676c6561706973" . + "2f6164732f676f6f676c656164732f76302f6572726f72733b6572726f72" . + "73a20203474141aa021e476f6f676c652e4164732e476f6f676c65416473" . + "2e56302e4572726f7273ca021e476f6f676c655c4164735c476f6f676c65" . + "4164735c56305c4572726f7273620670726f746f33" )); static::$is_initialized = true; diff --git a/metadata/Google/Ads/GoogleAds/V0/Resources/AdGroup.php b/metadata/Google/Ads/GoogleAds/V0/Resources/AdGroup.php index 45e097a41..42852eae2 100644 --- a/metadata/Google/Ads/GoogleAds/V0/Resources/AdGroup.php +++ b/metadata/Google/Ads/GoogleAds/V0/Resources/AdGroup.php @@ -19,14 +19,14 @@ public static function initOnce() { \GPBMetadata\Google\Ads\GoogleAds\V0\Enums\AdGroupType::initOnce(); \GPBMetadata\Google\Protobuf\Wrappers::initOnce(); $pool->internalAddGeneratedFile(hex2bin( - "0a98090a30676f6f676c652f6164732f676f6f676c656164732f76302f72" . + "0ad5090a30676f6f676c652f6164732f676f6f676c656164732f76302f72" . "65736f75726365732f61645f67726f75702e70726f746f1221676f6f676c" . "652e6164732e676f6f676c656164732e76302e7265736f75726365731a33" . "676f6f676c652f6164732f676f6f676c656164732f76302f656e756d732f" . "61645f67726f75705f7374617475732e70726f746f1a31676f6f676c652f" . "6164732f676f6f676c656164732f76302f656e756d732f61645f67726f75" . "705f747970652e70726f746f1a1e676f6f676c652f70726f746f6275662f" . - "77726170706572732e70726f746f22dc050a07416447726f757012150a0d" . + "77726170706572732e70726f746f2299060a07416447726f757012150a0d" . "7265736f757263655f6e616d6518012001280912270a0269641803200128" . "0b321b2e676f6f676c652e70726f746f6275662e496e74363456616c7565" . "122a0a046e616d6518042001280b321c2e676f6f676c652e70726f746f62" . @@ -50,15 +50,17 @@ public static function initOnce() { "3456616c756512330a0e6370765f6269645f6d6963726f7318112001280b" . "321b2e676f6f676c652e70726f746f6275662e496e74363456616c756512" . "3a0a147461726765745f726f61735f6f7665727269646518132001280b32" . - "1c2e676f6f676c652e70726f746f6275662e446f75626c6556616c756542" . - "d1010a25636f6d2e676f6f676c652e6164732e676f6f676c656164732e76" . - "302e7265736f7572636573420c416447726f757050726f746f50015a4a67" . - "6f6f676c652e676f6c616e672e6f72672f67656e70726f746f2f676f6f67" . - "6c65617069732f6164732f676f6f676c656164732f76302f7265736f7572" . - "6365733b7265736f7572636573a20203474141aa0221476f6f676c652e41" . - "64732e476f6f676c654164732e56302e5265736f7572636573ca0221476f" . - "6f676c655c4164735c476f6f676c654164735c56305c5265736f75726365" . - "73620670726f746f33" + "1c2e676f6f676c652e70726f746f6275662e446f75626c6556616c756512" . + "3b0a1670657263656e745f6370635f6269645f6d6963726f731814200128" . + "0b321b2e676f6f676c652e70726f746f6275662e496e74363456616c7565" . + "42d1010a25636f6d2e676f6f676c652e6164732e676f6f676c656164732e" . + "76302e7265736f7572636573420c416447726f757050726f746f50015a4a" . + "676f6f676c652e676f6c616e672e6f72672f67656e70726f746f2f676f6f" . + "676c65617069732f6164732f676f6f676c656164732f76302f7265736f75" . + "726365733b7265736f7572636573a20203474141aa0221476f6f676c652e" . + "4164732e476f6f676c654164732e56302e5265736f7572636573ca022147" . + "6f6f676c655c4164735c476f6f676c654164735c56305c5265736f757263" . + "6573620670726f746f33" )); static::$is_initialized = true; diff --git a/metadata/Google/Ads/GoogleAds/V0/Resources/AdGroupCriterion.php b/metadata/Google/Ads/GoogleAds/V0/Resources/AdGroupCriterion.php index b598a1b20..5f5780f64 100644 --- a/metadata/Google/Ads/GoogleAds/V0/Resources/AdGroupCriterion.php +++ b/metadata/Google/Ads/GoogleAds/V0/Resources/AdGroupCriterion.php @@ -22,7 +22,7 @@ public static function initOnce() { \GPBMetadata\Google\Ads\GoogleAds\V0\Enums\QualityScoreBucket::initOnce(); \GPBMetadata\Google\Protobuf\Wrappers::initOnce(); $pool->internalAddGeneratedFile(hex2bin( - "0acd150a3a676f6f676c652f6164732f676f6f676c656164732f76302f72" . + "0abb170a3a676f6f676c652f6164732f676f6f676c656164732f76302f72" . "65736f75726365732f61645f67726f75705f637269746572696f6e2e7072" . "6f746f1221676f6f676c652e6164732e676f6f676c656164732e76302e72" . "65736f75726365731a35676f6f676c652f6164732f676f6f676c65616473" . @@ -35,7 +35,7 @@ public static function initOnce() { "637269746572696f6e5f747970652e70726f746f1a38676f6f676c652f61" . "64732f676f6f676c656164732f76302f656e756d732f7175616c6974795f" . "73636f72655f6275636b65742e70726f746f1a1e676f6f676c652f70726f" . - "746f6275662f77726170706572732e70726f746f22ce100a10416447726f" . + "746f6275662f77726170706572732e70726f746f22bc120a10416447726f" . "7570437269746572696f6e12150a0d7265736f757263655f6e616d651801" . "2001280912310a0c637269746572696f6e5f6964181a2001280b321b2e67" . "6f6f676c652e70726f746f6275662e496e74363456616c756512600a0673" . @@ -56,65 +56,73 @@ public static function initOnce() { "726f7318112001280b321b2e676f6f676c652e70726f746f6275662e496e" . "74363456616c756512330a0e6370765f6269645f6d6963726f7318182001" . "280b321b2e676f6f676c652e70726f746f6275662e496e74363456616c75" . - "65123d0a186566666563746976655f6370635f6269645f6d6963726f7318" . - "122001280b321b2e676f6f676c652e70726f746f6275662e496e74363456" . - "616c7565123d0a186566666563746976655f63706d5f6269645f6d696372" . - "6f7318132001280b321b2e676f6f676c652e70726f746f6275662e496e74" . - "363456616c7565123d0a186566666563746976655f6370765f6269645f6d" . - "6963726f7318142001280b321b2e676f6f676c652e70726f746f6275662e" . - "496e74363456616c756512600a186566666563746976655f6370635f6269" . - "645f736f7572636518152001280e323e2e676f6f676c652e6164732e676f" . - "6f676c656164732e76302e656e756d732e42696464696e67536f75726365" . - "456e756d2e42696464696e67536f7572636512600a186566666563746976" . - "655f63706d5f6269645f736f7572636518162001280e323e2e676f6f676c" . - "652e6164732e676f6f676c656164732e76302e656e756d732e4269646469" . - "6e67536f75726365456e756d2e42696464696e67536f7572636512600a18" . - "6566666563746976655f6370765f6269645f736f7572636518172001280e" . - "323e2e676f6f676c652e6164732e676f6f676c656164732e76302e656e75" . - "6d732e42696464696e67536f75726365456e756d2e42696464696e67536f" . - "7572636512610a12706f736974696f6e5f657374696d61746573180a2001" . - "280b32452e676f6f676c652e6164732e676f6f676c656164732e76302e72" . - "65736f75726365732e416447726f7570437269746572696f6e2e506f7369" . - "74696f6e457374696d6174657312300a0a66696e616c5f75726c73180b20" . - "03280b321c2e676f6f676c652e70726f746f6275662e537472696e675661" . - "6c7565123b0a15747261636b696e675f75726c5f74656d706c617465180d" . - "2001280b321c2e676f6f676c652e70726f746f6275662e537472696e6756" . - "616c7565124e0a1575726c5f637573746f6d5f706172616d657465727318" . - "0e2003280b322f2e676f6f676c652e6164732e676f6f676c656164732e76" . - "302e636f6d6d6f6e2e437573746f6d506172616d65746572123e0a076b65" . - "79776f7264181b2001280b322b2e676f6f676c652e6164732e676f6f676c" . - "656164732e76302e636f6d6d6f6e2e4b6579776f7264496e666f48001249" . - "0a0d6c697374696e675f67726f757018202001280b32302e676f6f676c65" . - "2e6164732e676f6f676c656164732e76302e636f6d6d6f6e2e4c69737469" . - "6e6747726f7570496e666f48001aff020a0b5175616c697479496e666f12" . - "320a0d7175616c6974795f73636f726518012001280b321b2e676f6f676c" . - "652e70726f746f6275662e496e74333256616c756512680a166372656174" . - "6976655f7175616c6974795f73636f726518022001280e32482e676f6f67" . + "65123b0a1670657263656e745f6370635f6269645f6d6963726f73182120" . + "01280b321b2e676f6f676c652e70726f746f6275662e496e74363456616c" . + "7565123d0a186566666563746976655f6370635f6269645f6d6963726f73" . + "18122001280b321b2e676f6f676c652e70726f746f6275662e496e743634" . + "56616c7565123d0a186566666563746976655f63706d5f6269645f6d6963" . + "726f7318132001280b321b2e676f6f676c652e70726f746f6275662e496e" . + "74363456616c7565123d0a186566666563746976655f6370765f6269645f" . + "6d6963726f7318142001280b321b2e676f6f676c652e70726f746f627566" . + "2e496e74363456616c756512450a206566666563746976655f7065726365" . + "6e745f6370635f6269645f6d6963726f7318222001280b321b2e676f6f67" . + "6c652e70726f746f6275662e496e74363456616c756512600a1865666665" . + "63746976655f6370635f6269645f736f7572636518152001280e323e2e67" . + "6f6f676c652e6164732e676f6f676c656164732e76302e656e756d732e42" . + "696464696e67536f75726365456e756d2e42696464696e67536f75726365" . + "12600a186566666563746976655f63706d5f6269645f736f757263651816" . + "2001280e323e2e676f6f676c652e6164732e676f6f676c656164732e7630" . + "2e656e756d732e42696464696e67536f75726365456e756d2e4269646469" . + "6e67536f7572636512600a186566666563746976655f6370765f6269645f" . + "736f7572636518172001280e323e2e676f6f676c652e6164732e676f6f67" . + "6c656164732e76302e656e756d732e42696464696e67536f75726365456e" . + "756d2e42696464696e67536f7572636512680a206566666563746976655f" . + "70657263656e745f6370635f6269645f736f7572636518232001280e323e" . + "2e676f6f676c652e6164732e676f6f676c656164732e76302e656e756d73" . + "2e42696464696e67536f75726365456e756d2e42696464696e67536f7572" . + "636512610a12706f736974696f6e5f657374696d61746573180a2001280b" . + "32452e676f6f676c652e6164732e676f6f676c656164732e76302e726573" . + "6f75726365732e416447726f7570437269746572696f6e2e506f73697469" . + "6f6e457374696d6174657312300a0a66696e616c5f75726c73180b200328" . + "0b321c2e676f6f676c652e70726f746f6275662e537472696e6756616c75" . + "65123b0a15747261636b696e675f75726c5f74656d706c617465180d2001" . + "280b321c2e676f6f676c652e70726f746f6275662e537472696e6756616c" . + "7565124e0a1575726c5f637573746f6d5f706172616d6574657273180e20" . + "03280b322f2e676f6f676c652e6164732e676f6f676c656164732e76302e" . + "636f6d6d6f6e2e437573746f6d506172616d65746572123e0a076b657977" . + "6f7264181b2001280b322b2e676f6f676c652e6164732e676f6f676c6561" . + "64732e76302e636f6d6d6f6e2e4b6579776f7264496e666f480012490a0d" . + "6c697374696e675f67726f757018202001280b32302e676f6f676c652e61" . + "64732e676f6f676c656164732e76302e636f6d6d6f6e2e4c697374696e67" . + "47726f7570496e666f48001aff020a0b5175616c697479496e666f12320a" . + "0d7175616c6974795f73636f726518012001280b321b2e676f6f676c652e" . + "70726f746f6275662e496e74333256616c756512680a1663726561746976" . + "655f7175616c6974795f73636f726518022001280e32482e676f6f676c65" . + "2e6164732e676f6f676c656164732e76302e656e756d732e5175616c6974" . + "7953636f72654275636b6574456e756d2e5175616c69747953636f726542" . + "75636b6574126a0a18706f73745f636c69636b5f7175616c6974795f7363" . + "6f726518032001280e32482e676f6f676c652e6164732e676f6f676c6561" . + "64732e76302e656e756d732e5175616c69747953636f72654275636b6574" . + "456e756d2e5175616c69747953636f72654275636b657412660a14736561" . + "7263685f7072656469637465645f63747218042001280e32482e676f6f67" . "6c652e6164732e676f6f676c656164732e76302e656e756d732e5175616c" . "69747953636f72654275636b6574456e756d2e5175616c69747953636f72" . - "654275636b6574126a0a18706f73745f636c69636b5f7175616c6974795f" . - "73636f726518032001280e32482e676f6f676c652e6164732e676f6f676c" . - "656164732e76302e656e756d732e5175616c69747953636f72654275636b" . - "6574456e756d2e5175616c69747953636f72654275636b657412660a1473" . - "65617263685f7072656469637465645f63747218042001280e32482e676f" . - "6f676c652e6164732e676f6f676c656164732e76302e656e756d732e5175" . - "616c69747953636f72654275636b6574456e756d2e5175616c6974795363" . - "6f72654275636b65741acc010a11506f736974696f6e457374696d617465" . - "73123a0a1566697273745f706167655f6370635f6d6963726f7318012001" . - "280b321b2e676f6f676c652e70726f746f6275662e496e74363456616c75" . - "65123e0a1966697273745f706f736974696f6e5f6370635f6d6963726f73" . - "18022001280b321b2e676f6f676c652e70726f746f6275662e496e743634" . - "56616c7565123b0a16746f705f6f665f706167655f6370635f6d6963726f" . - "7318032001280b321b2e676f6f676c652e70726f746f6275662e496e7436" . - "3456616c7565420b0a09637269746572696f6e42da010a25636f6d2e676f" . - "6f676c652e6164732e676f6f676c656164732e76302e7265736f75726365" . - "734215416447726f7570437269746572696f6e50726f746f50015a4a676f" . - "6f676c652e676f6c616e672e6f72672f67656e70726f746f2f676f6f676c" . - "65617069732f6164732f676f6f676c656164732f76302f7265736f757263" . - "65733b7265736f7572636573a20203474141aa0221476f6f676c652e4164" . - "732e476f6f676c654164732e56302e5265736f7572636573ca0221476f6f" . - "676c655c4164735c476f6f676c654164735c56305c5265736f7572636573" . - "620670726f746f33" + "654275636b65741acc010a11506f736974696f6e457374696d6174657312" . + "3a0a1566697273745f706167655f6370635f6d6963726f7318012001280b" . + "321b2e676f6f676c652e70726f746f6275662e496e74363456616c756512" . + "3e0a1966697273745f706f736974696f6e5f6370635f6d6963726f731802" . + "2001280b321b2e676f6f676c652e70726f746f6275662e496e7436345661" . + "6c7565123b0a16746f705f6f665f706167655f6370635f6d6963726f7318" . + "032001280b321b2e676f6f676c652e70726f746f6275662e496e74363456" . + "616c7565420b0a09637269746572696f6e42da010a25636f6d2e676f6f67" . + "6c652e6164732e676f6f676c656164732e76302e7265736f757263657342" . + "15416447726f7570437269746572696f6e50726f746f50015a4a676f6f67" . + "6c652e676f6c616e672e6f72672f67656e70726f746f2f676f6f676c6561" . + "7069732f6164732f676f6f676c656164732f76302f7265736f7572636573" . + "3b7265736f7572636573a20203474141aa0221476f6f676c652e4164732e" . + "476f6f676c654164732e56302e5265736f7572636573ca0221476f6f676c" . + "655c4164735c476f6f676c654164735c56305c5265736f75726365736206" . + "70726f746f33" )); static::$is_initialized = true; diff --git a/metadata/Google/Ads/GoogleAds/V0/Resources/Campaign.php b/metadata/Google/Ads/GoogleAds/V0/Resources/Campaign.php index 7a2b3c276..dbc9b10b6 100644 --- a/metadata/Google/Ads/GoogleAds/V0/Resources/Campaign.php +++ b/metadata/Google/Ads/GoogleAds/V0/Resources/Campaign.php @@ -24,7 +24,7 @@ public static function initOnce() { \GPBMetadata\Google\Ads\GoogleAds\V0\Enums\CampaignStatus::initOnce(); \GPBMetadata\Google\Protobuf\Wrappers::initOnce(); $pool->internalAddGeneratedFile(hex2bin( - "0ae0190a30676f6f676c652f6164732f676f6f676c656164732f76302f72" . + "0aa31a0a30676f6f676c652f6164732f676f6f676c656164732f76302f72" . "65736f75726365732f63616d706169676e2e70726f746f1221676f6f676c" . "652e6164732e676f6f676c656164732e76302e7265736f75726365731a35" . "676f6f676c652f6164732f676f6f676c656164732f76302f636f6d6d6f6e" . @@ -42,7 +42,7 @@ public static function initOnce() { "7475732e70726f746f1a33676f6f676c652f6164732f676f6f676c656164" . "732f76302f656e756d732f63616d706169676e5f7374617475732e70726f" . "746f1a1e676f6f676c652f70726f746f6275662f77726170706572732e70" . - "726f746f22e3130a0843616d706169676e12150a0d7265736f757263655f" . + "726f746f22a6140a0843616d706169676e12150a0d7265736f757263655f" . "6e616d6518012001280912270a02696418032001280b321b2e676f6f676c" . "652e70726f746f6275662e496e74363456616c7565122a0a046e616d6518" . "042001280b321c2e676f6f676c652e70726f746f6275662e537472696e67" . @@ -106,34 +106,37 @@ public static function initOnce() { "2e676f6f676c656164732e76302e636f6d6d6f6e2e546172676574526f61" . "73480012430a0c7461726765745f7370656e64181b2001280b322b2e676f" . "6f676c652e6164732e676f6f676c656164732e76302e636f6d6d6f6e2e54" . - "61726765745370656e6448001a85020a0f4e6574776f726b53657474696e" . - "677312380a147461726765745f676f6f676c655f73656172636818012001" . - "280b321a2e676f6f676c652e70726f746f6275662e426f6f6c56616c7565" . - "12390a157461726765745f7365617263685f6e6574776f726b1802200128" . - "0b321a2e676f6f676c652e70726f746f6275662e426f6f6c56616c756512" . - "3a0a167461726765745f636f6e74656e745f6e6574776f726b1803200128" . - "0b321a2e676f6f676c652e70726f746f6275662e426f6f6c56616c756512" . - "410a1d7461726765745f706172746e65725f7365617263685f6e6574776f" . - "726b18042001280b321a2e676f6f676c652e70726f746f6275662e426f6f" . - "6c56616c75651a480a10486f74656c53657474696e67496e666f12340a0f" . - "686f74656c5f63656e7465725f696418012001280b321b2e676f6f676c65" . - "2e70726f746f6275662e496e74363456616c75651aec010a1744796e616d" . - "696353656172636841647353657474696e6712310a0b646f6d61696e5f6e" . - "616d6518012001280b321c2e676f6f676c652e70726f746f6275662e5374" . - "72696e6756616c756512330a0d6c616e67756167655f636f646518022001" . - "280b321c2e676f6f676c652e70726f746f6275662e537472696e6756616c" . - "7565123a0a167573655f737570706c6965645f75726c735f6f6e6c791803" . - "2001280b321a2e676f6f676c652e70726f746f6275662e426f6f6c56616c" . - "7565122d0a08666565645f69647318042003280b321b2e676f6f676c652e" . - "70726f746f6275662e496e74363456616c7565421b0a1963616d70616967" . - "6e5f62696464696e675f737472617465677942d2010a25636f6d2e676f6f" . - "676c652e6164732e676f6f676c656164732e76302e7265736f7572636573" . - "420d43616d706169676e50726f746f50015a4a676f6f676c652e676f6c61" . - "6e672e6f72672f67656e70726f746f2f676f6f676c65617069732f616473" . - "2f676f6f676c656164732f76302f7265736f75726365733b7265736f7572" . - "636573a20203474141aa0221476f6f676c652e4164732e476f6f676c6541" . - "64732e56302e5265736f7572636573ca0221476f6f676c655c4164735c47" . - "6f6f676c654164735c56305c5265736f7572636573620670726f746f33" + "61726765745370656e64480012410a0b70657263656e745f637063182220" . + "01280b322a2e676f6f676c652e6164732e676f6f676c656164732e76302e" . + "636f6d6d6f6e2e50657263656e7443706348001a85020a0f4e6574776f72" . + "6b53657474696e677312380a147461726765745f676f6f676c655f736561" . + "72636818012001280b321a2e676f6f676c652e70726f746f6275662e426f" . + "6f6c56616c756512390a157461726765745f7365617263685f6e6574776f" . + "726b18022001280b321a2e676f6f676c652e70726f746f6275662e426f6f" . + "6c56616c7565123a0a167461726765745f636f6e74656e745f6e6574776f" . + "726b18032001280b321a2e676f6f676c652e70726f746f6275662e426f6f" . + "6c56616c756512410a1d7461726765745f706172746e65725f7365617263" . + "685f6e6574776f726b18042001280b321a2e676f6f676c652e70726f746f" . + "6275662e426f6f6c56616c75651a480a10486f74656c53657474696e6749" . + "6e666f12340a0f686f74656c5f63656e7465725f696418012001280b321b" . + "2e676f6f676c652e70726f746f6275662e496e74363456616c75651aec01" . + "0a1744796e616d696353656172636841647353657474696e6712310a0b64" . + "6f6d61696e5f6e616d6518012001280b321c2e676f6f676c652e70726f74" . + "6f6275662e537472696e6756616c756512330a0d6c616e67756167655f63" . + "6f646518022001280b321c2e676f6f676c652e70726f746f6275662e5374" . + "72696e6756616c7565123a0a167573655f737570706c6965645f75726c73" . + "5f6f6e6c7918032001280b321a2e676f6f676c652e70726f746f6275662e" . + "426f6f6c56616c7565122d0a08666565645f69647318042003280b321b2e" . + "676f6f676c652e70726f746f6275662e496e74363456616c7565421b0a19" . + "63616d706169676e5f62696464696e675f737472617465677942d2010a25" . + "636f6d2e676f6f676c652e6164732e676f6f676c656164732e76302e7265" . + "736f7572636573420d43616d706169676e50726f746f50015a4a676f6f67" . + "6c652e676f6c616e672e6f72672f67656e70726f746f2f676f6f676c6561" . + "7069732f6164732f676f6f676c656164732f76302f7265736f7572636573" . + "3b7265736f7572636573a20203474141aa0221476f6f676c652e4164732e" . + "476f6f676c654164732e56302e5265736f7572636573ca0221476f6f676c" . + "655c4164735c476f6f676c654164735c56305c5265736f75726365736206" . + "70726f746f33" )); static::$is_initialized = true; diff --git a/src/Google/Ads/GoogleAds/Util/FieldMasks.php b/src/Google/Ads/GoogleAds/Util/FieldMasks.php index 14c10592a..ab6b00ae8 100644 --- a/src/Google/Ads/GoogleAds/Util/FieldMasks.php +++ b/src/Google/Ads/GoogleAds/Util/FieldMasks.php @@ -223,7 +223,8 @@ private static function isFieldRepeated(FieldDescriptor $fieldDescriptor) /** * Recursively add field names for a new message. Repeated fields, primitive fields and * unpopulated single message fields are included just by name; populated single message fields - * are processed recursively, only including leaf nodes. + * are processed recursively, only including leaf nodes. For wrapper types, the 'value' leaf + * node is excluded. * * @param array $paths * @param $currentField @@ -232,22 +233,27 @@ private static function isFieldRepeated(FieldDescriptor $fieldDescriptor) private static function addNewFields(array &$paths, $currentField, $message) { $descriptor = self::getDescriptorForMessage($message); - for ($i = 0; $i < $descriptor->getFieldCount(); $i++) { - $fieldDescriptor = $descriptor->getField($i); - $fieldName = self::getFieldName($currentField, $fieldDescriptor); - // For single message fields, recurse if there's a value; - // otherwise just add the field name. - if (!self::isFieldRepeated($fieldDescriptor) - && $fieldDescriptor->getType() === GPBType::MESSAGE) { - $getter = Serializer::getGetter($fieldDescriptor->getName()); - $messageValue = $message->$getter(); - if (!is_null($messageValue)) { - self::addNewFields($paths, $fieldName, $messageValue); + if (self::isWrapperType($descriptor)) { + // For wrapper types, don't recurse over the fields of the message. + $paths[] = $currentField; + } else { + for ($i = 0; $i < $descriptor->getFieldCount(); $i++) { + $fieldDescriptor = $descriptor->getField($i); + $fieldName = self::getFieldName($currentField, $fieldDescriptor); + // For single message fields, recurse if there's a value; + // otherwise just add the field name. + if (!self::isFieldRepeated($fieldDescriptor) + && $fieldDescriptor->getType() === GPBType::MESSAGE) { + $getter = Serializer::getGetter($fieldDescriptor->getName()); + $messageValue = $message->$getter(); + if (!is_null($messageValue)) { + self::addNewFields($paths, $fieldName, $messageValue); + } else { + $paths[] = $fieldName; + } } else { $paths[] = $fieldName; } - } else { - $paths[] = $fieldName; } } } diff --git a/src/Google/Ads/GoogleAds/Util/Testing/Google/Ads/GoogleAds/Util/Testing/Bar.php b/src/Google/Ads/GoogleAds/Util/Testing/Google/Ads/GoogleAds/Util/Testing/Bar.php index e5ba4a8d0..7e674ebd8 100644 --- a/src/Google/Ads/GoogleAds/Util/Testing/Google/Ads/GoogleAds/Util/Testing/Bar.php +++ b/src/Google/Ads/GoogleAds/Util/Testing/Google/Ads/GoogleAds/Util/Testing/Bar.php @@ -17,6 +17,10 @@ class Bar extends \Google\Protobuf\Internal\Message * Generated from protobuf field int64 num = 1; */ private $num = 0; + /** + * Generated from protobuf field .google.protobuf.BoolValue nested_wrapper = 2; + */ + private $nested_wrapper = null; public function __construct() { \GPBMetadata\Google\Ads\GoogleAds\Util\Testing\Tester::initOnce(); @@ -45,5 +49,27 @@ public function setNum($var) return $this; } + /** + * Generated from protobuf field .google.protobuf.BoolValue nested_wrapper = 2; + * @return \Google\Protobuf\BoolValue + */ + public function getNestedWrapper() + { + return $this->nested_wrapper; + } + + /** + * Generated from protobuf field .google.protobuf.BoolValue nested_wrapper = 2; + * @param \Google\Protobuf\BoolValue $var + * @return $this + */ + public function setNestedWrapper($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\BoolValue::class); + $this->nested_wrapper = $var; + + return $this; + } + } diff --git a/src/Google/Ads/GoogleAds/Util/Testing/metadata/Google/Ads/GoogleAds/Util/Testing/Tester.php b/src/Google/Ads/GoogleAds/Util/Testing/metadata/Google/Ads/GoogleAds/Util/Testing/Tester.php index a4aeae631..af3f98ea8 100644 --- a/src/Google/Ads/GoogleAds/Util/Testing/metadata/Google/Ads/GoogleAds/Util/Testing/Tester.php +++ b/src/Google/Ads/GoogleAds/Util/Testing/metadata/Google/Ads/GoogleAds/Util/Testing/Tester.php @@ -17,7 +17,7 @@ public static function initOnce() { \GPBMetadata\Google\Protobuf\Wrappers::initOnce(); \GPBMetadata\Google\Protobuf\FieldMask::initOnce(); $pool->internalAddGeneratedFile(hex2bin( - "0ac9060a2e476f6f676c652f4164732f476f6f676c654164732f5574696c" . + "0afd060a2e476f6f676c652f4164732f476f6f676c654164732f5574696c" . "2f54657374696e672f7465737465722e70726f746f1221676f6f676c652e" . "6164732e676f6f676c656164732e7574696c2e74657374696e671a20676f" . "6f676c652f70726f746f6275662f6669656c645f6d61736b2e70726f746f" . @@ -41,11 +41,12 @@ public static function initOnce() { "676f6f676c652e6164732e676f6f676c656164732e7574696c2e74657374" . "696e672e42617212340a046261727318032003280b32262e676f6f676c65" . "2e6164732e676f6f676c656164732e7574696c2e74657374696e672e4261" . - "7222120a03426172120b0a036e756d180120012803425d0a25636f6d2e67" . - "6f6f676c652e6164732e676f6f676c656164732e7574696c2e7465737469" . - "6e67420e54657374537569746550726f746f5001ca0221476f6f676c655c" . - "4164735c476f6f676c654164735c5574696c5c54657374696e6762067072" . - "6f746f33" + "7222460a03426172120b0a036e756d18012001280312320a0e6e65737465" . + "645f7772617070657218022001280b321a2e676f6f676c652e70726f746f" . + "6275662e426f6f6c56616c7565425d0a25636f6d2e676f6f676c652e6164" . + "732e676f6f676c656164732e7574696c2e74657374696e67420e54657374" . + "537569746550726f746f5001ca0221476f6f676c655c4164735c476f6f67" . + "6c654164735c5574696c5c54657374696e67620670726f746f33" )); static::$is_initialized = true; diff --git a/src/Google/Ads/GoogleAds/Util/Testing/proto/Google/Ads/GoogleAds/Util/Testing/tester.proto b/src/Google/Ads/GoogleAds/Util/Testing/proto/Google/Ads/GoogleAds/Util/Testing/tester.proto index cb5678966..6b92ffabc 100644 --- a/src/Google/Ads/GoogleAds/Util/Testing/proto/Google/Ads/GoogleAds/Util/Testing/tester.proto +++ b/src/Google/Ads/GoogleAds/Util/Testing/proto/Google/Ads/GoogleAds/Util/Testing/tester.proto @@ -35,4 +35,5 @@ message Foo { message Bar { int64 num = 1; + google.protobuf.BoolValue nested_wrapper = 2; } diff --git a/src/Google/Ads/GoogleAds/Util/Testing/testdata/test_cases.json b/src/Google/Ads/GoogleAds/Util/Testing/testdata/test_cases.json index 69afd9d97..2e30efd96 100644 --- a/src/Google/Ads/GoogleAds/Util/Testing/testdata/test_cases.json +++ b/src/Google/Ads/GoogleAds/Util/Testing/testdata/test_cases.json @@ -96,5 +96,17 @@ }] }, "expected_mask": {} + }, { + "description": "Create message with nested wrapper", + "original_resource": { + }, + "modified_resource": { + "foo": { + "bar": { + "nested_wrapper": true + } + } + }, + "expected_mask": "foo.num,foo.bar.num,foo.bar.nested_wrapper,foo.bars" } ]} diff --git a/src/Google/Ads/GoogleAds/V0/Common/PercentCpc.php b/src/Google/Ads/GoogleAds/V0/Common/PercentCpc.php new file mode 100644 index 000000000..82a806218 --- /dev/null +++ b/src/Google/Ads/GoogleAds/V0/Common/PercentCpc.php @@ -0,0 +1,108 @@ +google.ads.googleads.v0.common.PercentCpc + */ +class PercentCpc extends \Google\Protobuf\Internal\Message +{ + /** + * Maximum bid limit that can be set by the bid strategy. This is + * an optional field entered by the advertiser and specified in local micros. + * Note: A zero value is interpreted in the same way as having bid_ceiling + * undefined. + * + * Generated from protobuf field .google.protobuf.Int64Value cpc_bid_ceiling_micros = 1; + */ + private $cpc_bid_ceiling_micros = null; + /** + * Adjusts the bid for each auction upward or downward, depending on the + * likelihood of a conversion. Individual bids may exceed + * cpc_bid_ceiling_micros, but the average bid amount for a campaign should + * not. + * + * Generated from protobuf field .google.protobuf.BoolValue enhanced_cpc_enabled = 2; + */ + private $enhanced_cpc_enabled = null; + + public function __construct() { + \GPBMetadata\Google\Ads\GoogleAds\V0\Common\Bidding::initOnce(); + parent::__construct(); + } + + /** + * Maximum bid limit that can be set by the bid strategy. This is + * an optional field entered by the advertiser and specified in local micros. + * Note: A zero value is interpreted in the same way as having bid_ceiling + * undefined. + * + * Generated from protobuf field .google.protobuf.Int64Value cpc_bid_ceiling_micros = 1; + * @return \Google\Protobuf\Int64Value + */ + public function getCpcBidCeilingMicros() + { + return $this->cpc_bid_ceiling_micros; + } + + /** + * Maximum bid limit that can be set by the bid strategy. This is + * an optional field entered by the advertiser and specified in local micros. + * Note: A zero value is interpreted in the same way as having bid_ceiling + * undefined. + * + * Generated from protobuf field .google.protobuf.Int64Value cpc_bid_ceiling_micros = 1; + * @param \Google\Protobuf\Int64Value $var + * @return $this + */ + public function setCpcBidCeilingMicros($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Int64Value::class); + $this->cpc_bid_ceiling_micros = $var; + + return $this; + } + + /** + * Adjusts the bid for each auction upward or downward, depending on the + * likelihood of a conversion. Individual bids may exceed + * cpc_bid_ceiling_micros, but the average bid amount for a campaign should + * not. + * + * Generated from protobuf field .google.protobuf.BoolValue enhanced_cpc_enabled = 2; + * @return \Google\Protobuf\BoolValue + */ + public function getEnhancedCpcEnabled() + { + return $this->enhanced_cpc_enabled; + } + + /** + * Adjusts the bid for each auction upward or downward, depending on the + * likelihood of a conversion. Individual bids may exceed + * cpc_bid_ceiling_micros, but the average bid amount for a campaign should + * not. + * + * Generated from protobuf field .google.protobuf.BoolValue enhanced_cpc_enabled = 2; + * @param \Google\Protobuf\BoolValue $var + * @return $this + */ + public function setEnhancedCpcEnabled($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\BoolValue::class); + $this->enhanced_cpc_enabled = $var; + + return $this; + } + +} + diff --git a/src/Google/Ads/GoogleAds/V0/Enums/BiddingStrategyTypeEnum_BiddingStrategyType.php b/src/Google/Ads/GoogleAds/V0/Enums/BiddingStrategyTypeEnum_BiddingStrategyType.php index 918d41594..9401ad5c2 100644 --- a/src/Google/Ads/GoogleAds/V0/Enums/BiddingStrategyTypeEnum_BiddingStrategyType.php +++ b/src/Google/Ads/GoogleAds/V0/Enums/BiddingStrategyTypeEnum_BiddingStrategyType.php @@ -65,6 +65,13 @@ class BiddingStrategyTypeEnum_BiddingStrategyType * Generated from protobuf enum PAGE_ONE_PROMOTED = 5; */ const PAGE_ONE_PROMOTED = 5; + /** + * Percent Cpc is bidding strategy where bids are a fraction of the + * advertised price for some good or service. + * + * Generated from protobuf enum PERCENT_CPC = 12; + */ + const PERCENT_CPC = 12; /** * Target CPA is an automated bid strategy that sets bids * to help get as many conversions as possible diff --git a/src/Google/Ads/GoogleAds/V0/Errors/CriterionErrorEnum_CriterionError.php b/src/Google/Ads/GoogleAds/V0/Errors/CriterionErrorEnum_CriterionError.php index 1488f4065..93355b1d0 100644 --- a/src/Google/Ads/GoogleAds/V0/Errors/CriterionErrorEnum_CriterionError.php +++ b/src/Google/Ads/GoogleAds/V0/Errors/CriterionErrorEnum_CriterionError.php @@ -546,5 +546,12 @@ class CriterionErrorEnum_CriterionError * Generated from protobuf enum HOTEL_ADVANCE_BOOKING_WINDOW_OVERLAPS_WITH_EXISTING_CRITERION = 83; */ const HOTEL_ADVANCE_BOOKING_WINDOW_OVERLAPS_WITH_EXISTING_CRITERION = 83; + /** + * The field is not allowed to be set when the negative field is set to + * true, e.g. we don't allow bids in negative ad group or campaign criteria. + * + * Generated from protobuf enum FIELD_INCOMPATIBLE_WITH_NEGATIVE_TARGETING = 84; + */ + const FIELD_INCOMPATIBLE_WITH_NEGATIVE_TARGETING = 84; } diff --git a/src/Google/Ads/GoogleAds/V0/Resources/AdGroup.php b/src/Google/Ads/GoogleAds/V0/Resources/AdGroup.php index fa94a18c8..aae588430 100644 --- a/src/Google/Ads/GoogleAds/V0/Resources/AdGroup.php +++ b/src/Google/Ads/GoogleAds/V0/Resources/AdGroup.php @@ -105,6 +105,14 @@ class AdGroup extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.protobuf.DoubleValue target_roas_override = 19; */ private $target_roas_override = null; + /** + * The percent cpc bid amount, expressed as a fraction of the advertised price + * for some good or service. The valid range for the fraction is [0,1) and the + * value stored here is 1,000,000 * [fraction]. + * + * Generated from protobuf field .google.protobuf.Int64Value percent_cpc_bid_micros = 20; + */ + private $percent_cpc_bid_micros = null; public function __construct() { \GPBMetadata\Google\Ads\GoogleAds\V0\Resources\AdGroup::initOnce(); @@ -473,5 +481,35 @@ public function setTargetRoasOverride($var) return $this; } + /** + * The percent cpc bid amount, expressed as a fraction of the advertised price + * for some good or service. The valid range for the fraction is [0,1) and the + * value stored here is 1,000,000 * [fraction]. + * + * Generated from protobuf field .google.protobuf.Int64Value percent_cpc_bid_micros = 20; + * @return \Google\Protobuf\Int64Value + */ + public function getPercentCpcBidMicros() + { + return $this->percent_cpc_bid_micros; + } + + /** + * The percent cpc bid amount, expressed as a fraction of the advertised price + * for some good or service. The valid range for the fraction is [0,1) and the + * value stored here is 1,000,000 * [fraction]. + * + * Generated from protobuf field .google.protobuf.Int64Value percent_cpc_bid_micros = 20; + * @param \Google\Protobuf\Int64Value $var + * @return $this + */ + public function setPercentCpcBidMicros($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Int64Value::class); + $this->percent_cpc_bid_micros = $var; + + return $this; + } + } diff --git a/src/Google/Ads/GoogleAds/V0/Resources/AdGroupCriterion.php b/src/Google/Ads/GoogleAds/V0/Resources/AdGroupCriterion.php index 0dcd552b4..3efa676b0 100644 --- a/src/Google/Ads/GoogleAds/V0/Resources/AdGroupCriterion.php +++ b/src/Google/Ads/GoogleAds/V0/Resources/AdGroupCriterion.php @@ -81,6 +81,14 @@ class AdGroupCriterion extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.protobuf.Int64Value cpv_bid_micros = 24; */ private $cpv_bid_micros = null; + /** + * The CPC bid amount, expressed as a fraction of the advertised price + * for some good or service. The valid range for the fraction is [0,1) and the + * value stored here is 1,000,000 * [fraction]. + * + * Generated from protobuf field .google.protobuf.Int64Value percent_cpc_bid_micros = 33; + */ + private $percent_cpc_bid_micros = null; /** * The effective CPC (cost-per-click) bid. * @@ -99,6 +107,12 @@ class AdGroupCriterion extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.protobuf.Int64Value effective_cpv_bid_micros = 20; */ private $effective_cpv_bid_micros = null; + /** + * The effective Percent CPC bid amount. + * + * Generated from protobuf field .google.protobuf.Int64Value effective_percent_cpc_bid_micros = 34; + */ + private $effective_percent_cpc_bid_micros = null; /** * Source of the effective CPC bid. * @@ -117,6 +131,12 @@ class AdGroupCriterion extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.ads.googleads.v0.enums.BiddingSourceEnum.BiddingSource effective_cpv_bid_source = 23; */ private $effective_cpv_bid_source = 0; + /** + * Source of the effective Percent CPC bid. + * + * Generated from protobuf field .google.ads.googleads.v0.enums.BiddingSourceEnum.BiddingSource effective_percent_cpc_bid_source = 35; + */ + private $effective_percent_cpc_bid_source = 0; /** * Estimates for criterion bids at various positions. * @@ -422,6 +442,36 @@ public function setCpvBidMicros($var) return $this; } + /** + * The CPC bid amount, expressed as a fraction of the advertised price + * for some good or service. The valid range for the fraction is [0,1) and the + * value stored here is 1,000,000 * [fraction]. + * + * Generated from protobuf field .google.protobuf.Int64Value percent_cpc_bid_micros = 33; + * @return \Google\Protobuf\Int64Value + */ + public function getPercentCpcBidMicros() + { + return $this->percent_cpc_bid_micros; + } + + /** + * The CPC bid amount, expressed as a fraction of the advertised price + * for some good or service. The valid range for the fraction is [0,1) and the + * value stored here is 1,000,000 * [fraction]. + * + * Generated from protobuf field .google.protobuf.Int64Value percent_cpc_bid_micros = 33; + * @param \Google\Protobuf\Int64Value $var + * @return $this + */ + public function setPercentCpcBidMicros($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Int64Value::class); + $this->percent_cpc_bid_micros = $var; + + return $this; + } + /** * The effective CPC (cost-per-click) bid. * @@ -500,6 +550,32 @@ public function setEffectiveCpvBidMicros($var) return $this; } + /** + * The effective Percent CPC bid amount. + * + * Generated from protobuf field .google.protobuf.Int64Value effective_percent_cpc_bid_micros = 34; + * @return \Google\Protobuf\Int64Value + */ + public function getEffectivePercentCpcBidMicros() + { + return $this->effective_percent_cpc_bid_micros; + } + + /** + * The effective Percent CPC bid amount. + * + * Generated from protobuf field .google.protobuf.Int64Value effective_percent_cpc_bid_micros = 34; + * @param \Google\Protobuf\Int64Value $var + * @return $this + */ + public function setEffectivePercentCpcBidMicros($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Int64Value::class); + $this->effective_percent_cpc_bid_micros = $var; + + return $this; + } + /** * Source of the effective CPC bid. * @@ -578,6 +654,32 @@ public function setEffectiveCpvBidSource($var) return $this; } + /** + * Source of the effective Percent CPC bid. + * + * Generated from protobuf field .google.ads.googleads.v0.enums.BiddingSourceEnum.BiddingSource effective_percent_cpc_bid_source = 35; + * @return int + */ + public function getEffectivePercentCpcBidSource() + { + return $this->effective_percent_cpc_bid_source; + } + + /** + * Source of the effective Percent CPC bid. + * + * Generated from protobuf field .google.ads.googleads.v0.enums.BiddingSourceEnum.BiddingSource effective_percent_cpc_bid_source = 35; + * @param int $var + * @return $this + */ + public function setEffectivePercentCpcBidSource($var) + { + GPBUtil::checkEnum($var, \Google\Ads\GoogleAds\V0\Enums\BiddingSourceEnum_BiddingSource::class); + $this->effective_percent_cpc_bid_source = $var; + + return $this; + } + /** * Estimates for criterion bids at various positions. * diff --git a/src/Google/Ads/GoogleAds/V0/Resources/Campaign.php b/src/Google/Ads/GoogleAds/V0/Resources/Campaign.php index b160b9491..009f93ffe 100644 --- a/src/Google/Ads/GoogleAds/V0/Resources/Campaign.php +++ b/src/Google/Ads/GoogleAds/V0/Resources/Campaign.php @@ -857,6 +857,34 @@ public function setTargetSpend($var) return $this; } + /** + * Standard Percent Cpc bidding strategy where bids are a fraction of the + * advertised price for some good or service. + * + * Generated from protobuf field .google.ads.googleads.v0.common.PercentCpc percent_cpc = 34; + * @return \Google\Ads\GoogleAds\V0\Common\PercentCpc + */ + public function getPercentCpc() + { + return $this->readOneof(34); + } + + /** + * Standard Percent Cpc bidding strategy where bids are a fraction of the + * advertised price for some good or service. + * + * Generated from protobuf field .google.ads.googleads.v0.common.PercentCpc percent_cpc = 34; + * @param \Google\Ads\GoogleAds\V0\Common\PercentCpc $var + * @return $this + */ + public function setPercentCpc($var) + { + GPBUtil::checkMessage($var, \Google\Ads\GoogleAds\V0\Common\PercentCpc::class); + $this->writeOneof(34, $var); + + return $this; + } + /** * @return string */ diff --git a/src/Google/Ads/GoogleAds/V0/Services/Gapic/AdGroupAdServiceGapicClient.php b/src/Google/Ads/GoogleAds/V0/Services/Gapic/AdGroupAdServiceGapicClient.php index 7f36610b3..e3520aa8b 100644 --- a/src/Google/Ads/GoogleAds/V0/Services/Gapic/AdGroupAdServiceGapicClient.php +++ b/src/Google/Ads/GoogleAds/V0/Services/Gapic/AdGroupAdServiceGapicClient.php @@ -118,7 +118,6 @@ private static function getClientDefaults() 'restClientConfigPath' => __DIR__.'/../resources/ad_group_ad_service_rest_client_config.php', ], ], - 'versionFile' => __DIR__.'/../../../VERSION', ]; } @@ -245,8 +244,8 @@ public static function parseName($formattedName, $template = null) * 'grpc' => [...], * 'rest' => [...] * ]; - * See the {@see \Google\Cloud\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\Cloud\ApiCore\Transport\RestTransport::build()} methods for the + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the * supported options. * } * diff --git a/src/Google/Ads/GoogleAds/V0/Services/Gapic/AdGroupBidModifierServiceGapicClient.php b/src/Google/Ads/GoogleAds/V0/Services/Gapic/AdGroupBidModifierServiceGapicClient.php index 885992ca6..c377da82d 100644 --- a/src/Google/Ads/GoogleAds/V0/Services/Gapic/AdGroupBidModifierServiceGapicClient.php +++ b/src/Google/Ads/GoogleAds/V0/Services/Gapic/AdGroupBidModifierServiceGapicClient.php @@ -118,7 +118,6 @@ private static function getClientDefaults() 'restClientConfigPath' => __DIR__.'/../resources/ad_group_bid_modifier_service_rest_client_config.php', ], ], - 'versionFile' => __DIR__.'/../../../VERSION', ]; } @@ -245,8 +244,8 @@ public static function parseName($formattedName, $template = null) * 'grpc' => [...], * 'rest' => [...] * ]; - * See the {@see \Google\Cloud\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\Cloud\ApiCore\Transport\RestTransport::build()} methods for the + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the * supported options. * } * diff --git a/src/Google/Ads/GoogleAds/V0/Services/Gapic/AdGroupCriterionServiceGapicClient.php b/src/Google/Ads/GoogleAds/V0/Services/Gapic/AdGroupCriterionServiceGapicClient.php index 44005f861..c59d1018c 100644 --- a/src/Google/Ads/GoogleAds/V0/Services/Gapic/AdGroupCriterionServiceGapicClient.php +++ b/src/Google/Ads/GoogleAds/V0/Services/Gapic/AdGroupCriterionServiceGapicClient.php @@ -118,7 +118,6 @@ private static function getClientDefaults() 'restClientConfigPath' => __DIR__.'/../resources/ad_group_criterion_service_rest_client_config.php', ], ], - 'versionFile' => __DIR__.'/../../../VERSION', ]; } @@ -245,8 +244,8 @@ public static function parseName($formattedName, $template = null) * 'grpc' => [...], * 'rest' => [...] * ]; - * See the {@see \Google\Cloud\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\Cloud\ApiCore\Transport\RestTransport::build()} methods for the + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the * supported options. * } * diff --git a/src/Google/Ads/GoogleAds/V0/Services/Gapic/AdGroupServiceGapicClient.php b/src/Google/Ads/GoogleAds/V0/Services/Gapic/AdGroupServiceGapicClient.php index fd7f54818..966df8f13 100644 --- a/src/Google/Ads/GoogleAds/V0/Services/Gapic/AdGroupServiceGapicClient.php +++ b/src/Google/Ads/GoogleAds/V0/Services/Gapic/AdGroupServiceGapicClient.php @@ -118,7 +118,6 @@ private static function getClientDefaults() 'restClientConfigPath' => __DIR__.'/../resources/ad_group_service_rest_client_config.php', ], ], - 'versionFile' => __DIR__.'/../../../VERSION', ]; } @@ -245,8 +244,8 @@ public static function parseName($formattedName, $template = null) * 'grpc' => [...], * 'rest' => [...] * ]; - * See the {@see \Google\Cloud\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\Cloud\ApiCore\Transport\RestTransport::build()} methods for the + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the * supported options. * } * diff --git a/src/Google/Ads/GoogleAds/V0/Services/Gapic/BiddingStrategyServiceGapicClient.php b/src/Google/Ads/GoogleAds/V0/Services/Gapic/BiddingStrategyServiceGapicClient.php index 8097bdd45..cc729b618 100644 --- a/src/Google/Ads/GoogleAds/V0/Services/Gapic/BiddingStrategyServiceGapicClient.php +++ b/src/Google/Ads/GoogleAds/V0/Services/Gapic/BiddingStrategyServiceGapicClient.php @@ -118,7 +118,6 @@ private static function getClientDefaults() 'restClientConfigPath' => __DIR__.'/../resources/bidding_strategy_service_rest_client_config.php', ], ], - 'versionFile' => __DIR__.'/../../../VERSION', ]; } @@ -245,8 +244,8 @@ public static function parseName($formattedName, $template = null) * 'grpc' => [...], * 'rest' => [...] * ]; - * See the {@see \Google\Cloud\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\Cloud\ApiCore\Transport\RestTransport::build()} methods for the + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the * supported options. * } * diff --git a/src/Google/Ads/GoogleAds/V0/Services/Gapic/CampaignBudgetServiceGapicClient.php b/src/Google/Ads/GoogleAds/V0/Services/Gapic/CampaignBudgetServiceGapicClient.php index ec4dbdb56..b4900af52 100644 --- a/src/Google/Ads/GoogleAds/V0/Services/Gapic/CampaignBudgetServiceGapicClient.php +++ b/src/Google/Ads/GoogleAds/V0/Services/Gapic/CampaignBudgetServiceGapicClient.php @@ -118,7 +118,6 @@ private static function getClientDefaults() 'restClientConfigPath' => __DIR__.'/../resources/campaign_budget_service_rest_client_config.php', ], ], - 'versionFile' => __DIR__.'/../../../VERSION', ]; } @@ -245,8 +244,8 @@ public static function parseName($formattedName, $template = null) * 'grpc' => [...], * 'rest' => [...] * ]; - * See the {@see \Google\Cloud\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\Cloud\ApiCore\Transport\RestTransport::build()} methods for the + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the * supported options. * } * diff --git a/src/Google/Ads/GoogleAds/V0/Services/Gapic/CampaignCriterionServiceGapicClient.php b/src/Google/Ads/GoogleAds/V0/Services/Gapic/CampaignCriterionServiceGapicClient.php index 44318218e..9bc55daa0 100644 --- a/src/Google/Ads/GoogleAds/V0/Services/Gapic/CampaignCriterionServiceGapicClient.php +++ b/src/Google/Ads/GoogleAds/V0/Services/Gapic/CampaignCriterionServiceGapicClient.php @@ -118,7 +118,6 @@ private static function getClientDefaults() 'restClientConfigPath' => __DIR__.'/../resources/campaign_criterion_service_rest_client_config.php', ], ], - 'versionFile' => __DIR__.'/../../../VERSION', ]; } @@ -245,8 +244,8 @@ public static function parseName($formattedName, $template = null) * 'grpc' => [...], * 'rest' => [...] * ]; - * See the {@see \Google\Cloud\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\Cloud\ApiCore\Transport\RestTransport::build()} methods for the + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the * supported options. * } * diff --git a/src/Google/Ads/GoogleAds/V0/Services/Gapic/CampaignServiceGapicClient.php b/src/Google/Ads/GoogleAds/V0/Services/Gapic/CampaignServiceGapicClient.php index a9cf9ba28..8cf3079c4 100644 --- a/src/Google/Ads/GoogleAds/V0/Services/Gapic/CampaignServiceGapicClient.php +++ b/src/Google/Ads/GoogleAds/V0/Services/Gapic/CampaignServiceGapicClient.php @@ -118,7 +118,6 @@ private static function getClientDefaults() 'restClientConfigPath' => __DIR__.'/../resources/campaign_service_rest_client_config.php', ], ], - 'versionFile' => __DIR__.'/../../../VERSION', ]; } @@ -245,8 +244,8 @@ public static function parseName($formattedName, $template = null) * 'grpc' => [...], * 'rest' => [...] * ]; - * See the {@see \Google\Cloud\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\Cloud\ApiCore\Transport\RestTransport::build()} methods for the + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the * supported options. * } * diff --git a/src/Google/Ads/GoogleAds/V0/Services/Gapic/CustomerServiceGapicClient.php b/src/Google/Ads/GoogleAds/V0/Services/Gapic/CustomerServiceGapicClient.php index e0ec33219..0106d5675 100644 --- a/src/Google/Ads/GoogleAds/V0/Services/Gapic/CustomerServiceGapicClient.php +++ b/src/Google/Ads/GoogleAds/V0/Services/Gapic/CustomerServiceGapicClient.php @@ -115,7 +115,6 @@ private static function getClientDefaults() 'restClientConfigPath' => __DIR__.'/../resources/customer_service_rest_client_config.php', ], ], - 'versionFile' => __DIR__.'/../../../VERSION', ]; } @@ -240,8 +239,8 @@ public static function parseName($formattedName, $template = null) * 'grpc' => [...], * 'rest' => [...] * ]; - * See the {@see \Google\Cloud\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\Cloud\ApiCore\Transport\RestTransport::build()} methods for the + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the * supported options. * } * diff --git a/src/Google/Ads/GoogleAds/V0/Services/Gapic/GeoTargetConstantServiceGapicClient.php b/src/Google/Ads/GoogleAds/V0/Services/Gapic/GeoTargetConstantServiceGapicClient.php index 339e5fa12..641267ad1 100644 --- a/src/Google/Ads/GoogleAds/V0/Services/Gapic/GeoTargetConstantServiceGapicClient.php +++ b/src/Google/Ads/GoogleAds/V0/Services/Gapic/GeoTargetConstantServiceGapicClient.php @@ -115,7 +115,6 @@ private static function getClientDefaults() 'restClientConfigPath' => __DIR__.'/../resources/geo_target_constant_service_rest_client_config.php', ], ], - 'versionFile' => __DIR__.'/../../../VERSION', ]; } @@ -240,8 +239,8 @@ public static function parseName($formattedName, $template = null) * 'grpc' => [...], * 'rest' => [...] * ]; - * See the {@see \Google\Cloud\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\Cloud\ApiCore\Transport\RestTransport::build()} methods for the + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the * supported options. * } * diff --git a/src/Google/Ads/GoogleAds/V0/Services/Gapic/GoogleAdsFieldServiceGapicClient.php b/src/Google/Ads/GoogleAds/V0/Services/Gapic/GoogleAdsFieldServiceGapicClient.php index d0d57aaef..98591d0fa 100644 --- a/src/Google/Ads/GoogleAds/V0/Services/Gapic/GoogleAdsFieldServiceGapicClient.php +++ b/src/Google/Ads/GoogleAds/V0/Services/Gapic/GoogleAdsFieldServiceGapicClient.php @@ -117,7 +117,6 @@ private static function getClientDefaults() 'restClientConfigPath' => __DIR__.'/../resources/google_ads_field_service_rest_client_config.php', ], ], - 'versionFile' => __DIR__.'/../../../VERSION', ]; } @@ -242,8 +241,8 @@ public static function parseName($formattedName, $template = null) * 'grpc' => [...], * 'rest' => [...] * ]; - * See the {@see \Google\Cloud\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\Cloud\ApiCore\Transport\RestTransport::build()} methods for the + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the * supported options. * } * diff --git a/src/Google/Ads/GoogleAds/V0/Services/Gapic/GoogleAdsServiceGapicClient.php b/src/Google/Ads/GoogleAds/V0/Services/Gapic/GoogleAdsServiceGapicClient.php index 1e62b2010..c34738dcb 100644 --- a/src/Google/Ads/GoogleAds/V0/Services/Gapic/GoogleAdsServiceGapicClient.php +++ b/src/Google/Ads/GoogleAds/V0/Services/Gapic/GoogleAdsServiceGapicClient.php @@ -120,7 +120,6 @@ private static function getClientDefaults() 'restClientConfigPath' => __DIR__.'/../resources/google_ads_service_rest_client_config.php', ], ], - 'versionFile' => __DIR__.'/../../../VERSION', ]; } @@ -168,8 +167,8 @@ private static function getClientDefaults() * 'grpc' => [...], * 'rest' => [...] * ]; - * See the {@see \Google\Cloud\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\Cloud\ApiCore\Transport\RestTransport::build()} methods for the + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the * supported options. * } * diff --git a/src/Google/Ads/GoogleAds/V0/Services/Gapic/KeywordViewServiceGapicClient.php b/src/Google/Ads/GoogleAds/V0/Services/Gapic/KeywordViewServiceGapicClient.php index 5fc45cd0b..64b2d6446 100644 --- a/src/Google/Ads/GoogleAds/V0/Services/Gapic/KeywordViewServiceGapicClient.php +++ b/src/Google/Ads/GoogleAds/V0/Services/Gapic/KeywordViewServiceGapicClient.php @@ -115,7 +115,6 @@ private static function getClientDefaults() 'restClientConfigPath' => __DIR__.'/../resources/keyword_view_service_rest_client_config.php', ], ], - 'versionFile' => __DIR__.'/../../../VERSION', ]; } @@ -242,8 +241,8 @@ public static function parseName($formattedName, $template = null) * 'grpc' => [...], * 'rest' => [...] * ]; - * See the {@see \Google\Cloud\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\Cloud\ApiCore\Transport\RestTransport::build()} methods for the + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the * supported options. * } * diff --git a/src/Google/Ads/GoogleAds/V0/Services/Gapic/RecommendationServiceGapicClient.php b/src/Google/Ads/GoogleAds/V0/Services/Gapic/RecommendationServiceGapicClient.php index c8d4210c5..5cb7e8197 100644 --- a/src/Google/Ads/GoogleAds/V0/Services/Gapic/RecommendationServiceGapicClient.php +++ b/src/Google/Ads/GoogleAds/V0/Services/Gapic/RecommendationServiceGapicClient.php @@ -118,7 +118,6 @@ private static function getClientDefaults() 'restClientConfigPath' => __DIR__.'/../resources/recommendation_service_rest_client_config.php', ], ], - 'versionFile' => __DIR__.'/../../../VERSION', ]; } @@ -245,8 +244,8 @@ public static function parseName($formattedName, $template = null) * 'grpc' => [...], * 'rest' => [...] * ]; - * See the {@see \Google\Cloud\ApiCore\Transport\GrpcTransport::build()} and - * {@see \Google\Cloud\ApiCore\Transport\RestTransport::build()} methods for the + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the * supported options. * } * diff --git a/tests/Google/Ads/GoogleAds/Examples/Utils/ArgumentParserTest.php b/tests/Google/Ads/GoogleAds/Examples/Utils/ArgumentParserTest.php new file mode 100644 index 000000000..f8fc8905a --- /dev/null +++ b/tests/Google/Ads/GoogleAds/Examples/Utils/ArgumentParserTest.php @@ -0,0 +1,148 @@ +argumentParser = new ArgumentParser(); + } + + /** + * @covers \Google\Ads\GoogleAds\Examples\Utils\ArgumentParser::parseCommandArguments() + */ + public function testPassingRequiredArguments() + { + $_SERVER['argv'] = [null, '--customerId', 123456, '--campaignId', 11111]; + $expectedResult = ['customerId' => 123456, 'campaignId' => 11111]; + $actualResult = $this->argumentParser->parseCommandArguments( + ['customerId' => GetOpt::REQUIRED_ARGUMENT, 'campaignId' => GetOpt::REQUIRED_ARGUMENT] + ); + $this->assertEquals($expectedResult, $actualResult); + } + + /** + * @covers \Google\Ads\GoogleAds\Examples\Utils\ArgumentParser::parseCommandArguments() + */ + public function testPassingOptionalArguments() + { + $_SERVER['argv'] = [null, '--customerId', 123456, '--campaignId', 11111]; + $expectedResult = ['customerId' => 123456, 'campaignId' => 11111]; + $actualResult = $this->argumentParser->parseCommandArguments( + ['customerId' => GetOpt::OPTIONAL_ARGUMENT, 'campaignId' => GetOpt::OPTIONAL_ARGUMENT] + ); + $this->assertEquals($expectedResult, $actualResult); + } + + /** + * @covers \Google\Ads\GoogleAds\Examples\Utils\ArgumentParser::parseCommandArguments() + */ + public function testPassingRequiredAndOptionalArguments() + { + $_SERVER['argv'] = [null, '--customerId', 123456, '--campaignId', 11111]; + $expectedResult = ['customerId' => 123456, 'campaignId' => 11111]; + $actualResult = $this->argumentParser->parseCommandArguments( + ['customerId' => GetOpt::REQUIRED_ARGUMENT, 'campaignId' => GetOpt::OPTIONAL_ARGUMENT] + ); + $this->assertEquals($expectedResult, $actualResult); + } + + /** + * @covers \Google\Ads\GoogleAds\Examples\Utils\ArgumentParser::parseCommandArguments() + */ + public function testPassingRequiredAndOptionalArgumentsWhenOptionalArgumentMissingValue() + { + $_SERVER['argv'] = [null, '--customerId', 123456]; + $expectedResult = ['customerId' => 123456, 'campaignId' => null]; + $actualResult = $this->argumentParser->parseCommandArguments( + ['customerId' => GetOpt::REQUIRED_ARGUMENT, 'campaignId' => GetOpt::OPTIONAL_ARGUMENT] + ); + $this->assertEquals($expectedResult, $actualResult); + } + + /** + * @covers \Google\Ads\GoogleAds\Examples\Utils\ArgumentParser::parseCommandArguments() + * @expectedException \GetOpt\ArgumentException + * @expectedExceptionMessage 'customerId' must have a value + */ + public function testPassingRequiredArgumentButMissingValue() + { + $this->expectOutputRegex('/Usage/'); + $_SERVER['argv'] = [null, '--customerId', '--campaignId', 11111]; + $this->argumentParser->parseCommandArguments( + ['customerId' => GetOpt::REQUIRED_ARGUMENT, 'campaignId' => GetOpt::OPTIONAL_ARGUMENT] + ); + } + + /** + * @covers \Google\Ads\GoogleAds\Examples\Utils\ArgumentParser::parseCommandArguments() + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage All required arguments must be specified + */ + public function testPassingOptionalWithoutRequiredArguments() + { + $this->expectOutputRegex('/Usage/'); + $_SERVER['argv'] = [null, '--campaignId', 11111]; + $this->argumentParser->parseCommandArguments( + ['customerId' => GetOpt::REQUIRED_ARGUMENT, 'campaignId' => GetOpt::OPTIONAL_ARGUMENT] + ); + } + + /** + * @covers \Google\Ads\GoogleAds\Examples\Utils\ArgumentParser::parseCommandArguments() + * @expectedException \GetOpt\ArgumentException + * @expectedExceptionMessage Option 'adGroupId' is unknown + */ + public function testPassingInvalidArguments() + { + $this->expectOutputRegex('/Usage/'); + $_SERVER['argv'] = [null, '--adGroupId', 11111]; + $this->argumentParser->parseCommandArguments( + ['customerId' => GetOpt::REQUIRED_ARGUMENT, 'campaignId' => GetOpt::OPTIONAL_ARGUMENT] + ); + } + + /** + * @covers \Google\Ads\GoogleAds\Examples\Utils\ArgumentParser::parseCommandArguments() + */ + public function testPrintHelpMessage() + { + $argumentParserMock = $this->getMockBuilder(ArgumentParser::class) + ->setMethods(['printHelpMessageAndExit']) + ->getMock(); + $argumentParserMock + ->expects($this->once()) + ->method('printHelpMessageAndExit'); + $_SERVER['argv'] = [null, '--customerId', 123456, '--help']; + $argumentParserMock->parseCommandArguments(['customerId' => GetOpt::REQUIRED_ARGUMENT]); + } +} diff --git a/tests/Google/Ads/GoogleAds/Util/FieldMasksTests.php b/tests/Google/Ads/GoogleAds/Util/FieldMasksTest.php similarity index 98% rename from tests/Google/Ads/GoogleAds/Util/FieldMasksTests.php rename to tests/Google/Ads/GoogleAds/Util/FieldMasksTest.php index fc76aab07..26f3d2ccd 100644 --- a/tests/Google/Ads/GoogleAds/Util/FieldMasksTests.php +++ b/tests/Google/Ads/GoogleAds/Util/FieldMasksTest.php @@ -28,7 +28,7 @@ * @see FieldMasks * @small */ -class FieldMasksTests extends TestCase +class FieldMasksTest extends TestCase { private static $testCases = null;