Skip to content

Commit b1b969f

Browse files
author
APIs and Common Services team
committed
Automated SDK update
This updates the SDK from internal repo commit segmentio/public-api@7b03d4b7.
1 parent c27a047 commit b1b969f

File tree

10 files changed

+430
-23
lines changed

10 files changed

+430
-23
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: 57.2.0
13+
Latest API and SDK version: 57.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>57.2.0</version>
31+
<version>57.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:57.2.0"
47+
implementation "com.segment.publicapi:segment-publicapi:57.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-57.2.0.jar`
61+
* `target/segment-publicapi-57.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>57.2.0</version>
8+
<version>57.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 57.2.0 (Java)");
126+
setUserAgent("Public API SDK 57.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 = "57.2.0";
15+
public static final String VERSION = "57.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
@@ -1345,6 +1345,9 @@ private static Class getClassByDiscriminator(
13451345
gsonBuilder.registerTypeAdapterFactory(
13461346
new com.segment.publicapi.models.ReverseEtlCronScheduleConfig
13471347
.CustomTypeAdapterFactory());
1348+
gsonBuilder.registerTypeAdapterFactory(
1349+
new com.segment.publicapi.models.ReverseEtlDbtCloudScheduleConfig
1350+
.CustomTypeAdapterFactory());
13481351
gsonBuilder.registerTypeAdapterFactory(
13491352
new com.segment.publicapi.models.ReverseEtlModel.CustomTypeAdapterFactory());
13501353
gsonBuilder.registerTypeAdapterFactory(

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

Lines changed: 83 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
4949
final TypeAdapter<ReverseEtlCronScheduleConfig> adapterReverseEtlCronScheduleConfig =
5050
gson.getDelegateAdapter(
5151
this, TypeToken.get(ReverseEtlCronScheduleConfig.class));
52+
final TypeAdapter<ReverseEtlDbtCloudScheduleConfig>
53+
adapterReverseEtlDbtCloudScheduleConfig =
54+
gson.getDelegateAdapter(
55+
this, TypeToken.get(ReverseEtlDbtCloudScheduleConfig.class));
5256

5357
return (TypeAdapter<T>)
5458
new TypeAdapter<Config>() {
@@ -91,9 +95,21 @@ public void write(JsonWriter out, Config value) throws IOException {
9195
elementAdapter.write(out, element);
9296
return;
9397
}
98+
// check if the actual instance is of the type
99+
// `ReverseEtlDbtCloudScheduleConfig`
100+
if (value.getActualInstance()
101+
instanceof ReverseEtlDbtCloudScheduleConfig) {
102+
JsonElement element =
103+
adapterReverseEtlDbtCloudScheduleConfig.toJsonTree(
104+
(ReverseEtlDbtCloudScheduleConfig)
105+
value.getActualInstance());
106+
elementAdapter.write(out, element);
107+
return;
108+
}
94109
throw new IOException(
95110
"Failed to serialize as the type doesn't match anyOf schemae:"
96111
+ " ReverseEtlCronScheduleConfig,"
112+
+ " ReverseEtlDbtCloudScheduleConfig,"
97113
+ " ReverseEtlPeriodicScheduleConfig,"
98114
+ " ReverseEtlSpecificTimeScheduleConfig");
99115
}
@@ -172,6 +188,28 @@ public Config read(JsonReader in) throws IOException {
172188
+ " 'ReverseEtlCronScheduleConfig'",
173189
e);
174190
}
191+
// deserialize ReverseEtlDbtCloudScheduleConfig
192+
try {
193+
// validate the JSON object to see if any exception is thrown
194+
ReverseEtlDbtCloudScheduleConfig.validateJsonElement(jsonElement);
195+
actualAdapter = adapterReverseEtlDbtCloudScheduleConfig;
196+
Config ret = new Config();
197+
ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement));
198+
return ret;
199+
} catch (Exception e) {
200+
// deserialization failed, continue
201+
errorMessages.add(
202+
String.format(
203+
"Deserialization for"
204+
+ " ReverseEtlDbtCloudScheduleConfig failed"
205+
+ " with `%s`.",
206+
e.getMessage()));
207+
log.log(
208+
Level.FINER,
209+
"Input data does not match schema"
210+
+ " 'ReverseEtlDbtCloudScheduleConfig'",
211+
e);
212+
}
175213

176214
throw new IOException(
177215
String.format(
@@ -196,6 +234,11 @@ public Config(ReverseEtlCronScheduleConfig o) {
196234
setActualInstance(o);
197235
}
198236

237+
public Config(ReverseEtlDbtCloudScheduleConfig o) {
238+
super("anyOf", Boolean.TRUE);
239+
setActualInstance(o);
240+
}
241+
199242
public Config(ReverseEtlPeriodicScheduleConfig o) {
200243
super("anyOf", Boolean.TRUE);
201244
setActualInstance(o);
@@ -211,6 +254,7 @@ public Config(ReverseEtlSpecificTimeScheduleConfig o) {
211254
schemas.put(
212255
"ReverseEtlSpecificTimeScheduleConfig", ReverseEtlSpecificTimeScheduleConfig.class);
213256
schemas.put("ReverseEtlCronScheduleConfig", ReverseEtlCronScheduleConfig.class);
257+
schemas.put("ReverseEtlDbtCloudScheduleConfig", ReverseEtlDbtCloudScheduleConfig.class);
214258
}
215259

216260
@Override
@@ -221,7 +265,8 @@ public Map<String, Class<?>> getSchemas() {
221265
/**
222266
* Set the instance that matches the anyOf child schema, check the instance parameter is valid
223267
* against the anyOf child schemas: ReverseEtlCronScheduleConfig,
224-
* ReverseEtlPeriodicScheduleConfig, ReverseEtlSpecificTimeScheduleConfig
268+
* ReverseEtlDbtCloudScheduleConfig, ReverseEtlPeriodicScheduleConfig,
269+
* ReverseEtlSpecificTimeScheduleConfig
225270
*
226271
* <p>It could be an instance of the 'anyOf' schemas.
227272
*/
@@ -247,17 +292,24 @@ public void setActualInstance(Object instance) {
247292
return;
248293
}
249294

295+
if (instance instanceof ReverseEtlDbtCloudScheduleConfig) {
296+
super.setActualInstance(instance);
297+
return;
298+
}
299+
250300
throw new RuntimeException(
251301
"Invalid instance type. Must be ReverseEtlCronScheduleConfig,"
252-
+ " ReverseEtlPeriodicScheduleConfig, ReverseEtlSpecificTimeScheduleConfig");
302+
+ " ReverseEtlDbtCloudScheduleConfig, ReverseEtlPeriodicScheduleConfig,"
303+
+ " ReverseEtlSpecificTimeScheduleConfig");
253304
}
254305

255306
/**
256307
* Get the actual instance, which can be the following: ReverseEtlCronScheduleConfig,
257-
* ReverseEtlPeriodicScheduleConfig, ReverseEtlSpecificTimeScheduleConfig
308+
* ReverseEtlDbtCloudScheduleConfig, ReverseEtlPeriodicScheduleConfig,
309+
* ReverseEtlSpecificTimeScheduleConfig
258310
*
259-
* @return The actual instance (ReverseEtlCronScheduleConfig, ReverseEtlPeriodicScheduleConfig,
260-
* ReverseEtlSpecificTimeScheduleConfig)
311+
* @return The actual instance (ReverseEtlCronScheduleConfig, ReverseEtlDbtCloudScheduleConfig,
312+
* ReverseEtlPeriodicScheduleConfig, ReverseEtlSpecificTimeScheduleConfig)
261313
*/
262314
@Override
263315
public Object getActualInstance() {
@@ -300,6 +352,18 @@ public ReverseEtlCronScheduleConfig getReverseEtlCronScheduleConfig()
300352
return (ReverseEtlCronScheduleConfig) super.getActualInstance();
301353
}
302354

355+
/**
356+
* Get the actual instance of `ReverseEtlDbtCloudScheduleConfig`. If the actual instance is not
357+
* `ReverseEtlDbtCloudScheduleConfig`, the ClassCastException will be thrown.
358+
*
359+
* @return The actual instance of `ReverseEtlDbtCloudScheduleConfig`
360+
* @throws ClassCastException if the instance is not `ReverseEtlDbtCloudScheduleConfig`
361+
*/
362+
public ReverseEtlDbtCloudScheduleConfig getReverseEtlDbtCloudScheduleConfig()
363+
throws ClassCastException {
364+
return (ReverseEtlDbtCloudScheduleConfig) super.getActualInstance();
365+
}
366+
303367
/**
304368
* Validates the JSON Element and throws an exception if issues found
305369
*
@@ -344,10 +408,23 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
344408
e.getMessage()));
345409
// continue to the next one
346410
}
411+
// validate the json string with ReverseEtlDbtCloudScheduleConfig
412+
try {
413+
ReverseEtlDbtCloudScheduleConfig.validateJsonElement(jsonElement);
414+
return;
415+
} catch (Exception e) {
416+
errorMessages.add(
417+
String.format(
418+
"Deserialization for ReverseEtlDbtCloudScheduleConfig failed with"
419+
+ " `%s`.",
420+
e.getMessage()));
421+
// continue to the next one
422+
}
347423
throw new IOException(
348424
String.format(
349425
"The JSON string is invalid for Config with anyOf schemas:"
350-
+ " ReverseEtlCronScheduleConfig, ReverseEtlPeriodicScheduleConfig,"
426+
+ " ReverseEtlCronScheduleConfig, ReverseEtlDbtCloudScheduleConfig,"
427+
+ " ReverseEtlPeriodicScheduleConfig,"
351428
+ " ReverseEtlSpecificTimeScheduleConfig. no class match the result,"
352429
+ " expected at least 1. Detailed failure message for anyOf schemas:"
353430
+ " %s. JSON: %s",

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import java.util.Objects;
2828
import java.util.Set;
2929

30-
/** Defines the DBT Model Sync Trigger. */
30+
/** Defines the dbt Model Sync Trigger. */
3131
public class DbtModelSyncTrigger {
3232
public static final String SERIALIZED_NAME_ID = "id";
3333

@@ -53,7 +53,7 @@ public DbtModelSyncTrigger id(String id) {
5353
}
5454

5555
/**
56-
* The id of the DBT Model Sync.
56+
* The id of the dbt model sync.
5757
*
5858
* @return id
5959
*/

0 commit comments

Comments
 (0)