Skip to content

Commit 4032b88

Browse files
committed
Preparing release 2.2.0
1 parent 2c558fc commit 4032b88

2,520 files changed

Lines changed: 350699 additions & 1733 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ChangeLog

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
2.2.0 - 06/26/2015
2+
-------------------
3+
AdWords:
4+
- Added support and examples for v201506.
5+
- Fix to avoid ArrayStoreException in ProductPartitionTree.createAdGroupTree.
6+
- Added support for the new includeZeroImpressions HTTP header for reporting.
7+
8+
DFA:
9+
- No changes.
10+
11+
DFP:
12+
- No changes.
13+
14+
Common:
15+
- No changes.
16+
117
2.1.0 - 06/10/2015
218
-------------------
319
AdWords:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ $ mvn -X compile
167167

168168
This command runs the ``GetCampaigns`` example, but you can update the ``-Dexec.mainClass`` argument with the example of your choice.
169169
```
170-
$ mvn -X exec:java -Dexec.mainClass="adwords.axis.v201502.basicoperations.GetCampaigns"
170+
$ mvn -X exec:java -Dexec.mainClass="adwords.axis.v201506.basicoperations.GetCampaigns"
171171
```
172172

173173
## Basic usage
@@ -177,7 +177,7 @@ to all products and frameworks.
177177

178178
```java
179179
// Contains the data classes and service classes.
180-
import com.google.api.ads.adwords.axis.v201502.*;
180+
import com.google.api.ads.adwords.axis.v201506.*;
181181

182182
import com.google.api.ads.adwords.lib.client.AdWordsSession;
183183
import com.google.api.ads.adwords.lib.axis.factory.AdWordsServices;

examples/adwords_axis/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
<groupId>com.google.api-ads.examples</groupId>
2525
<artifactId>adwords-axis-examples</artifactId>
26-
<version>2.1.0</version>
26+
<version>2.2.0</version>
2727

2828
<packaging>jar</packaging>
2929

@@ -36,7 +36,7 @@
3636

3737
<properties>
3838
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
39-
<smokeMainClass>adwords.axis.v201502.basicoperations.GetCampaigns</smokeMainClass>
39+
<smokeMainClass>adwords.axis.v201506.basicoperations.GetCampaigns</smokeMainClass>
4040
</properties>
4141

4242
<build>
@@ -121,12 +121,12 @@
121121
<dependency>
122122
<groupId>com.google.api-ads</groupId>
123123
<artifactId>ads-lib</artifactId>
124-
<version>2.1.0</version>
124+
<version>2.2.0</version>
125125
</dependency>
126126
<dependency>
127127
<groupId>com.google.api-ads</groupId>
128128
<artifactId>adwords-axis</artifactId>
129-
<version>2.1.0</version>
129+
<version>2.2.0</version>
130130
</dependency>
131131

132132
<!-- Third party dependencies -->
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
// Copyright 2015 Google Inc. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package adwords.axis.v201506.accountmanagement;
16+
17+
import com.google.api.ads.adwords.axis.factory.AdWordsServices;
18+
import com.google.api.ads.adwords.axis.v201506.cm.Operator;
19+
import com.google.api.ads.adwords.axis.v201506.mcm.ManagedCustomer;
20+
import com.google.api.ads.adwords.axis.v201506.mcm.ManagedCustomerOperation;
21+
import com.google.api.ads.adwords.axis.v201506.mcm.ManagedCustomerReturnValue;
22+
import com.google.api.ads.adwords.axis.v201506.mcm.ManagedCustomerServiceInterface;
23+
import com.google.api.ads.adwords.lib.client.AdWordsSession;
24+
import com.google.api.ads.common.lib.auth.OfflineCredentials;
25+
import com.google.api.ads.common.lib.auth.OfflineCredentials.Api;
26+
import com.google.api.client.auth.oauth2.Credential;
27+
28+
import org.joda.time.DateTime;
29+
30+
/**
31+
* This example creates a new account under an MCC account.
32+
*
33+
* Note: this example must be run using the credentials of an MCC account, and
34+
* by default the new account will only be accessible via the parent MCC
35+
* account.
36+
*
37+
* Credentials and properties in {@code fromFile()} are pulled from the
38+
* "ads.properties" file. See README for more info.
39+
*
40+
* Tags: ManagedCustomerService.mutate
41+
*
42+
* Category: adx-exclude
43+
*
44+
* @author Adam Rogal
45+
*/
46+
public class CreateAccount {
47+
48+
public static void main(String[] args) throws Exception {
49+
// Generate a refreshable OAuth2 credential similar to a ClientLogin token
50+
// and can be used in place of a service account.
51+
Credential oAuth2Credential = new OfflineCredentials.Builder()
52+
.forApi(Api.ADWORDS)
53+
.fromFile()
54+
.build()
55+
.generateCredential();
56+
57+
// Construct an AdWordsSession.
58+
AdWordsSession session = new AdWordsSession.Builder()
59+
.fromFile()
60+
.withOAuth2Credential(oAuth2Credential)
61+
.build();
62+
63+
AdWordsServices adWordsServices = new AdWordsServices();
64+
65+
runExample(adWordsServices, session);
66+
}
67+
68+
public static void runExample(
69+
AdWordsServices adWordsServices, AdWordsSession session) throws Exception {
70+
// Get the CampaignService.
71+
ManagedCustomerServiceInterface managedCustomerService =
72+
adWordsServices.get(session, ManagedCustomerServiceInterface.class);
73+
74+
// Create account.
75+
ManagedCustomer customer = new ManagedCustomer();
76+
customer.setName("Customer created with ManagedCustomerService on " + new DateTime());
77+
customer.setCurrencyCode("EUR");
78+
customer.setDateTimeZone("Europe/London");
79+
80+
// Create operations.
81+
ManagedCustomerOperation operation = new ManagedCustomerOperation();
82+
operation.setOperand(customer);
83+
operation.setOperator(Operator.ADD);
84+
85+
ManagedCustomerOperation[] operations = new ManagedCustomerOperation[] {operation};
86+
87+
// Add account.
88+
ManagedCustomerReturnValue result = managedCustomerService.mutate(operations);
89+
90+
// Display accounts.
91+
for (ManagedCustomer customerResult : result.getValue()) {
92+
System.out.println("Account with customer ID \"" + customerResult.getCustomerId()
93+
+ "\" was created.");
94+
}
95+
}
96+
}
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
// Copyright 2015 Google Inc. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package adwords.axis.v201506.accountmanagement;
16+
17+
import com.google.api.ads.adwords.axis.factory.AdWordsServices;
18+
import com.google.api.ads.adwords.axis.utils.v201506.SelectorBuilder;
19+
import com.google.api.ads.adwords.axis.v201506.ch.AdGroupChangeData;
20+
import com.google.api.ads.adwords.axis.v201506.ch.CampaignChangeData;
21+
import com.google.api.ads.adwords.axis.v201506.ch.ChangeStatus;
22+
import com.google.api.ads.adwords.axis.v201506.ch.CustomerChangeData;
23+
import com.google.api.ads.adwords.axis.v201506.ch.CustomerSyncSelector;
24+
import com.google.api.ads.adwords.axis.v201506.ch.CustomerSyncServiceInterface;
25+
import com.google.api.ads.adwords.axis.v201506.cm.Campaign;
26+
import com.google.api.ads.adwords.axis.v201506.cm.CampaignPage;
27+
import com.google.api.ads.adwords.axis.v201506.cm.CampaignServiceInterface;
28+
import com.google.api.ads.adwords.axis.v201506.cm.DateTimeRange;
29+
import com.google.api.ads.adwords.axis.v201506.cm.Selector;
30+
import com.google.api.ads.adwords.lib.client.AdWordsSession;
31+
import com.google.api.ads.adwords.lib.selectorfields.v201506.cm.CampaignField;
32+
import com.google.api.ads.common.lib.auth.OfflineCredentials;
33+
import com.google.api.ads.common.lib.auth.OfflineCredentials.Api;
34+
import com.google.api.client.auth.oauth2.Credential;
35+
36+
import org.apache.commons.lang.ArrayUtils;
37+
import org.apache.commons.lang.StringUtils;
38+
39+
import java.text.SimpleDateFormat;
40+
import java.util.ArrayList;
41+
import java.util.Date;
42+
import java.util.List;
43+
44+
/**
45+
* This example gets the changes in the account during the last 24 hours.
46+
*
47+
* Tags: CustomerSyncService.get
48+
*
49+
* @author Kevin Winter
50+
*/
51+
public class GetAccountChanges {
52+
53+
public static void main(String[] args) throws Exception {
54+
// Generate a refreshable OAuth2 credential similar to a ClientLogin token
55+
// and can be used in place of a service account.
56+
Credential oAuth2Credential = new OfflineCredentials.Builder()
57+
.forApi(Api.ADWORDS)
58+
.fromFile()
59+
.build()
60+
.generateCredential();
61+
62+
// Construct an AdWordsSession.
63+
AdWordsSession session = new AdWordsSession.Builder()
64+
.fromFile()
65+
.withOAuth2Credential(oAuth2Credential)
66+
.build();
67+
68+
AdWordsServices adWordsServices = new AdWordsServices();
69+
70+
runExample(adWordsServices, session);
71+
}
72+
73+
public static void runExample(AdWordsServices adWordsServices, AdWordsSession session)
74+
throws Exception {
75+
// Get the CampaignService.
76+
CampaignServiceInterface campaignService =
77+
adWordsServices.get(session, CampaignServiceInterface.class);
78+
79+
// Get the CustomerSyncService.
80+
CustomerSyncServiceInterface customerSyncService =
81+
adWordsServices.get(session, CustomerSyncServiceInterface.class);
82+
83+
// Get a list of all campaign IDs.
84+
List<Long> campaignIds = new ArrayList<Long>();
85+
Selector selector = new SelectorBuilder()
86+
.fields(CampaignField.Id)
87+
.build();
88+
CampaignPage campaigns = campaignService.get(selector);
89+
if (campaigns.getEntries() != null) {
90+
for (Campaign campaign : campaigns.getEntries()) {
91+
campaignIds.add(campaign.getId());
92+
}
93+
}
94+
95+
// Create date time range for the past 24 hours.
96+
DateTimeRange dateTimeRange = new DateTimeRange();
97+
dateTimeRange.setMin(new SimpleDateFormat("yyyyMMdd HHmmss").format(new Date(System
98+
.currentTimeMillis() - 1000L * 60 * 60 * 24)));
99+
dateTimeRange.setMax(new SimpleDateFormat("yyyyMMdd HHmmss").format(new Date()));
100+
101+
// Create selector.
102+
CustomerSyncSelector customerSyncSelector = new CustomerSyncSelector();
103+
customerSyncSelector.setDateTimeRange(dateTimeRange);
104+
customerSyncSelector
105+
.setCampaignIds(ArrayUtils.toPrimitive(campaignIds.toArray(new Long[] {})));
106+
107+
// Get all account changes for campaign.
108+
CustomerChangeData accountChanges = customerSyncService.get(customerSyncSelector);
109+
110+
// Display changes.
111+
if (accountChanges != null && accountChanges.getChangedCampaigns() != null) {
112+
System.out.println("Most recent change: "
113+
+ accountChanges.getLastChangeTimestamp() + "\n");
114+
for (CampaignChangeData campaignChanges : accountChanges.getChangedCampaigns()) {
115+
System.out.println("Campaign with id \"" + campaignChanges.getCampaignId()
116+
+ "\" was changed: ");
117+
System.out.println("\tCampaign changed status: "
118+
+ campaignChanges.getCampaignChangeStatus());
119+
if (campaignChanges.getCampaignChangeStatus() != ChangeStatus.NEW) {
120+
System.out.println("\tAdded ad extensions: "
121+
+ getFormattedList(campaignChanges.getAddedAdExtensions()));
122+
System.out.println("\tAdded campaign criteria: "
123+
+ getFormattedList(campaignChanges.getAddedCampaignCriteria()));
124+
System.out.println("\tRemoved ad extensions: "
125+
+ getFormattedList(campaignChanges.getRemovedAdExtensions()));
126+
System.out.println("\tRemoved campaign criteria: "
127+
+ getFormattedList(campaignChanges.getRemovedCampaignCriteria()));
128+
129+
if (campaignChanges.getChangedAdGroups() != null) {
130+
for (AdGroupChangeData adGroupChanges : campaignChanges.getChangedAdGroups()) {
131+
System.out.println("\tAd goup with id \"" + adGroupChanges.getAdGroupId()
132+
+ "\" was changed: ");
133+
System.out.println("\t\tAd goup changed status: "
134+
+ adGroupChanges.getAdGroupChangeStatus());
135+
if (adGroupChanges.getAdGroupChangeStatus() != ChangeStatus.NEW) {
136+
System.out.println("\t\tAds changed: "
137+
+ getFormattedList(adGroupChanges.getChangedAds()));
138+
System.out.println("\t\tCriteria changed: "
139+
+ getFormattedList(adGroupChanges.getChangedCriteria()));
140+
System.out.println("\t\tCriteria removed: "
141+
+ getFormattedList(adGroupChanges.getRemovedCriteria()));
142+
}
143+
}
144+
}
145+
}
146+
System.out.println("");
147+
}
148+
} else {
149+
System.out.println("No account changes were found.");
150+
}
151+
}
152+
153+
/**
154+
* Gets a formatted list of a long array in the form {1,2,3}.
155+
* @param idList the long array
156+
* @return the formatted list
157+
*/
158+
private static String getFormattedList(long[] idList) {
159+
if (idList == null) {
160+
idList = new long[]{};
161+
}
162+
return new StringBuilder().append("{")
163+
.append(StringUtils.join(ArrayUtils.toObject(idList), ','))
164+
.append("}").toString();
165+
}
166+
}

0 commit comments

Comments
 (0)