Skip to content

Commit 4be8aec

Browse files
author
APIs and Common Services team
committed
Automated SDK update
This updates the SDK from internal repo commit segmentio/public-api@e36063e2.
1 parent 948bf9c commit 4be8aec

File tree

9 files changed

+490
-31
lines changed

9 files changed

+490
-31
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ All endpoints in the API follow REST conventions and use standard HTTP methods.
1010

1111
See the next sections for more information on how to use the Segment Public API Java SDK.
1212

13-
Latest API and SDK version: 54.2.0
13+
Latest API and SDK version: 54.3.0
1414

1515
## Requirements
1616

@@ -28,7 +28,7 @@ Add this dependency to your project's POM:
2828
<dependency>
2929
<groupId>com.segment.publicapi</groupId>
3030
<artifactId>segment-publicapi</artifactId>
31-
<version>54.2.0</version>
31+
<version>54.3.0</version>
3232
<scope>compile</scope>
3333
</dependency>
3434
```
@@ -44,7 +44,7 @@ Add this dependency to your project's build file:
4444
}
4545
4646
dependencies {
47-
implementation "com.segment.publicapi:segment-publicapi:54.2.0"
47+
implementation "com.segment.publicapi:segment-publicapi:54.3.0"
4848
}
4949
```
5050

@@ -58,7 +58,7 @@ mvn clean package
5858

5959
Then manually install the following JARs:
6060

61-
* `target/segment-publicapi-54.2.0.jar`
61+
* `target/segment-publicapi-54.3.0.jar`
6262
* `target/lib/*.jar`
6363

6464
You are now ready to start making calls to Public API!

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<artifactId>segment-publicapi</artifactId>
66
<packaging>jar</packaging>
77
<name>segment-publicapi</name>
8-
<version>54.2.0</version>
8+
<version>54.3.0</version>
99
<url>https://segment.com/docs/api/public-api/</url>
1010
<description>Segment Public API</description>
1111
<scm>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ private void init() {
123123
json = new JSON();
124124

125125
// Set default User-Agent.
126-
setUserAgent("Public API SDK 54.2.0 (Java)");
126+
setUserAgent("Public API SDK 54.3.0 (Java)");
127127

128128
authentications = new HashMap<String, Authentication>();
129129
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
package com.segment.publicapi;
1313

1414
public class Configuration {
15-
public static final String VERSION = "54.2.0";
15+
public static final String VERSION = "54.3.0";
1616

1717
private static ApiClient defaultApiClient = new ApiClient();
1818

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,6 +1322,9 @@ private static Class getClassByDiscriminator(
13221322
.CustomTypeAdapterFactory());
13231323
gsonBuilder.registerTypeAdapterFactory(
13241324
new com.segment.publicapi.models.ReverseETLSyncStatus.CustomTypeAdapterFactory());
1325+
gsonBuilder.registerTypeAdapterFactory(
1326+
new com.segment.publicapi.models.ReverseEtlCronScheduleConfig
1327+
.CustomTypeAdapterFactory());
13251328
gsonBuilder.registerTypeAdapterFactory(
13261329
new com.segment.publicapi.models.ReverseEtlModel.CustomTypeAdapterFactory());
13271330
gsonBuilder.registerTypeAdapterFactory(

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

Lines changed: 77 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
4646
gson.getDelegateAdapter(
4747
this,
4848
TypeToken.get(ReverseEtlSpecificTimeScheduleConfig.class));
49+
final TypeAdapter<ReverseEtlCronScheduleConfig> adapterReverseEtlCronScheduleConfig =
50+
gson.getDelegateAdapter(
51+
this, TypeToken.get(ReverseEtlCronScheduleConfig.class));
4952

5053
return (TypeAdapter<T>)
5154
new TypeAdapter<Config>() {
@@ -78,8 +81,19 @@ public void write(JsonWriter out, Config value) throws IOException {
7881
elementAdapter.write(out, element);
7982
return;
8083
}
84+
// check if the actual instance is of the type
85+
// `ReverseEtlCronScheduleConfig`
86+
if (value.getActualInstance() instanceof ReverseEtlCronScheduleConfig) {
87+
JsonElement element =
88+
adapterReverseEtlCronScheduleConfig.toJsonTree(
89+
(ReverseEtlCronScheduleConfig)
90+
value.getActualInstance());
91+
elementAdapter.write(out, element);
92+
return;
93+
}
8194
throw new IOException(
8295
"Failed to serialize as the type doesn't match anyOf schemae:"
96+
+ " ReverseEtlCronScheduleConfig,"
8397
+ " ReverseEtlPeriodicScheduleConfig,"
8498
+ " ReverseEtlSpecificTimeScheduleConfig");
8599
}
@@ -137,6 +151,27 @@ public Config read(JsonReader in) throws IOException {
137151
+ " 'ReverseEtlSpecificTimeScheduleConfig'",
138152
e);
139153
}
154+
// deserialize ReverseEtlCronScheduleConfig
155+
try {
156+
// validate the JSON object to see if any exception is thrown
157+
ReverseEtlCronScheduleConfig.validateJsonElement(jsonElement);
158+
actualAdapter = adapterReverseEtlCronScheduleConfig;
159+
Config ret = new Config();
160+
ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement));
161+
return ret;
162+
} catch (Exception e) {
163+
// deserialization failed, continue
164+
errorMessages.add(
165+
String.format(
166+
"Deserialization for ReverseEtlCronScheduleConfig"
167+
+ " failed with `%s`.",
168+
e.getMessage()));
169+
log.log(
170+
Level.FINER,
171+
"Input data does not match schema"
172+
+ " 'ReverseEtlCronScheduleConfig'",
173+
e);
174+
}
140175

141176
throw new IOException(
142177
String.format(
@@ -156,6 +191,11 @@ public Config() {
156191
super("anyOf", Boolean.TRUE);
157192
}
158193

194+
public Config(ReverseEtlCronScheduleConfig o) {
195+
super("anyOf", Boolean.TRUE);
196+
setActualInstance(o);
197+
}
198+
159199
public Config(ReverseEtlPeriodicScheduleConfig o) {
160200
super("anyOf", Boolean.TRUE);
161201
setActualInstance(o);
@@ -170,6 +210,7 @@ public Config(ReverseEtlSpecificTimeScheduleConfig o) {
170210
schemas.put("ReverseEtlPeriodicScheduleConfig", ReverseEtlPeriodicScheduleConfig.class);
171211
schemas.put(
172212
"ReverseEtlSpecificTimeScheduleConfig", ReverseEtlSpecificTimeScheduleConfig.class);
213+
schemas.put("ReverseEtlCronScheduleConfig", ReverseEtlCronScheduleConfig.class);
173214
}
174215

175216
@Override
@@ -179,8 +220,8 @@ public Map<String, Class<?>> getSchemas() {
179220

180221
/**
181222
* Set the instance that matches the anyOf child schema, check the instance parameter is valid
182-
* against the anyOf child schemas: ReverseEtlPeriodicScheduleConfig,
183-
* ReverseEtlSpecificTimeScheduleConfig
223+
* against the anyOf child schemas: ReverseEtlCronScheduleConfig,
224+
* ReverseEtlPeriodicScheduleConfig, ReverseEtlSpecificTimeScheduleConfig
184225
*
185226
* <p>It could be an instance of the 'anyOf' schemas.
186227
*/
@@ -201,16 +242,21 @@ public void setActualInstance(Object instance) {
201242
return;
202243
}
203244

245+
if (instance instanceof ReverseEtlCronScheduleConfig) {
246+
super.setActualInstance(instance);
247+
return;
248+
}
249+
204250
throw new RuntimeException(
205-
"Invalid instance type. Must be ReverseEtlPeriodicScheduleConfig,"
206-
+ " ReverseEtlSpecificTimeScheduleConfig");
251+
"Invalid instance type. Must be ReverseEtlCronScheduleConfig,"
252+
+ " ReverseEtlPeriodicScheduleConfig, ReverseEtlSpecificTimeScheduleConfig");
207253
}
208254

209255
/**
210-
* Get the actual instance, which can be the following: ReverseEtlPeriodicScheduleConfig,
211-
* ReverseEtlSpecificTimeScheduleConfig
256+
* Get the actual instance, which can be the following: ReverseEtlCronScheduleConfig,
257+
* ReverseEtlPeriodicScheduleConfig, ReverseEtlSpecificTimeScheduleConfig
212258
*
213-
* @return The actual instance (ReverseEtlPeriodicScheduleConfig,
259+
* @return The actual instance (ReverseEtlCronScheduleConfig, ReverseEtlPeriodicScheduleConfig,
214260
* ReverseEtlSpecificTimeScheduleConfig)
215261
*/
216262
@Override
@@ -242,6 +288,18 @@ public ReverseEtlSpecificTimeScheduleConfig getReverseEtlSpecificTimeScheduleCon
242288
return (ReverseEtlSpecificTimeScheduleConfig) super.getActualInstance();
243289
}
244290

291+
/**
292+
* Get the actual instance of `ReverseEtlCronScheduleConfig`. If the actual instance is not
293+
* `ReverseEtlCronScheduleConfig`, the ClassCastException will be thrown.
294+
*
295+
* @return The actual instance of `ReverseEtlCronScheduleConfig`
296+
* @throws ClassCastException if the instance is not `ReverseEtlCronScheduleConfig`
297+
*/
298+
public ReverseEtlCronScheduleConfig getReverseEtlCronScheduleConfig()
299+
throws ClassCastException {
300+
return (ReverseEtlCronScheduleConfig) super.getActualInstance();
301+
}
302+
245303
/**
246304
* Validates the JSON Element and throws an exception if issues found
247305
*
@@ -275,10 +333,21 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
275333
e.getMessage()));
276334
// continue to the next one
277335
}
336+
// validate the json string with ReverseEtlCronScheduleConfig
337+
try {
338+
ReverseEtlCronScheduleConfig.validateJsonElement(jsonElement);
339+
return;
340+
} catch (Exception e) {
341+
errorMessages.add(
342+
String.format(
343+
"Deserialization for ReverseEtlCronScheduleConfig failed with `%s`.",
344+
e.getMessage()));
345+
// continue to the next one
346+
}
278347
throw new IOException(
279348
String.format(
280349
"The JSON string is invalid for Config with anyOf schemas:"
281-
+ " ReverseEtlPeriodicScheduleConfig,"
350+
+ " ReverseEtlCronScheduleConfig, ReverseEtlPeriodicScheduleConfig,"
282351
+ " ReverseEtlSpecificTimeScheduleConfig. no class match the result,"
283352
+ " expected at least 1. Detailed failure message for anyOf schemas:"
284353
+ " %s. JSON: %s",

0 commit comments

Comments
 (0)