Skip to content

Commit f35f108

Browse files
committed
add data_type for bulk user actions
1 parent 666b8e1 commit f35f108

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

intercom-java/src/main/java/io/intercom/api/HttpClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ private <T> T handleSuccess(JavaType javaType, HttpURLConnection conn, int respo
171171
}
172172

173173
private boolean shouldSkipResponseEntity(JavaType javaType, HttpURLConnection conn, int responseCode) {
174-
return responseCode == 202 || responseCode == 204 || Void.class.equals(javaType.getRawClass()) || "DELETE".equals(conn.getRequestMethod());
174+
return responseCode == 204 || Void.class.equals(javaType.getRawClass()) || "DELETE".equals(conn.getRequestMethod());
175175
}
176176

177177
private <T> T readEntity(HttpURLConnection conn, int responseCode, JavaType javaType) throws IOException {

intercom-java/src/main/java/io/intercom/api/JobItem.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,23 @@ public JobItem() {
3535
}
3636

3737
public JobItem(String method, T data) {
38-
checkNotNull(method, data);
38+
this(method, data, null);
39+
}
40+
41+
public JobItem(String method, T data, String dataType) {
3942
this.method = method;
4043
this.data = data;
41-
this.dataType = data.getType();
44+
this.dataType = dataType;
45+
if (dataType == null) {
46+
this.dataType = data.getType();
47+
}
48+
checkNotNull(method, data, this.dataType);
4249
}
4350

44-
private void checkNotNull(String method, T data) {
51+
private void checkNotNull(String method, T data, String dataType) {
4552
Conditions.checkNotNull(method, "item method must be supplied");
4653
Conditions.checkNotNull(data, "item data must be supplied");
54+
Conditions.checkNotNull(data, "item dataType must be supplied");
4755
}
4856

4957
public String getType() {

intercom-java/src/main/java/io/intercom/api/User.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,8 @@ static List<JobItem<UserUpdate>> validateAndConvertJobItems(List<JobItem<User>>
120120
final JobSupport jobSupport = new JobSupport();
121121
for (JobItem<User> item : items) {
122122
jobSupport.validateJobItem(item, BULK_METHODS);
123-
updateItems.add(
124-
new JobItem<UserUpdate>(
125-
item.getMethod(), buildFrom(item.getData())));
123+
final JobItem<UserUpdate> jobItem = new JobItem<UserUpdate>(item.getMethod(), buildFrom(item.getData()), item.getData().getType());
124+
updateItems.add(jobItem);
126125
}
127126
return updateItems;
128127
}

0 commit comments

Comments
 (0)