Skip to content

Commit 6e02b9f

Browse files
author
APIs and Common Services team
committed
Automated SDK update
This updates the SDK from internal repo commit segmentio/public-api@821c48bc.
1 parent 6cd007a commit 6e02b9f

9 files changed

Lines changed: 22 additions & 431 deletions

src/main/java/com/segment/publicapi/JSON.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,6 @@ private static Class getClassByDiscriminator(
187187
new com.segment.publicapi.models.AudienceComputeCadence.CustomTypeAdapterFactory());
188188
gsonBuilder.registerTypeAdapterFactory(
189189
new com.segment.publicapi.models.AudienceDefinition.CustomTypeAdapterFactory());
190-
gsonBuilder.registerTypeAdapterFactory(
191-
new com.segment.publicapi.models.AudienceDefinitionWithoutType
192-
.CustomTypeAdapterFactory());
193190
gsonBuilder.registerTypeAdapterFactory(
194191
new com.segment.publicapi.models.AudienceOptions.CustomTypeAdapterFactory());
195192
gsonBuilder.registerTypeAdapterFactory(

src/main/java/com/segment/publicapi/models/AudienceDefinition.java

Lines changed: 2 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import com.google.gson.JsonObject;
1717
import com.google.gson.TypeAdapter;
1818
import com.google.gson.TypeAdapterFactory;
19-
import com.google.gson.annotations.JsonAdapter;
2019
import com.google.gson.annotations.SerializedName;
2120
import com.google.gson.reflect.TypeToken;
2221
import com.google.gson.stream.JsonReader;
@@ -30,59 +29,6 @@
3029

3130
/** AudienceDefinition */
3231
public class AudienceDefinition {
33-
/**
34-
* The underlying data type being segmented for this audience. Possible values: users, accounts.
35-
*/
36-
@JsonAdapter(TypeEnum.Adapter.class)
37-
public enum TypeEnum {
38-
ACCOUNTS("ACCOUNTS"),
39-
40-
USERS("USERS");
41-
42-
private String value;
43-
44-
TypeEnum(String value) {
45-
this.value = value;
46-
}
47-
48-
public String getValue() {
49-
return value;
50-
}
51-
52-
@Override
53-
public String toString() {
54-
return String.valueOf(value);
55-
}
56-
57-
public static TypeEnum fromValue(String value) {
58-
for (TypeEnum b : TypeEnum.values()) {
59-
if (b.value.equals(value)) {
60-
return b;
61-
}
62-
}
63-
throw new IllegalArgumentException("Unexpected value '" + value + "'");
64-
}
65-
66-
public static class Adapter extends TypeAdapter<TypeEnum> {
67-
@Override
68-
public void write(final JsonWriter jsonWriter, final TypeEnum enumeration)
69-
throws IOException {
70-
jsonWriter.value(enumeration.getValue());
71-
}
72-
73-
@Override
74-
public TypeEnum read(final JsonReader jsonReader) throws IOException {
75-
String value = jsonReader.nextString();
76-
return TypeEnum.fromValue(value);
77-
}
78-
}
79-
}
80-
81-
public static final String SERIALIZED_NAME_TYPE = "type";
82-
83-
@SerializedName(SERIALIZED_NAME_TYPE)
84-
private TypeEnum type;
85-
8632
public static final String SERIALIZED_NAME_QUERY = "query";
8733

8834
@SerializedName(SERIALIZED_NAME_QUERY)
@@ -95,26 +41,6 @@ public TypeEnum read(final JsonReader jsonReader) throws IOException {
9541

9642
public AudienceDefinition() {}
9743

98-
public AudienceDefinition type(TypeEnum type) {
99-
100-
this.type = type;
101-
return this;
102-
}
103-
104-
/**
105-
* The underlying data type being segmented for this audience. Possible values: users, accounts.
106-
*
107-
* @return type
108-
*/
109-
@javax.annotation.Nullable
110-
public TypeEnum getType() {
111-
return type;
112-
}
113-
114-
public void setType(TypeEnum type) {
115-
this.type = type;
116-
}
117-
11844
public AudienceDefinition query(String query) {
11945

12046
this.query = query;
@@ -166,21 +92,19 @@ public boolean equals(Object o) {
16692
return false;
16793
}
16894
AudienceDefinition audienceDefinition = (AudienceDefinition) o;
169-
return Objects.equals(this.type, audienceDefinition.type)
170-
&& Objects.equals(this.query, audienceDefinition.query)
95+
return Objects.equals(this.query, audienceDefinition.query)
17196
&& Objects.equals(this.targetEntity, audienceDefinition.targetEntity);
17297
}
17398

17499
@Override
175100
public int hashCode() {
176-
return Objects.hash(type, query, targetEntity);
101+
return Objects.hash(query, targetEntity);
177102
}
178103

179104
@Override
180105
public String toString() {
181106
StringBuilder sb = new StringBuilder();
182107
sb.append("class AudienceDefinition {\n");
183-
sb.append(" type: ").append(toIndentedString(type)).append("\n");
184108
sb.append(" query: ").append(toIndentedString(query)).append("\n");
185109
sb.append(" targetEntity: ").append(toIndentedString(targetEntity)).append("\n");
186110
sb.append("}");
@@ -204,7 +128,6 @@ private String toIndentedString(Object o) {
204128
static {
205129
// a set of all properties/fields (JSON key names)
206130
openapiFields = new HashSet<String>();
207-
openapiFields.add("type");
208131
openapiFields.add("query");
209132
openapiFields.add("targetEntity");
210133

@@ -253,14 +176,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
253176
}
254177
}
255178
JsonObject jsonObj = jsonElement.getAsJsonObject();
256-
if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull())
257-
&& !jsonObj.get("type").isJsonPrimitive()) {
258-
throw new IllegalArgumentException(
259-
String.format(
260-
"Expected the field `type` to be a primitive type in the JSON string"
261-
+ " but got `%s`",
262-
jsonObj.get("type").toString()));
263-
}
264179
if (!jsonObj.get("query").isJsonPrimitive()) {
265180
throw new IllegalArgumentException(
266181
String.format(

0 commit comments

Comments
 (0)