|
20 | 20 | import com.google.ads.googleads.examples.utils.ArgumentNames; |
21 | 21 | import com.google.ads.googleads.examples.utils.CodeSampleParams; |
22 | 22 | import com.google.ads.googleads.lib.GoogleAdsClient; |
| 23 | +import com.google.ads.googleads.v6.utils.ResourceNames; |
23 | 24 | import com.google.ads.googleads.v6.common.AdImageAsset; |
24 | 25 | import com.google.ads.googleads.v6.common.AdTextAsset; |
25 | 26 | import com.google.ads.googleads.v6.common.ImageAsset; |
@@ -88,11 +89,11 @@ private static class AddSmartDisplayAdParams extends CodeSampleParams { |
88 | 89 | @Parameter(names = ArgumentNames.CUSTOMER_ID, required = true) |
89 | 90 | private Long customerId; |
90 | 91 |
|
91 | | - @Parameter(names = ArgumentNames.MARKETING_IMAGE_ASSET_RESOURCE_NAME, required = false) |
92 | | - private String marketingImageAssetResourceName; |
| 92 | + @Parameter(names = ArgumentNames.MARKETING_IMAGE_ASSET_ID, required = false) |
| 93 | + private Long marketingImageAssetResourceName; |
93 | 94 |
|
94 | | - @Parameter(names = ArgumentNames.SQUARE_MARKETING_IMAGE_ASSET_RESOURCE_NAME, required = false) |
95 | | - private String squareMarketingImageAssetResourceName; |
| 95 | + @Parameter(names = ArgumentNames.SQUARE_MARKETING_IMAGE_ID, required = false) |
| 96 | + private Long squareMarketingImageAssetResourceName; |
96 | 97 | } |
97 | 98 |
|
98 | 99 | public static void main(String[] args) throws IOException { |
@@ -148,26 +149,31 @@ public static void main(String[] args) throws IOException { |
148 | 149 | * |
149 | 150 | * @param googleAdsClient the Google Ads API client. |
150 | 151 | * @param customerId the client customer ID. |
151 | | - * @param marketingImageAssetResourceName |
152 | | - * @param squareMarketingImageAssetResourceName |
| 152 | + * @param marketingImageAssetId |
| 153 | + * @param squareMarketingImageAssetId |
153 | 154 | * @throws GoogleAdsException if an API request failed with one or more service errors. |
154 | 155 | */ |
155 | 156 | private void runExample( |
156 | 157 | GoogleAdsClient googleAdsClient, |
157 | 158 | long customerId, |
158 | | - String marketingImageAssetResourceName, |
159 | | - String squareMarketingImageAssetResourceName) |
| 159 | + Long marketingImageAssetId, |
| 160 | + Long squareMarketingImageAssetId) |
160 | 161 | throws IOException { |
161 | 162 | String budgetResourceName = createCampaignBudget(googleAdsClient, customerId); |
162 | 163 | String campaignResourceName = |
163 | 164 | createSmartDisplayCampaign(googleAdsClient, customerId, budgetResourceName); |
164 | 165 | String adGroupResourceName = createAdGroup(googleAdsClient, customerId, campaignResourceName); |
| 166 | + |
165 | 167 | createResponsiveDisplayAd( |
166 | 168 | googleAdsClient, |
167 | 169 | customerId, |
168 | 170 | adGroupResourceName, |
169 | | - marketingImageAssetResourceName, |
170 | | - squareMarketingImageAssetResourceName); |
| 171 | + marketingImageAssetId == null |
| 172 | + ? null |
| 173 | + : ResourceNames.asset(customerId, marketingImageAssetId), |
| 174 | + squareMarketingImageAssetId == null |
| 175 | + ? null |
| 176 | + : ResourceNames.asset(customerId, squareMarketingImageAssetId)); |
171 | 177 | } |
172 | 178 |
|
173 | 179 | /** |
|
0 commit comments