Skip to content

Commit 90c8873

Browse files
author
APIs and Common Services team
committed
Automated SDK update
This updates the SDK from internal repo commit segmentio/public-api@61bd39f7.
1 parent 7420462 commit 90c8873

File tree

5 files changed

+372
-25
lines changed

5 files changed

+372
-25
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -995,6 +995,9 @@ private static Class getClassByDiscriminator(
995995
.CustomTypeAdapterFactory());
996996
gsonBuilder.registerTypeAdapterFactory(
997997
new com.segment.publicapi.models.IDSyncConfig.CustomTypeAdapterFactory());
998+
gsonBuilder.registerTypeAdapterFactory(
999+
new com.segment.publicapi.models.IDSyncConfigurationInput
1000+
.CustomTypeAdapterFactory());
9981001
gsonBuilder.registerTypeAdapterFactory(
9991002
new com.segment.publicapi.models.IDSyncOptions.CustomTypeAdapterFactory());
10001003
gsonBuilder.registerTypeAdapterFactory(

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

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
package com.segment.publicapi.models;
1313

1414
import com.google.gson.Gson;
15+
import com.google.gson.JsonArray;
1516
import com.google.gson.JsonElement;
1617
import com.google.gson.JsonObject;
1718
import com.google.gson.TypeAdapter;
@@ -22,8 +23,10 @@
2223
import com.google.gson.stream.JsonWriter;
2324
import com.segment.publicapi.JSON;
2425
import java.io.IOException;
26+
import java.util.ArrayList;
2527
import java.util.Arrays;
2628
import java.util.HashSet;
29+
import java.util.List;
2730
import java.util.Map;
2831
import java.util.Objects;
2932
import java.util.Set;
@@ -39,7 +42,7 @@ public class AddDestinationToAudienceAlphaInput {
3942
public static final String SERIALIZED_NAME_ID_SYNC_CONFIGURATION = "idSyncConfiguration";
4043

4144
@SerializedName(SERIALIZED_NAME_ID_SYNC_CONFIGURATION)
42-
private Object idSyncConfiguration;
45+
private List<IDSyncConfigurationInput> idSyncConfiguration;
4346

4447
public static final String SERIALIZED_NAME_CONNECTION_SETTINGS = "connectionSettings";
4548

@@ -68,23 +71,34 @@ public void setDestination(DestinationInput destination) {
6871
this.destination = destination;
6972
}
7073

71-
public AddDestinationToAudienceAlphaInput idSyncConfiguration(Object idSyncConfiguration) {
74+
public AddDestinationToAudienceAlphaInput idSyncConfiguration(
75+
List<IDSyncConfigurationInput> idSyncConfiguration) {
7276

7377
this.idSyncConfiguration = idSyncConfiguration;
7478
return this;
7579
}
7680

81+
public AddDestinationToAudienceAlphaInput addIdSyncConfigurationItem(
82+
IDSyncConfigurationInput idSyncConfigurationItem) {
83+
if (this.idSyncConfiguration == null) {
84+
this.idSyncConfiguration = new ArrayList<>();
85+
}
86+
this.idSyncConfiguration.add(idSyncConfigurationItem);
87+
return this;
88+
}
89+
7790
/**
78-
* The identifier sync configuration input.
91+
* Identifier sync configuration - array of external IDs to sync with their strategies. Maximum
92+
* 5 items allowed.
7993
*
8094
* @return idSyncConfiguration
8195
*/
8296
@javax.annotation.Nullable
83-
public Object getIdSyncConfiguration() {
97+
public List<IDSyncConfigurationInput> getIdSyncConfiguration() {
8498
return idSyncConfiguration;
8599
}
86100

87-
public void setIdSyncConfiguration(Object idSyncConfiguration) {
101+
public void setIdSyncConfiguration(List<IDSyncConfigurationInput> idSyncConfiguration) {
88102
this.idSyncConfiguration = idSyncConfiguration;
89103
}
90104

@@ -234,6 +248,27 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
234248
JsonObject jsonObj = jsonElement.getAsJsonObject();
235249
// validate the required field `destination`
236250
DestinationInput.validateJsonElement(jsonObj.get("destination"));
251+
if (jsonObj.get("idSyncConfiguration") != null
252+
&& !jsonObj.get("idSyncConfiguration").isJsonNull()) {
253+
JsonArray jsonArrayidSyncConfiguration = jsonObj.getAsJsonArray("idSyncConfiguration");
254+
if (jsonArrayidSyncConfiguration != null) {
255+
// ensure the json data is an array
256+
if (!jsonObj.get("idSyncConfiguration").isJsonArray()) {
257+
throw new IllegalArgumentException(
258+
String.format(
259+
"Expected the field `idSyncConfiguration` to be an array in the"
260+
+ " JSON string but got `%s`",
261+
jsonObj.get("idSyncConfiguration").toString()));
262+
}
263+
264+
// validate the optional field `idSyncConfiguration` (array)
265+
for (int i = 0; i < jsonArrayidSyncConfiguration.size(); i++) {
266+
IDSyncConfigurationInput.validateJsonElement(
267+
jsonArrayidSyncConfiguration.get(i));
268+
}
269+
;
270+
}
271+
}
237272
}
238273

239274
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {

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

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
package com.segment.publicapi.models;
1313

1414
import com.google.gson.Gson;
15+
import com.google.gson.JsonArray;
1516
import com.google.gson.JsonElement;
1617
import com.google.gson.JsonObject;
1718
import com.google.gson.TypeAdapter;
@@ -22,7 +23,9 @@
2223
import com.google.gson.stream.JsonWriter;
2324
import com.segment.publicapi.JSON;
2425
import java.io.IOException;
26+
import java.util.ArrayList;
2527
import java.util.HashSet;
28+
import java.util.List;
2629
import java.util.Map;
2730
import java.util.Objects;
2831
import java.util.Set;
@@ -34,6 +37,11 @@ public class AddDestinationToAudienceAlphaOutput {
3437
@SerializedName(SERIALIZED_NAME_CONNECTION)
3538
private Connection connection;
3639

40+
public static final String SERIALIZED_NAME_ID_SYNC_CONFIGURATION = "idSyncConfiguration";
41+
42+
@SerializedName(SERIALIZED_NAME_ID_SYNC_CONFIGURATION)
43+
private List<IDSyncConfigurationInput> idSyncConfiguration = new ArrayList<>();
44+
3745
public AddDestinationToAudienceAlphaOutput() {}
3846

3947
public AddDestinationToAudienceAlphaOutput connection(Connection connection) {
@@ -56,6 +64,36 @@ public void setConnection(Connection connection) {
5664
this.connection = connection;
5765
}
5866

67+
public AddDestinationToAudienceAlphaOutput idSyncConfiguration(
68+
List<IDSyncConfigurationInput> idSyncConfiguration) {
69+
70+
this.idSyncConfiguration = idSyncConfiguration;
71+
return this;
72+
}
73+
74+
public AddDestinationToAudienceAlphaOutput addIdSyncConfigurationItem(
75+
IDSyncConfigurationInput idSyncConfigurationItem) {
76+
if (this.idSyncConfiguration == null) {
77+
this.idSyncConfiguration = new ArrayList<>();
78+
}
79+
this.idSyncConfiguration.add(idSyncConfigurationItem);
80+
return this;
81+
}
82+
83+
/**
84+
* The id sync configuration for the Destination - array of external ids with their strategies.
85+
*
86+
* @return idSyncConfiguration
87+
*/
88+
@javax.annotation.Nonnull
89+
public List<IDSyncConfigurationInput> getIdSyncConfiguration() {
90+
return idSyncConfiguration;
91+
}
92+
93+
public void setIdSyncConfiguration(List<IDSyncConfigurationInput> idSyncConfiguration) {
94+
this.idSyncConfiguration = idSyncConfiguration;
95+
}
96+
5997
@Override
6098
public boolean equals(Object o) {
6199
if (this == o) {
@@ -66,19 +104,25 @@ public boolean equals(Object o) {
66104
}
67105
AddDestinationToAudienceAlphaOutput addDestinationToAudienceAlphaOutput =
68106
(AddDestinationToAudienceAlphaOutput) o;
69-
return Objects.equals(this.connection, addDestinationToAudienceAlphaOutput.connection);
107+
return Objects.equals(this.connection, addDestinationToAudienceAlphaOutput.connection)
108+
&& Objects.equals(
109+
this.idSyncConfiguration,
110+
addDestinationToAudienceAlphaOutput.idSyncConfiguration);
70111
}
71112

72113
@Override
73114
public int hashCode() {
74-
return Objects.hash(connection);
115+
return Objects.hash(connection, idSyncConfiguration);
75116
}
76117

77118
@Override
78119
public String toString() {
79120
StringBuilder sb = new StringBuilder();
80121
sb.append("class AddDestinationToAudienceAlphaOutput {\n");
81122
sb.append(" connection: ").append(toIndentedString(connection)).append("\n");
123+
sb.append(" idSyncConfiguration: ")
124+
.append(toIndentedString(idSyncConfiguration))
125+
.append("\n");
82126
sb.append("}");
83127
return sb.toString();
84128
}
@@ -101,10 +145,12 @@ private String toIndentedString(Object o) {
101145
// a set of all properties/fields (JSON key names)
102146
openapiFields = new HashSet<String>();
103147
openapiFields.add("connection");
148+
openapiFields.add("idSyncConfiguration");
104149

105150
// a set of required properties/fields (JSON key names)
106151
openapiRequiredFields = new HashSet<String>();
107152
openapiRequiredFields.add("connection");
153+
openapiRequiredFields.add("idSyncConfiguration");
108154
}
109155

110156
/**
@@ -151,6 +197,21 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
151197
JsonObject jsonObj = jsonElement.getAsJsonObject();
152198
// validate the required field `connection`
153199
Connection.validateJsonElement(jsonObj.get("connection"));
200+
// ensure the json data is an array
201+
if (!jsonObj.get("idSyncConfiguration").isJsonArray()) {
202+
throw new IllegalArgumentException(
203+
String.format(
204+
"Expected the field `idSyncConfiguration` to be an array in the JSON"
205+
+ " string but got `%s`",
206+
jsonObj.get("idSyncConfiguration").toString()));
207+
}
208+
209+
JsonArray jsonArrayidSyncConfiguration = jsonObj.getAsJsonArray("idSyncConfiguration");
210+
// validate the required field `idSyncConfiguration` (array)
211+
for (int i = 0; i < jsonArrayidSyncConfiguration.size(); i++) {
212+
IDSyncConfigurationInput.validateJsonElement(jsonArrayidSyncConfiguration.get(i));
213+
}
214+
;
154215
}
155216

156217
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {

0 commit comments

Comments
 (0)