diff --git a/README.md b/README.md index 8d71ecd8..29c1ce36 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ All endpoints in the API follow REST conventions and use standard HTTP methods. See the next sections for more information on how to use the Segment Public API Java SDK. -Latest API and SDK version: 34.3.6 +Latest API and SDK version: 35.0.0 ## Requirements @@ -28,7 +28,7 @@ Add this dependency to your project's POM: com.segment.publicapi segment-publicapi - 34.3.6 + 35.0.0 compile ``` @@ -44,7 +44,7 @@ Add this dependency to your project's build file: } dependencies { - implementation "com.segment.publicapi:segment-publicapi:34.3.6" + implementation "com.segment.publicapi:segment-publicapi:35.0.0" } ``` @@ -58,7 +58,7 @@ mvn clean package Then manually install the following JARs: -* `target/segment-publicapi-34.3.6.jar` +* `target/segment-publicapi-35.0.0.jar` * `target/lib/*.jar` You are now ready to start making calls to Public API! diff --git a/pom.xml b/pom.xml index 7fc7570c..e3efc53b 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ segment-publicapi jar segment-publicapi - 34.3.6 + 35.0.0 https://segment.com/docs/api/public-api/ Segment Public API diff --git a/src/main/java/com/segment/publicapi/ApiClient.java b/src/main/java/com/segment/publicapi/ApiClient.java index b3c001a2..a8797ed1 100644 --- a/src/main/java/com/segment/publicapi/ApiClient.java +++ b/src/main/java/com/segment/publicapi/ApiClient.java @@ -124,7 +124,7 @@ private void init() { json = new JSON(); // Set default User-Agent. - setUserAgent("Public API SDK 34.3.6 (Java)"); + setUserAgent("Public API SDK 35.0.0 (Java)"); authentications = new HashMap(); } diff --git a/src/main/java/com/segment/publicapi/models/RuleV1.java b/src/main/java/com/segment/publicapi/models/RuleV1.java index 78adf379..3796f7f2 100644 --- a/src/main/java/com/segment/publicapi/models/RuleV1.java +++ b/src/main/java/com/segment/publicapi/models/RuleV1.java @@ -27,10 +27,12 @@ import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.math.BigDecimal; +import java.util.Arrays; import java.util.HashSet; import java.util.Map.Entry; import java.util.Objects; import java.util.Set; +import org.openapitools.jackson.nullable.JsonNullable; /** Represents a rule from a Tracking Plan. */ @ApiModel(description = "Represents a rule from a Tracking Plan.") @@ -180,7 +182,7 @@ public RuleV1 jsonSchema(Object jsonSchema) { * @return jsonSchema */ @javax.annotation.Nullable - @ApiModelProperty(required = true, value = "JSON Schema of this rule.") + @ApiModelProperty(value = "JSON Schema of this rule.") public Object getJsonSchema() { return jsonSchema; } @@ -200,8 +202,8 @@ public RuleV1 version(BigDecimal version) { * * @return version */ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Version of this rule.") + @javax.annotation.Nullable + @ApiModelProperty(value = "Version of this rule.") public BigDecimal getVersion() { return version; } @@ -291,11 +293,27 @@ public boolean equals(Object o) { && Objects.equals(this.deprecatedAt, ruleV1.deprecatedAt); } + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + @Override public int hashCode() { return Objects.hash(type, key, jsonSchema, version, createdAt, updatedAt, deprecatedAt); } + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -339,8 +357,6 @@ private String toIndentedString(Object o) { // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); openapiRequiredFields.add("type"); - openapiRequiredFields.add("jsonSchema"); - openapiRequiredFields.add("version"); } /** diff --git a/src/main/java/com/segment/publicapi/models/TrackingPlan.java b/src/main/java/com/segment/publicapi/models/TrackingPlan.java index 524daf30..015de56b 100644 --- a/src/main/java/com/segment/publicapi/models/TrackingPlan.java +++ b/src/main/java/com/segment/publicapi/models/TrackingPlan.java @@ -57,6 +57,8 @@ public class TrackingPlan { /** The Tracking Plan's type. */ @JsonAdapter(TypeEnum.Adapter.class) public enum TypeEnum { + ENGAGE("ENGAGE"), + LIVE("LIVE"), PROPERTY_LIBRARY("PROPERTY_LIBRARY"), diff --git a/src/main/java/com/segment/publicapi/models/TrackingPlan1.java b/src/main/java/com/segment/publicapi/models/TrackingPlan1.java index 44d6ac94..92a0b8da 100644 --- a/src/main/java/com/segment/publicapi/models/TrackingPlan1.java +++ b/src/main/java/com/segment/publicapi/models/TrackingPlan1.java @@ -57,6 +57,8 @@ public class TrackingPlan1 { /** The Tracking Plan's type. */ @JsonAdapter(TypeEnum.Adapter.class) public enum TypeEnum { + ENGAGE("ENGAGE"), + LIVE("LIVE"), PROPERTY_LIBRARY("PROPERTY_LIBRARY"), diff --git a/src/main/java/com/segment/publicapi/models/TrackingPlanV1.java b/src/main/java/com/segment/publicapi/models/TrackingPlanV1.java index b6b79632..51a2f83b 100644 --- a/src/main/java/com/segment/publicapi/models/TrackingPlanV1.java +++ b/src/main/java/com/segment/publicapi/models/TrackingPlanV1.java @@ -57,6 +57,8 @@ public class TrackingPlanV1 { /** The Tracking Plan's type. */ @JsonAdapter(TypeEnum.Adapter.class) public enum TypeEnum { + ENGAGE("ENGAGE"), + LIVE("LIVE"), PROPERTY_LIBRARY("PROPERTY_LIBRARY"), diff --git a/src/main/java/com/segment/publicapi/models/UpsertRuleV1.java b/src/main/java/com/segment/publicapi/models/UpsertRuleV1.java index a1bcdf85..56d69690 100644 --- a/src/main/java/com/segment/publicapi/models/UpsertRuleV1.java +++ b/src/main/java/com/segment/publicapi/models/UpsertRuleV1.java @@ -26,10 +26,12 @@ import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.math.BigDecimal; +import java.util.Arrays; import java.util.HashSet; import java.util.Map.Entry; import java.util.Objects; import java.util.Set; +import org.openapitools.jackson.nullable.JsonNullable; /** UpsertRuleV1 */ public class UpsertRuleV1 { @@ -204,7 +206,7 @@ public UpsertRuleV1 jsonSchema(Object jsonSchema) { * @return jsonSchema */ @javax.annotation.Nullable - @ApiModelProperty(required = true, value = "JSON Schema of this rule.") + @ApiModelProperty(value = "JSON Schema of this rule.") public Object getJsonSchema() { return jsonSchema; } @@ -224,8 +226,8 @@ public UpsertRuleV1 version(BigDecimal version) { * * @return version */ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Version of this rule.") + @javax.annotation.Nullable + @ApiModelProperty(value = "Version of this rule.") public BigDecimal getVersion() { return version; } @@ -316,12 +318,28 @@ public boolean equals(Object o) { && Objects.equals(this.deprecatedAt, upsertRuleV1.deprecatedAt); } + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + @Override public int hashCode() { return Objects.hash( newKey, type, key, jsonSchema, version, createdAt, updatedAt, deprecatedAt); } + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -367,8 +385,6 @@ private String toIndentedString(Object o) { // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); openapiRequiredFields.add("type"); - openapiRequiredFields.add("jsonSchema"); - openapiRequiredFields.add("version"); } /**