From c97cb04292da250a52718eb8d2135a243f8ebaaf Mon Sep 17 00:00:00 2001 From: Ilya Taratukhin Date: Fri, 22 Dec 2023 16:09:07 +0100 Subject: [PATCH 1/7] chore: introduce `datacenter` field for the `IpInfo` signal in addition to the wrong `dataCenter` --- README.md | 4 ++- docs/IpInfoResultV4.md | 1 + docs/IpInfoResultV6.md | 1 + res/fingerprint-server-api.yaml | 10 ++++-- .../com/fingerprint/model/IpInfoResultV4.java | 34 ++++++++++++++++++- .../com/fingerprint/model/IpInfoResultV6.java | 34 ++++++++++++++++++- src/test/resources/mocks/get_event.json | 4 +-- 7 files changed, 81 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 8f69fba..5f6caee 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,9 @@ # Fingerprint Pro Server API Java SDK -[Fingerprint](https://fingerprint.com/) is a device intelligence platform offering 99.5% accurate visitor identification. The Fingerprint Server Java SDK is an easy way to interact with the Fingerprint [Server API](https://dev.fingerprint.com/reference/pro-server-api) from your Java application. You can retrieve visitor history or individual identification events. +**Fingerprint Pro Server API allows you to get information about visitors and about individual events in a server environment. +It can be used for data exports, decision-making, and data analysis scenarios. +Server API is intended for server-side usage, it's not intended to be used from the client side, whether it's a browser or a mobile device.** *Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* diff --git a/docs/IpInfoResultV4.md b/docs/IpInfoResultV4.md index 2ba0da8..d5cc0f0 100644 --- a/docs/IpInfoResultV4.md +++ b/docs/IpInfoResultV4.md @@ -10,6 +10,7 @@ |**address** | **String** | | [optional] | |**geolocation** | [**IPLocation**](IPLocation.md) | | [optional] | |**asn** | [**ASN**](ASN.md) | | [optional] | +|**datacenter** | [**DataCenter**](DataCenter.md) | | [optional] | |**dataCenter** | [**DataCenter**](DataCenter.md) | | [optional] | diff --git a/docs/IpInfoResultV6.md b/docs/IpInfoResultV6.md index b1889a0..ad240e2 100644 --- a/docs/IpInfoResultV6.md +++ b/docs/IpInfoResultV6.md @@ -10,6 +10,7 @@ |**address** | **String** | | [optional] | |**geolocation** | [**IPLocation**](IPLocation.md) | | [optional] | |**asn** | [**ASN**](ASN.md) | | [optional] | +|**datacenter** | [**DataCenter**](DataCenter.md) | | [optional] | |**dataCenter** | [**DataCenter**](DataCenter.md) | | [optional] | diff --git a/res/fingerprint-server-api.yaml b/res/fingerprint-server-api.yaml index d5a61a2..8de4b19 100644 --- a/res/fingerprint-server-api.yaml +++ b/res/fingerprint-server-api.yaml @@ -158,7 +158,7 @@ paths: asn: '7922' name: COMCAST-7922 network: 73.136.0.0/13 - dataCenter: + datacenter: result: true name: DediPath incognito: @@ -3701,7 +3701,7 @@ paths: asn: '7922' name: COMCAST-7922 network: 73.136.0.0/13 - dataCenter: + datacenter: result: true name: DediPath rootApps: @@ -4857,6 +4857,9 @@ components: $ref: '#/components/schemas/IPLocation' asn: $ref: '#/components/schemas/ASN' + datacenter: + $ref: '#/components/schemas/DataCenter' + # `dataCenter` is deprecated in favor of `datacenter` dataCenter: $ref: '#/components/schemas/DataCenter' v6: @@ -4871,6 +4874,9 @@ components: $ref: '#/components/schemas/IPLocation' asn: $ref: '#/components/schemas/ASN' + datacenter: + $ref: '#/components/schemas/DataCenter' + # `dataCenter` is deprecated in favor of `datacenter` dataCenter: $ref: '#/components/schemas/DataCenter' IpBlockListResult: diff --git a/src/main/java/com/fingerprint/model/IpInfoResultV4.java b/src/main/java/com/fingerprint/model/IpInfoResultV4.java index 3eadf3f..3b1ecd8 100644 --- a/src/main/java/com/fingerprint/model/IpInfoResultV4.java +++ b/src/main/java/com/fingerprint/model/IpInfoResultV4.java @@ -38,6 +38,7 @@ IpInfoResultV4.JSON_PROPERTY_ADDRESS, IpInfoResultV4.JSON_PROPERTY_GEOLOCATION, IpInfoResultV4.JSON_PROPERTY_ASN, + IpInfoResultV4.JSON_PROPERTY_DATACENTER, IpInfoResultV4.JSON_PROPERTY_DATA_CENTER }) @JsonTypeName("IpInfoResult_v4") @@ -52,6 +53,9 @@ public class IpInfoResultV4 { public static final String JSON_PROPERTY_ASN = "asn"; private ASN asn; + public static final String JSON_PROPERTY_DATACENTER = "datacenter"; + private DataCenter datacenter; + public static final String JSON_PROPERTY_DATA_CENTER = "dataCenter"; private DataCenter dataCenter; @@ -136,6 +140,32 @@ public void setAsn(ASN asn) { } + public IpInfoResultV4 datacenter(DataCenter datacenter) { + this.datacenter = datacenter; + return this; + } + + /** + * Get datacenter + * @return datacenter + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DATACENTER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public DataCenter getDatacenter() { + return datacenter; + } + + + @JsonProperty(JSON_PROPERTY_DATACENTER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDatacenter(DataCenter datacenter) { + this.datacenter = datacenter; + } + + public IpInfoResultV4 dataCenter(DataCenter dataCenter) { this.dataCenter = dataCenter; return this; @@ -177,12 +207,13 @@ public boolean equals(Object o) { return Objects.equals(this.address, ipInfoResultV4.address) && Objects.equals(this.geolocation, ipInfoResultV4.geolocation) && Objects.equals(this.asn, ipInfoResultV4.asn) && + Objects.equals(this.datacenter, ipInfoResultV4.datacenter) && Objects.equals(this.dataCenter, ipInfoResultV4.dataCenter); } @Override public int hashCode() { - return Objects.hash(address, geolocation, asn, dataCenter); + return Objects.hash(address, geolocation, asn, datacenter, dataCenter); } @Override @@ -192,6 +223,7 @@ public String toString() { sb.append(" address: ").append(toIndentedString(address)).append("\n"); sb.append(" geolocation: ").append(toIndentedString(geolocation)).append("\n"); sb.append(" asn: ").append(toIndentedString(asn)).append("\n"); + sb.append(" datacenter: ").append(toIndentedString(datacenter)).append("\n"); sb.append(" dataCenter: ").append(toIndentedString(dataCenter)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/fingerprint/model/IpInfoResultV6.java b/src/main/java/com/fingerprint/model/IpInfoResultV6.java index 3ac1efd..5189125 100644 --- a/src/main/java/com/fingerprint/model/IpInfoResultV6.java +++ b/src/main/java/com/fingerprint/model/IpInfoResultV6.java @@ -38,6 +38,7 @@ IpInfoResultV6.JSON_PROPERTY_ADDRESS, IpInfoResultV6.JSON_PROPERTY_GEOLOCATION, IpInfoResultV6.JSON_PROPERTY_ASN, + IpInfoResultV6.JSON_PROPERTY_DATACENTER, IpInfoResultV6.JSON_PROPERTY_DATA_CENTER }) @JsonTypeName("IpInfoResult_v6") @@ -52,6 +53,9 @@ public class IpInfoResultV6 { public static final String JSON_PROPERTY_ASN = "asn"; private ASN asn; + public static final String JSON_PROPERTY_DATACENTER = "datacenter"; + private DataCenter datacenter; + public static final String JSON_PROPERTY_DATA_CENTER = "dataCenter"; private DataCenter dataCenter; @@ -136,6 +140,32 @@ public void setAsn(ASN asn) { } + public IpInfoResultV6 datacenter(DataCenter datacenter) { + this.datacenter = datacenter; + return this; + } + + /** + * Get datacenter + * @return datacenter + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DATACENTER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public DataCenter getDatacenter() { + return datacenter; + } + + + @JsonProperty(JSON_PROPERTY_DATACENTER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDatacenter(DataCenter datacenter) { + this.datacenter = datacenter; + } + + public IpInfoResultV6 dataCenter(DataCenter dataCenter) { this.dataCenter = dataCenter; return this; @@ -177,12 +207,13 @@ public boolean equals(Object o) { return Objects.equals(this.address, ipInfoResultV6.address) && Objects.equals(this.geolocation, ipInfoResultV6.geolocation) && Objects.equals(this.asn, ipInfoResultV6.asn) && + Objects.equals(this.datacenter, ipInfoResultV6.datacenter) && Objects.equals(this.dataCenter, ipInfoResultV6.dataCenter); } @Override public int hashCode() { - return Objects.hash(address, geolocation, asn, dataCenter); + return Objects.hash(address, geolocation, asn, datacenter, dataCenter); } @Override @@ -192,6 +223,7 @@ public String toString() { sb.append(" address: ").append(toIndentedString(address)).append("\n"); sb.append(" geolocation: ").append(toIndentedString(geolocation)).append("\n"); sb.append(" asn: ").append(toIndentedString(asn)).append("\n"); + sb.append(" datacenter: ").append(toIndentedString(datacenter)).append("\n"); sb.append(" dataCenter: ").append(toIndentedString(dataCenter)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/test/resources/mocks/get_event.json b/src/test/resources/mocks/get_event.json index 0a89f7d..808f12f 100644 --- a/src/test/resources/mocks/get_event.json +++ b/src/test/resources/mocks/get_event.json @@ -100,7 +100,7 @@ "name": "COMCAST-7922", "network": "73.136.0.0/13" }, - "dataCenter": { + "datacenter": { "result": true, "name": "DediPath" } @@ -229,4 +229,4 @@ } } } -} \ No newline at end of file +} From 529441eed040d2f6e4af0fd140be33fb3c6dfdcd Mon Sep 17 00:00:00 2001 From: Ilya Taratukhin Date: Tue, 2 Jan 2024 17:35:05 +0100 Subject: [PATCH 2/7] chore: add model template to the repo --- template/pojo.mustache | 392 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 392 insertions(+) create mode 100644 template/pojo.mustache diff --git a/template/pojo.mustache b/template/pojo.mustache new file mode 100644 index 0000000..2ea5d15 --- /dev/null +++ b/template/pojo.mustache @@ -0,0 +1,392 @@ +/** + * {{description}}{{^description}}{{classname}}{{/description}}{{#isDeprecated}} + * @deprecated{{/isDeprecated}} + */{{#isDeprecated}} +@Deprecated{{/isDeprecated}}{{#description}} +@ApiModel(description = "{{{.}}}"){{/description}} +{{#jackson}} +@JsonPropertyOrder({ +{{#vars}} + {{classname}}.JSON_PROPERTY_{{nameInSnakeCase}}{{^-last}},{{/-last}} +{{/vars}} +}) +{{#isClassnameSanitized}} +@JsonTypeName("{{name}}") +{{/isClassnameSanitized}} +{{/jackson}} +{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}} +{{#vendorExtensions.x-class-extra-annotation}} +{{{vendorExtensions.x-class-extra-annotation}}} +{{/vendorExtensions.x-class-extra-annotation}} +public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{#-last}} {{/-last}}{{/vendorExtensions.x-implements}}{ +{{#serializableModel}} + private static final long serialVersionUID = 1L; + +{{/serializableModel}} + {{#vars}} + {{#isEnum}} + {{^isContainer}} +{{>modelInnerEnum}} + {{/isContainer}} + {{#isContainer}} + {{#mostInnerItems}} +{{>modelInnerEnum}} + {{/mostInnerItems}} + {{/isContainer}} + {{/isEnum}} + {{#gson}} + public static final String SERIALIZED_NAME_{{nameInSnakeCase}} = "{{baseName}}"; + {{/gson}} + {{#jackson}} + public static final String JSON_PROPERTY_{{nameInSnakeCase}} = "{{baseName}}"; + {{/jackson}} + {{#withXml}} + {{#isXmlAttribute}} + @XmlAttribute(name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") + {{/isXmlAttribute}} + {{^isXmlAttribute}} + {{^isContainer}} + @XmlElement({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") + {{/isContainer}} + {{#isContainer}} + // Is a container wrapped={{isXmlWrapped}} + {{#items}} + // items.name={{name}} items.baseName={{baseName}} items.xmlName={{xmlName}} items.xmlNamespace={{xmlNamespace}} + // items.example={{example}} items.type={{dataType}} + @XmlElement({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") + {{/items}} + {{#isXmlWrapped}} + @XmlElementWrapper({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") + {{/isXmlWrapped}} + {{/isContainer}} + {{#isDateTime}} + @XmlJavaTypeAdapter(OffsetDateTimeXmlAdapter.class) + {{/isDateTime}} + {{/isXmlAttribute}} + {{/withXml}} + {{#gson}} + @SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}}) + {{/gson}} + {{#vendorExtensions.x-field-extra-annotation}} + {{{vendorExtensions.x-field-extra-annotation}}} + {{/vendorExtensions.x-field-extra-annotation}} + {{#vendorExtensions.x-is-jackson-optional-nullable}} + {{#isContainer}} + private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined(); + {{/isContainer}} + {{^isContainer}} + private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>{{#defaultValue}}of({{{.}}}){{/defaultValue}}{{^defaultValue}}undefined(){{/defaultValue}}; + {{/isContainer}} + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + {{#isContainer}} + private {{{datatypeWithEnum}}} {{name}}{{#required}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/required}}{{^required}} = null{{/required}}; + {{/isContainer}} + {{^isContainer}} + {{#isDiscriminator}}protected{{/isDiscriminator}}{{^isDiscriminator}}private{{/isDiscriminator}} {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; + {{/isContainer}} + {{/vendorExtensions.x-is-jackson-optional-nullable}} + + {{/vars}} + public {{classname}}() { + {{#parent}} + {{#parcelableModel}} + super();{{/parcelableModel}} + {{/parent}} + {{#gson}} + {{#discriminator}} + {{#discriminator.isEnum}} + this.{{{discriminatorName}}} = this.getClass().getSimpleName(); + {{/discriminator.isEnum}} + {{/discriminator}} + {{/gson}} + } + {{#vendorExtensions.x-has-readonly-properties}} + {{^withXml}} + + {{#jsonb}}@JsonbCreator{{/jsonb}}{{#jackson}}@JsonCreator{{/jackson}} + public {{classname}}( + {{#readOnlyVars}} + {{#jsonb}}@JsonbProperty(value = "{{baseName}}"{{^required}}, nillable = true{{/required}}){{/jsonb}}{{#jackson}}@JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}}){{/jackson}} {{{datatypeWithEnum}}} {{name}}{{^-last}}, {{/-last}} + {{/readOnlyVars}} + ) { + this(); + {{#readOnlyVars}} + this.{{name}} = {{#vendorExtensions.x-is-jackson-optional-nullable}}{{name}} == null ? JsonNullable.<{{{datatypeWithEnum}}}>undefined() : JsonNullable.of({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{name}}{{/vendorExtensions.x-is-jackson-optional-nullable}}; + {{/readOnlyVars}} + } + {{/withXml}} + {{/vendorExtensions.x-has-readonly-properties}} + {{#vars}} + + {{^isReadOnly}} + public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) { + {{#vendorExtensions.x-is-jackson-optional-nullable}}this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{name}});{{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}this.{{name}} = {{name}};{{/vendorExtensions.x-is-jackson-optional-nullable}} + return this; + } + {{#isArray}} + + public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + if (this.{{name}} == null || !this.{{name}}.isPresent()) { + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}); + } + try { + this.{{name}}.get().add({{name}}Item); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + {{^required}} + if (this.{{name}} == null) { + this.{{name}} = {{{defaultValue}}}; + } + {{/required}} + this.{{name}}.add({{name}}Item); + return this; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + } + {{/isArray}} + {{#isMap}} + + public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + if (this.{{name}} == null || !this.{{name}}.isPresent()) { + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}); + } + try { + this.{{name}}.get().put(key, {{name}}Item); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + {{^required}} + if (this.{{name}} == null) { + this.{{name}} = {{{defaultValue}}}; + } + {{/required}} + this.{{name}}.put(key, {{name}}Item); + return this; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + } + {{/isMap}} + + {{/isReadOnly}} + /** + {{#description}} + * {{.}} + {{/description}} + {{^description}} + * Get {{name}} + {{/description}} + {{#minimum}} + * minimum: {{.}} + {{/minimum}} + {{#maximum}} + * maximum: {{.}} + {{/maximum}} + * @return {{name}} + {{#deprecated}} + * @deprecated + {{/deprecated}} + **/ +{{#deprecated}} + @Deprecated +{{/deprecated}} +{{#required}} +{{#isNullable}} + @javax.annotation.Nullable +{{/isNullable}} +{{^isNullable}} + @javax.annotation.Nonnull +{{/isNullable}} +{{/required}} +{{^required}} + @javax.annotation.Nullable +{{/required}} +{{#jsonb}} + @JsonbProperty("{{baseName}}") +{{/jsonb}} +{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") +{{#vendorExtensions.x-extra-annotation}} + {{{vendorExtensions.x-extra-annotation}}} +{{/vendorExtensions.x-extra-annotation}} +{{#vendorExtensions.x-is-jackson-optional-nullable}} + {{!unannotated, Jackson would pick this up automatically and add it *in addition* to the _JsonNullable getter field}} + @JsonIgnore +{{/vendorExtensions.x-is-jackson-optional-nullable}} +{{^vendorExtensions.x-is-jackson-optional-nullable}}{{#jackson}}{{> jackson_annotations}}{{/jackson}}{{/vendorExtensions.x-is-jackson-optional-nullable}} + public {{{datatypeWithEnum}}} {{getter}}() { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + {{#isReadOnly}}{{! A readonly attribute doesn't have setter => jackson will set null directly if explicitly returned by API, so make sure we have an empty JsonNullable}} + if ({{name}} == null) { + {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>{{#defaultValue}}of({{{.}}}){{/defaultValue}}{{^defaultValue}}undefined(){{/defaultValue}}; + } + {{/isReadOnly}} + return {{name}}.orElse(null); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + return {{name}}; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + } + + {{#vendorExtensions.x-is-jackson-optional-nullable}} +{{> jackson_annotations}} + public JsonNullable<{{{datatypeWithEnum}}}> {{getter}}_JsonNullable() { + return {{name}}; + } + {{/vendorExtensions.x-is-jackson-optional-nullable}}{{#vendorExtensions.x-is-jackson-optional-nullable}} + @JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}}) + {{#isReadOnly}}private{{/isReadOnly}}{{^isReadOnly}}public{{/isReadOnly}} void {{setter}}_JsonNullable(JsonNullable<{{{datatypeWithEnum}}}> {{name}}) { + {{! For getters/setters that have name differing from attribute name, we must include setter (albeit private) for jackson to be able to set the attribute}} + this.{{name}} = {{name}}; + } + {{/vendorExtensions.x-is-jackson-optional-nullable}} + + {{^isReadOnly}} +{{#vendorExtensions.x-setter-extra-annotation}} {{{vendorExtensions.x-setter-extra-annotation}}} +{{/vendorExtensions.x-setter-extra-annotation}}{{#jackson}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{> jackson_annotations}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{/jackson}} public void {{setter}}({{{datatypeWithEnum}}} {{name}}) { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{name}}); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + this.{{name}} = {{name}}; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + } + {{/isReadOnly}} + + {{/vars}} + + /** + * Return true if this {{name}} object is equal to o. + */ + @Override + public boolean equals(Object o) { + {{#useReflectionEqualsHashCode}} + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + {{/useReflectionEqualsHashCode}} + {{^useReflectionEqualsHashCode}} + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + }{{#hasVars}} + {{classname}} {{classVarName}} = ({{classname}}) o; + return {{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}equalsNullable(this.{{name}}, {{classVarName}}.{{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{#isByteArray}}Arrays{{/isByteArray}}{{^isByteArray}}Objects{{/isByteArray}}.equals(this.{{name}}, {{classVarName}}.{{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}} && + {{/-last}}{{/vars}}{{#parent}} && + super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}} + return {{#parent}}super.equals(o){{/parent}}{{^parent}}true{{/parent}};{{/hasVars}} + {{/useReflectionEqualsHashCode}} + }{{#vendorExtensions.x-jackson-optional-nullable-helpers}} + + 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())); + }{{/vendorExtensions.x-jackson-optional-nullable-helpers}} + + @Override + public int hashCode() { + {{#useReflectionEqualsHashCode}} + return HashCodeBuilder.reflectionHashCode(this); + {{/useReflectionEqualsHashCode}} + {{^useReflectionEqualsHashCode}} + return Objects.hash({{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}hashCodeNullable({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}); + {{/useReflectionEqualsHashCode}} + }{{#vendorExtensions.x-jackson-optional-nullable-helpers}} + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + }{{/vendorExtensions.x-jackson-optional-nullable-helpers}} + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class {{classname}} {\n"); + {{#parent}} + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + {{/parent}} + {{#vars}} + sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n"); + {{/vars}} + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private{{#jsonb}} static{{/jsonb}} String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +{{#parcelableModel}} + + public void writeToParcel(Parcel out, int flags) { +{{#model}} +{{#isArray}} + out.writeList(this); +{{/isArray}} +{{^isArray}} +{{#parent}} + super.writeToParcel(out, flags); +{{/parent}} +{{#vars}} + out.writeValue({{name}}); +{{/vars}} +{{/isArray}} +{{/model}} + } + + {{classname}}(Parcel in) { +{{#isArray}} + in.readTypedList(this, {{arrayModelType}}.CREATOR); +{{/isArray}} +{{^isArray}} +{{#parent}} + super(in); +{{/parent}} +{{#vars}} +{{#isPrimitiveType}} + {{name}} = ({{{datatypeWithEnum}}})in.readValue(null); +{{/isPrimitiveType}} +{{^isPrimitiveType}} + {{name}} = ({{{datatypeWithEnum}}})in.readValue({{complexType}}.class.getClassLoader()); +{{/isPrimitiveType}} +{{/vars}} +{{/isArray}} + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator<{{classname}}> CREATOR = new Parcelable.Creator<{{classname}}>() { + public {{classname}} createFromParcel(Parcel in) { +{{#model}} +{{#isArray}} + {{classname}} result = new {{classname}}(); + result.addAll(in.readArrayList({{arrayModelType}}.class.getClassLoader())); + return result; +{{/isArray}} +{{^isArray}} + return new {{classname}}(in); +{{/isArray}} +{{/model}} + } + public {{classname}}[] newArray(int size) { + return new {{classname}}[size]; + } + }; +{{/parcelableModel}} +} From 19313e5694b16b22c968200f05dd067dac508254 Mon Sep 17 00:00:00 2001 From: Ilya Taratukhin Date: Tue, 2 Jan 2024 17:42:33 +0100 Subject: [PATCH 3/7] chore: use correct backtick symbol in the model description --- src/main/java/com/fingerprint/model/ProductsResponse.java | 2 +- src/main/java/com/fingerprint/model/Response.java | 2 +- template/pojo.mustache | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/fingerprint/model/ProductsResponse.java b/src/main/java/com/fingerprint/model/ProductsResponse.java index bb5dc3f..b77226e 100644 --- a/src/main/java/com/fingerprint/model/ProductsResponse.java +++ b/src/main/java/com/fingerprint/model/ProductsResponse.java @@ -49,7 +49,7 @@ /** - * Contains all information about the request identified by `requestId`, depending on the pricing plan (Pro, Pro Plus, Enterprise) + * Contains all information about the request identified by `requestId`, depending on the pricing plan (Pro, Pro Plus, Enterprise) */ @ApiModel(description = "Contains all information about the request identified by `requestId`, depending on the pricing plan (Pro, Pro Plus, Enterprise)") @JsonPropertyOrder({ diff --git a/src/main/java/com/fingerprint/model/Response.java b/src/main/java/com/fingerprint/model/Response.java index c829364..0d50af5 100644 --- a/src/main/java/com/fingerprint/model/Response.java +++ b/src/main/java/com/fingerprint/model/Response.java @@ -32,7 +32,7 @@ /** - * Fields `lastTimestamp` and `paginationKey` added when `limit` or `before` parameter provided and there is more data to show + * Fields `lastTimestamp` and `paginationKey` added when `limit` or `before` parameter provided and there is more data to show */ @ApiModel(description = "Fields `lastTimestamp` and `paginationKey` added when `limit` or `before` parameter provided and there is more data to show") @JsonPropertyOrder({ diff --git a/template/pojo.mustache b/template/pojo.mustache index 2ea5d15..084f853 100644 --- a/template/pojo.mustache +++ b/template/pojo.mustache @@ -1,5 +1,5 @@ /** - * {{description}}{{^description}}{{classname}}{{/description}}{{#isDeprecated}} + * {{{description}}}{{^description}}{{classname}}{{/description}}{{#isDeprecated}} * @deprecated{{/isDeprecated}} */{{#isDeprecated}} @Deprecated{{/isDeprecated}}{{#description}} From 51bcc21388320a5af91dcfb0fff39db587bd21fc Mon Sep 17 00:00:00 2001 From: Ilya Taratukhin Date: Tue, 2 Jan 2024 17:52:41 +0100 Subject: [PATCH 4/7] feat: mark `IPLocation` as deprecated --- README.md | 1 + docs/DataCenter.md | 1 + docs/DataCenterInfo.md | 14 ++ docs/IPLocation.md | 1 + docs/IpInfoResultV4.md | 2 +- docs/IpInfoResultV6.md | 2 +- res/fingerprint-server-api.yaml | 26 +++- .../com/fingerprint/model/DataCenter.java | 5 +- .../com/fingerprint/model/DataCenterInfo.java | 144 ++++++++++++++++++ .../com/fingerprint/model/IPLocation.java | 5 +- .../com/fingerprint/model/IpInfoResultV4.java | 13 +- .../com/fingerprint/model/IpInfoResultV6.java | 13 +- .../ProductsResponseIdentificationData.java | 2 + .../com/fingerprint/model/ResponseVisits.java | 2 + .../java/com/fingerprint/model/Visit.java | 2 + .../com/fingerprint/model/WebhookVisit.java | 2 + 16 files changed, 219 insertions(+), 16 deletions(-) create mode 100644 docs/DataCenterInfo.md create mode 100644 src/main/java/com/fingerprint/model/DataCenterInfo.java diff --git a/README.md b/README.md index 5f6caee..f530929 100644 --- a/README.md +++ b/README.md @@ -222,6 +222,7 @@ Class | Method | HTTP request | Description - [BrowserDetails](docs/BrowserDetails.md) - [Confidence](docs/Confidence.md) - [DataCenter](docs/DataCenter.md) + - [DataCenterInfo](docs/DataCenterInfo.md) - [Error](docs/Error.md) - [ErrorEvent403Response](docs/ErrorEvent403Response.md) - [ErrorEvent403ResponseError](docs/ErrorEvent403ResponseError.md) diff --git a/docs/DataCenter.md b/docs/DataCenter.md index de111a5..167ba11 100644 --- a/docs/DataCenter.md +++ b/docs/DataCenter.md @@ -2,6 +2,7 @@ # DataCenter +`dataCenter` is deprecated in favor of `datacenter` ## Properties diff --git a/docs/DataCenterInfo.md b/docs/DataCenterInfo.md new file mode 100644 index 0000000..94ddab3 --- /dev/null +++ b/docs/DataCenterInfo.md @@ -0,0 +1,14 @@ + + +# DataCenterInfo + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**result** | **Boolean** | | | +|**name** | **String** | | [optional] | + + + diff --git a/docs/IPLocation.md b/docs/IPLocation.md index e1186a7..6c290d5 100644 --- a/docs/IPLocation.md +++ b/docs/IPLocation.md @@ -2,6 +2,7 @@ # IPLocation +This field is **deprecated** and will not return a result for **accounts created after December 18th, 2023**. Please use the [`ipInfo` Smart signal](https://dev.fingerprint.com/docs/smart-signals-overview#ip-geolocation) for geolocation information. ## Properties diff --git a/docs/IpInfoResultV4.md b/docs/IpInfoResultV4.md index d5cc0f0..9db1d13 100644 --- a/docs/IpInfoResultV4.md +++ b/docs/IpInfoResultV4.md @@ -10,7 +10,7 @@ |**address** | **String** | | [optional] | |**geolocation** | [**IPLocation**](IPLocation.md) | | [optional] | |**asn** | [**ASN**](ASN.md) | | [optional] | -|**datacenter** | [**DataCenter**](DataCenter.md) | | [optional] | +|**datacenter** | [**DataCenterInfo**](DataCenterInfo.md) | | [optional] | |**dataCenter** | [**DataCenter**](DataCenter.md) | | [optional] | diff --git a/docs/IpInfoResultV6.md b/docs/IpInfoResultV6.md index ad240e2..8b1085a 100644 --- a/docs/IpInfoResultV6.md +++ b/docs/IpInfoResultV6.md @@ -10,7 +10,7 @@ |**address** | **String** | | [optional] | |**geolocation** | [**IPLocation**](IPLocation.md) | | [optional] | |**asn** | [**ASN**](ASN.md) | | [optional] | -|**datacenter** | [**DataCenter**](DataCenter.md) | | [optional] | +|**datacenter** | [**DataCenterInfo**](DataCenterInfo.md) | | [optional] | |**dataCenter** | [**DataCenter**](DataCenter.md) | | [optional] | diff --git a/res/fingerprint-server-api.yaml b/res/fingerprint-server-api.yaml index 8de4b19..4329383 100644 --- a/res/fingerprint-server-api.yaml +++ b/res/fingerprint-server-api.yaml @@ -4320,8 +4320,22 @@ components: - asn - network title: ASN + DataCenterInfo: + type: object + additionalProperties: false + properties: + result: + type: boolean + name: + type: string + example: DediPath + required: + - result + title: DataCenterInfo DataCenter: type: object + deprecated: true + description: '`dataCenter` is deprecated in favor of `datacenter`' additionalProperties: false properties: result: @@ -4335,6 +4349,12 @@ components: IPLocation: type: object additionalProperties: false + deprecated: true + description: >- + This field is **deprecated** and will not return a result for **accounts + created after December 18th, 2023**. Please use the [`ipInfo` Smart + signal](https://dev.fingerprint.com/docs/smart-signals-overview#ip-geolocation) + for geolocation information. properties: accuracyRadius: description: >- @@ -4858,8 +4878,7 @@ components: asn: $ref: '#/components/schemas/ASN' datacenter: - $ref: '#/components/schemas/DataCenter' - # `dataCenter` is deprecated in favor of `datacenter` + $ref: '#/components/schemas/DataCenterInfo' dataCenter: $ref: '#/components/schemas/DataCenter' v6: @@ -4875,8 +4894,7 @@ components: asn: $ref: '#/components/schemas/ASN' datacenter: - $ref: '#/components/schemas/DataCenter' - # `dataCenter` is deprecated in favor of `datacenter` + $ref: '#/components/schemas/DataCenterInfo' dataCenter: $ref: '#/components/schemas/DataCenter' IpBlockListResult: diff --git a/src/main/java/com/fingerprint/model/DataCenter.java b/src/main/java/com/fingerprint/model/DataCenter.java index f8004c9..f8fda31 100644 --- a/src/main/java/com/fingerprint/model/DataCenter.java +++ b/src/main/java/com/fingerprint/model/DataCenter.java @@ -29,8 +29,11 @@ /** - * DataCenter + * `dataCenter` is deprecated in favor of `datacenter` + * @deprecated */ +@Deprecated +@ApiModel(description = "`dataCenter` is deprecated in favor of `datacenter`") @JsonPropertyOrder({ DataCenter.JSON_PROPERTY_RESULT, DataCenter.JSON_PROPERTY_NAME diff --git a/src/main/java/com/fingerprint/model/DataCenterInfo.java b/src/main/java/com/fingerprint/model/DataCenterInfo.java new file mode 100644 index 0000000..29409e3 --- /dev/null +++ b/src/main/java/com/fingerprint/model/DataCenterInfo.java @@ -0,0 +1,144 @@ +/* + * Fingerprint Pro Server API + * Fingerprint Pro Server API allows you to get information about visitors and about individual events in a server environment. It can be used for data exports, decision-making, and data analysis scenarios. Server API is intended for server-side usage, it's not intended to be used from the client side, whether it's a browser or a mobile device. + * + * The version of the OpenAPI document: 3 + * Contact: support@fingerprint.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.fingerprint.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fingerprint.sdk.JSON; + + +/** + * DataCenterInfo + */ +@JsonPropertyOrder({ + DataCenterInfo.JSON_PROPERTY_RESULT, + DataCenterInfo.JSON_PROPERTY_NAME +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DataCenterInfo { + public static final String JSON_PROPERTY_RESULT = "result"; + private Boolean result; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public DataCenterInfo() { + } + + public DataCenterInfo result(Boolean result) { + this.result = result; + return this; + } + + /** + * Get result + * @return result + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_RESULT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Boolean getResult() { + return result; + } + + + @JsonProperty(JSON_PROPERTY_RESULT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setResult(Boolean result) { + this.result = result; + } + + + public DataCenterInfo name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "DediPath", value = "") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getName() { + return name; + } + + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setName(String name) { + this.name = name; + } + + + /** + * Return true if this DataCenterInfo object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DataCenterInfo dataCenterInfo = (DataCenterInfo) o; + return Objects.equals(this.result, dataCenterInfo.result) && + Objects.equals(this.name, dataCenterInfo.name); + } + + @Override + public int hashCode() { + return Objects.hash(result, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DataCenterInfo {\n"); + sb.append(" result: ").append(toIndentedString(result)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/src/main/java/com/fingerprint/model/IPLocation.java b/src/main/java/com/fingerprint/model/IPLocation.java index 701659e..24c5299 100644 --- a/src/main/java/com/fingerprint/model/IPLocation.java +++ b/src/main/java/com/fingerprint/model/IPLocation.java @@ -34,8 +34,11 @@ /** - * IPLocation + * This field is **deprecated** and will not return a result for **accounts created after December 18th, 2023**. Please use the [`ipInfo` Smart signal](https://dev.fingerprint.com/docs/smart-signals-overview#ip-geolocation) for geolocation information. + * @deprecated */ +@Deprecated +@ApiModel(description = "This field is **deprecated** and will not return a result for **accounts created after December 18th, 2023**. Please use the [`ipInfo` Smart signal](https://dev.fingerprint.com/docs/smart-signals-overview#ip-geolocation) for geolocation information.") @JsonPropertyOrder({ IPLocation.JSON_PROPERTY_ACCURACY_RADIUS, IPLocation.JSON_PROPERTY_LATITUDE, diff --git a/src/main/java/com/fingerprint/model/IpInfoResultV4.java b/src/main/java/com/fingerprint/model/IpInfoResultV4.java index 3b1ecd8..7107b1b 100644 --- a/src/main/java/com/fingerprint/model/IpInfoResultV4.java +++ b/src/main/java/com/fingerprint/model/IpInfoResultV4.java @@ -24,6 +24,7 @@ import com.fasterxml.jackson.annotation.JsonValue; import com.fingerprint.model.ASN; import com.fingerprint.model.DataCenter; +import com.fingerprint.model.DataCenterInfo; import com.fingerprint.model.IPLocation; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -54,7 +55,7 @@ public class IpInfoResultV4 { private ASN asn; public static final String JSON_PROPERTY_DATACENTER = "datacenter"; - private DataCenter datacenter; + private DataCenterInfo datacenter; public static final String JSON_PROPERTY_DATA_CENTER = "dataCenter"; private DataCenter dataCenter; @@ -96,7 +97,9 @@ public IpInfoResultV4 geolocation(IPLocation geolocation) { /** * Get geolocation * @return geolocation + * @deprecated **/ + @Deprecated @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_GEOLOCATION) @@ -140,7 +143,7 @@ public void setAsn(ASN asn) { } - public IpInfoResultV4 datacenter(DataCenter datacenter) { + public IpInfoResultV4 datacenter(DataCenterInfo datacenter) { this.datacenter = datacenter; return this; } @@ -154,14 +157,14 @@ public IpInfoResultV4 datacenter(DataCenter datacenter) { @JsonProperty(JSON_PROPERTY_DATACENTER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public DataCenter getDatacenter() { + public DataCenterInfo getDatacenter() { return datacenter; } @JsonProperty(JSON_PROPERTY_DATACENTER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDatacenter(DataCenter datacenter) { + public void setDatacenter(DataCenterInfo datacenter) { this.datacenter = datacenter; } @@ -174,7 +177,9 @@ public IpInfoResultV4 dataCenter(DataCenter dataCenter) { /** * Get dataCenter * @return dataCenter + * @deprecated **/ + @Deprecated @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_DATA_CENTER) diff --git a/src/main/java/com/fingerprint/model/IpInfoResultV6.java b/src/main/java/com/fingerprint/model/IpInfoResultV6.java index 5189125..fb06250 100644 --- a/src/main/java/com/fingerprint/model/IpInfoResultV6.java +++ b/src/main/java/com/fingerprint/model/IpInfoResultV6.java @@ -24,6 +24,7 @@ import com.fasterxml.jackson.annotation.JsonValue; import com.fingerprint.model.ASN; import com.fingerprint.model.DataCenter; +import com.fingerprint.model.DataCenterInfo; import com.fingerprint.model.IPLocation; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -54,7 +55,7 @@ public class IpInfoResultV6 { private ASN asn; public static final String JSON_PROPERTY_DATACENTER = "datacenter"; - private DataCenter datacenter; + private DataCenterInfo datacenter; public static final String JSON_PROPERTY_DATA_CENTER = "dataCenter"; private DataCenter dataCenter; @@ -96,7 +97,9 @@ public IpInfoResultV6 geolocation(IPLocation geolocation) { /** * Get geolocation * @return geolocation + * @deprecated **/ + @Deprecated @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_GEOLOCATION) @@ -140,7 +143,7 @@ public void setAsn(ASN asn) { } - public IpInfoResultV6 datacenter(DataCenter datacenter) { + public IpInfoResultV6 datacenter(DataCenterInfo datacenter) { this.datacenter = datacenter; return this; } @@ -154,14 +157,14 @@ public IpInfoResultV6 datacenter(DataCenter datacenter) { @JsonProperty(JSON_PROPERTY_DATACENTER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public DataCenter getDatacenter() { + public DataCenterInfo getDatacenter() { return datacenter; } @JsonProperty(JSON_PROPERTY_DATACENTER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDatacenter(DataCenter datacenter) { + public void setDatacenter(DataCenterInfo datacenter) { this.datacenter = datacenter; } @@ -174,7 +177,9 @@ public IpInfoResultV6 dataCenter(DataCenter dataCenter) { /** * Get dataCenter * @return dataCenter + * @deprecated **/ + @Deprecated @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_DATA_CENTER) diff --git a/src/main/java/com/fingerprint/model/ProductsResponseIdentificationData.java b/src/main/java/com/fingerprint/model/ProductsResponseIdentificationData.java index b34ce49..cb4a6c2 100644 --- a/src/main/java/com/fingerprint/model/ProductsResponseIdentificationData.java +++ b/src/main/java/com/fingerprint/model/ProductsResponseIdentificationData.java @@ -218,7 +218,9 @@ public ProductsResponseIdentificationData ipLocation(IPLocation ipLocation) { /** * Get ipLocation * @return ipLocation + * @deprecated **/ + @Deprecated @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_IP_LOCATION) diff --git a/src/main/java/com/fingerprint/model/ResponseVisits.java b/src/main/java/com/fingerprint/model/ResponseVisits.java index bdcebf1..afe827d 100644 --- a/src/main/java/com/fingerprint/model/ResponseVisits.java +++ b/src/main/java/com/fingerprint/model/ResponseVisits.java @@ -214,7 +214,9 @@ public ResponseVisits ipLocation(IPLocation ipLocation) { /** * Get ipLocation * @return ipLocation + * @deprecated **/ + @Deprecated @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_IP_LOCATION) diff --git a/src/main/java/com/fingerprint/model/Visit.java b/src/main/java/com/fingerprint/model/Visit.java index 8548183..aa90668 100644 --- a/src/main/java/com/fingerprint/model/Visit.java +++ b/src/main/java/com/fingerprint/model/Visit.java @@ -214,7 +214,9 @@ public Visit ipLocation(IPLocation ipLocation) { /** * Get ipLocation * @return ipLocation + * @deprecated **/ + @Deprecated @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_IP_LOCATION) diff --git a/src/main/java/com/fingerprint/model/WebhookVisit.java b/src/main/java/com/fingerprint/model/WebhookVisit.java index 85406cc..fb1d30b 100644 --- a/src/main/java/com/fingerprint/model/WebhookVisit.java +++ b/src/main/java/com/fingerprint/model/WebhookVisit.java @@ -870,7 +870,9 @@ public WebhookVisit ipLocation(IPLocation ipLocation) { /** * Get ipLocation * @return ipLocation + * @deprecated **/ + @Deprecated @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_IP_LOCATION) From 0ac17da919fb6b2f0a92f1bb34712db2ccbc229b Mon Sep 17 00:00:00 2001 From: Ilya Taratukhin Date: Wed, 10 Jan 2024 12:55:38 +0100 Subject: [PATCH 5/7] chore: clean docs and models bofore generating --- scripts/generate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/generate.sh b/scripts/generate.sh index 9a345ea..bd9a238 100755 --- a/scripts/generate.sh +++ b/scripts/generate.sh @@ -24,7 +24,7 @@ echo "VERSION: $VERSION" sed -i "s/artifactVersion: .*/artifactVersion: $VERSION/g" config.yaml sed -i "s/^VERSION=.*/VERSION='$VERSION'/g" ./scripts/generate.sh -rm -rf pom.xml README.md build.gradle settings.gradle gradle.properties +rm -f pom.xml README.md build.gradle settings.gradle gradle.properties ./docs/* ./src/main/java/com/fingerprint/model/* java -jar ./bin/generator.jar generate -c config.yaml -g java --library jersey2 -i res/fingerprint-server-api.yaml --skip-validate-spec -o . -t template From 33f733677cabe7b2ec94a6aad5f5b786070576f9 Mon Sep 17 00:00:00 2001 From: Ilya Taratukhin Date: Wed, 10 Jan 2024 13:04:07 +0100 Subject: [PATCH 6/7] feat: use `datacenter` instead of the wrong `dataCenter` BREAKING CHANGE: `IpInfo` field `dataCenter` renamed to `datacenter` --- README.md | 1 - docs/DataCenter.md | 1 - docs/DataCenterInfo.md | 14 -- docs/IpInfoResultV4.md | 3 +- docs/IpInfoResultV6.md | 3 +- res/fingerprint-server-api.yaml | 18 --- .../com/fingerprint/model/DataCenter.java | 5 +- .../com/fingerprint/model/DataCenterInfo.java | 144 ------------------ .../com/fingerprint/model/IpInfoResultV4.java | 49 +----- .../com/fingerprint/model/IpInfoResultV6.java | 49 +----- 10 files changed, 17 insertions(+), 270 deletions(-) delete mode 100644 docs/DataCenterInfo.md delete mode 100644 src/main/java/com/fingerprint/model/DataCenterInfo.java diff --git a/README.md b/README.md index f530929..5f6caee 100644 --- a/README.md +++ b/README.md @@ -222,7 +222,6 @@ Class | Method | HTTP request | Description - [BrowserDetails](docs/BrowserDetails.md) - [Confidence](docs/Confidence.md) - [DataCenter](docs/DataCenter.md) - - [DataCenterInfo](docs/DataCenterInfo.md) - [Error](docs/Error.md) - [ErrorEvent403Response](docs/ErrorEvent403Response.md) - [ErrorEvent403ResponseError](docs/ErrorEvent403ResponseError.md) diff --git a/docs/DataCenter.md b/docs/DataCenter.md index 167ba11..de111a5 100644 --- a/docs/DataCenter.md +++ b/docs/DataCenter.md @@ -2,7 +2,6 @@ # DataCenter -`dataCenter` is deprecated in favor of `datacenter` ## Properties diff --git a/docs/DataCenterInfo.md b/docs/DataCenterInfo.md deleted file mode 100644 index 94ddab3..0000000 --- a/docs/DataCenterInfo.md +++ /dev/null @@ -1,14 +0,0 @@ - - -# DataCenterInfo - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**result** | **Boolean** | | | -|**name** | **String** | | [optional] | - - - diff --git a/docs/IpInfoResultV4.md b/docs/IpInfoResultV4.md index 9db1d13..cc609eb 100644 --- a/docs/IpInfoResultV4.md +++ b/docs/IpInfoResultV4.md @@ -10,8 +10,7 @@ |**address** | **String** | | [optional] | |**geolocation** | [**IPLocation**](IPLocation.md) | | [optional] | |**asn** | [**ASN**](ASN.md) | | [optional] | -|**datacenter** | [**DataCenterInfo**](DataCenterInfo.md) | | [optional] | -|**dataCenter** | [**DataCenter**](DataCenter.md) | | [optional] | +|**datacenter** | [**DataCenter**](DataCenter.md) | | [optional] | diff --git a/docs/IpInfoResultV6.md b/docs/IpInfoResultV6.md index 8b1085a..2749745 100644 --- a/docs/IpInfoResultV6.md +++ b/docs/IpInfoResultV6.md @@ -10,8 +10,7 @@ |**address** | **String** | | [optional] | |**geolocation** | [**IPLocation**](IPLocation.md) | | [optional] | |**asn** | [**ASN**](ASN.md) | | [optional] | -|**datacenter** | [**DataCenterInfo**](DataCenterInfo.md) | | [optional] | -|**dataCenter** | [**DataCenter**](DataCenter.md) | | [optional] | +|**datacenter** | [**DataCenter**](DataCenter.md) | | [optional] | diff --git a/res/fingerprint-server-api.yaml b/res/fingerprint-server-api.yaml index 4329383..da9215c 100644 --- a/res/fingerprint-server-api.yaml +++ b/res/fingerprint-server-api.yaml @@ -4320,22 +4320,8 @@ components: - asn - network title: ASN - DataCenterInfo: - type: object - additionalProperties: false - properties: - result: - type: boolean - name: - type: string - example: DediPath - required: - - result - title: DataCenterInfo DataCenter: type: object - deprecated: true - description: '`dataCenter` is deprecated in favor of `datacenter`' additionalProperties: false properties: result: @@ -4878,8 +4864,6 @@ components: asn: $ref: '#/components/schemas/ASN' datacenter: - $ref: '#/components/schemas/DataCenterInfo' - dataCenter: $ref: '#/components/schemas/DataCenter' v6: type: object @@ -4894,8 +4878,6 @@ components: asn: $ref: '#/components/schemas/ASN' datacenter: - $ref: '#/components/schemas/DataCenterInfo' - dataCenter: $ref: '#/components/schemas/DataCenter' IpBlockListResult: type: object diff --git a/src/main/java/com/fingerprint/model/DataCenter.java b/src/main/java/com/fingerprint/model/DataCenter.java index f8fda31..f8004c9 100644 --- a/src/main/java/com/fingerprint/model/DataCenter.java +++ b/src/main/java/com/fingerprint/model/DataCenter.java @@ -29,11 +29,8 @@ /** - * `dataCenter` is deprecated in favor of `datacenter` - * @deprecated + * DataCenter */ -@Deprecated -@ApiModel(description = "`dataCenter` is deprecated in favor of `datacenter`") @JsonPropertyOrder({ DataCenter.JSON_PROPERTY_RESULT, DataCenter.JSON_PROPERTY_NAME diff --git a/src/main/java/com/fingerprint/model/DataCenterInfo.java b/src/main/java/com/fingerprint/model/DataCenterInfo.java deleted file mode 100644 index 29409e3..0000000 --- a/src/main/java/com/fingerprint/model/DataCenterInfo.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Fingerprint Pro Server API - * Fingerprint Pro Server API allows you to get information about visitors and about individual events in a server environment. It can be used for data exports, decision-making, and data analysis scenarios. Server API is intended for server-side usage, it's not intended to be used from the client side, whether it's a browser or a mobile device. - * - * The version of the OpenAPI document: 3 - * Contact: support@fingerprint.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.fingerprint.model; - -import java.util.Objects; -import java.util.Arrays; -import java.util.Map; -import java.util.HashMap; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fingerprint.sdk.JSON; - - -/** - * DataCenterInfo - */ -@JsonPropertyOrder({ - DataCenterInfo.JSON_PROPERTY_RESULT, - DataCenterInfo.JSON_PROPERTY_NAME -}) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class DataCenterInfo { - public static final String JSON_PROPERTY_RESULT = "result"; - private Boolean result; - - public static final String JSON_PROPERTY_NAME = "name"; - private String name; - - public DataCenterInfo() { - } - - public DataCenterInfo result(Boolean result) { - this.result = result; - return this; - } - - /** - * Get result - * @return result - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - @JsonProperty(JSON_PROPERTY_RESULT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - - public Boolean getResult() { - return result; - } - - - @JsonProperty(JSON_PROPERTY_RESULT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setResult(Boolean result) { - this.result = result; - } - - - public DataCenterInfo name(String name) { - this.name = name; - return this; - } - - /** - * Get name - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "DediPath", value = "") - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public String getName() { - return name; - } - - - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setName(String name) { - this.name = name; - } - - - /** - * Return true if this DataCenterInfo object is equal to o. - */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DataCenterInfo dataCenterInfo = (DataCenterInfo) o; - return Objects.equals(this.result, dataCenterInfo.result) && - Objects.equals(this.name, dataCenterInfo.name); - } - - @Override - public int hashCode() { - return Objects.hash(result, name); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DataCenterInfo {\n"); - sb.append(" result: ").append(toIndentedString(result)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} - diff --git a/src/main/java/com/fingerprint/model/IpInfoResultV4.java b/src/main/java/com/fingerprint/model/IpInfoResultV4.java index 7107b1b..9c6fe2c 100644 --- a/src/main/java/com/fingerprint/model/IpInfoResultV4.java +++ b/src/main/java/com/fingerprint/model/IpInfoResultV4.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import com.fingerprint.model.ASN; import com.fingerprint.model.DataCenter; -import com.fingerprint.model.DataCenterInfo; import com.fingerprint.model.IPLocation; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -39,8 +38,7 @@ IpInfoResultV4.JSON_PROPERTY_ADDRESS, IpInfoResultV4.JSON_PROPERTY_GEOLOCATION, IpInfoResultV4.JSON_PROPERTY_ASN, - IpInfoResultV4.JSON_PROPERTY_DATACENTER, - IpInfoResultV4.JSON_PROPERTY_DATA_CENTER + IpInfoResultV4.JSON_PROPERTY_DATACENTER }) @JsonTypeName("IpInfoResult_v4") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") @@ -55,10 +53,7 @@ public class IpInfoResultV4 { private ASN asn; public static final String JSON_PROPERTY_DATACENTER = "datacenter"; - private DataCenterInfo datacenter; - - public static final String JSON_PROPERTY_DATA_CENTER = "dataCenter"; - private DataCenter dataCenter; + private DataCenter datacenter; public IpInfoResultV4() { } @@ -143,7 +138,7 @@ public void setAsn(ASN asn) { } - public IpInfoResultV4 datacenter(DataCenterInfo datacenter) { + public IpInfoResultV4 datacenter(DataCenter datacenter) { this.datacenter = datacenter; return this; } @@ -157,46 +152,18 @@ public IpInfoResultV4 datacenter(DataCenterInfo datacenter) { @JsonProperty(JSON_PROPERTY_DATACENTER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public DataCenterInfo getDatacenter() { + public DataCenter getDatacenter() { return datacenter; } @JsonProperty(JSON_PROPERTY_DATACENTER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDatacenter(DataCenterInfo datacenter) { + public void setDatacenter(DataCenter datacenter) { this.datacenter = datacenter; } - public IpInfoResultV4 dataCenter(DataCenter dataCenter) { - this.dataCenter = dataCenter; - return this; - } - - /** - * Get dataCenter - * @return dataCenter - * @deprecated - **/ - @Deprecated - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_DATA_CENTER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public DataCenter getDataCenter() { - return dataCenter; - } - - - @JsonProperty(JSON_PROPERTY_DATA_CENTER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDataCenter(DataCenter dataCenter) { - this.dataCenter = dataCenter; - } - - /** * Return true if this IpInfoResult_v4 object is equal to o. */ @@ -212,13 +179,12 @@ public boolean equals(Object o) { return Objects.equals(this.address, ipInfoResultV4.address) && Objects.equals(this.geolocation, ipInfoResultV4.geolocation) && Objects.equals(this.asn, ipInfoResultV4.asn) && - Objects.equals(this.datacenter, ipInfoResultV4.datacenter) && - Objects.equals(this.dataCenter, ipInfoResultV4.dataCenter); + Objects.equals(this.datacenter, ipInfoResultV4.datacenter); } @Override public int hashCode() { - return Objects.hash(address, geolocation, asn, datacenter, dataCenter); + return Objects.hash(address, geolocation, asn, datacenter); } @Override @@ -229,7 +195,6 @@ public String toString() { sb.append(" geolocation: ").append(toIndentedString(geolocation)).append("\n"); sb.append(" asn: ").append(toIndentedString(asn)).append("\n"); sb.append(" datacenter: ").append(toIndentedString(datacenter)).append("\n"); - sb.append(" dataCenter: ").append(toIndentedString(dataCenter)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/src/main/java/com/fingerprint/model/IpInfoResultV6.java b/src/main/java/com/fingerprint/model/IpInfoResultV6.java index fb06250..adb862c 100644 --- a/src/main/java/com/fingerprint/model/IpInfoResultV6.java +++ b/src/main/java/com/fingerprint/model/IpInfoResultV6.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import com.fingerprint.model.ASN; import com.fingerprint.model.DataCenter; -import com.fingerprint.model.DataCenterInfo; import com.fingerprint.model.IPLocation; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -39,8 +38,7 @@ IpInfoResultV6.JSON_PROPERTY_ADDRESS, IpInfoResultV6.JSON_PROPERTY_GEOLOCATION, IpInfoResultV6.JSON_PROPERTY_ASN, - IpInfoResultV6.JSON_PROPERTY_DATACENTER, - IpInfoResultV6.JSON_PROPERTY_DATA_CENTER + IpInfoResultV6.JSON_PROPERTY_DATACENTER }) @JsonTypeName("IpInfoResult_v6") @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") @@ -55,10 +53,7 @@ public class IpInfoResultV6 { private ASN asn; public static final String JSON_PROPERTY_DATACENTER = "datacenter"; - private DataCenterInfo datacenter; - - public static final String JSON_PROPERTY_DATA_CENTER = "dataCenter"; - private DataCenter dataCenter; + private DataCenter datacenter; public IpInfoResultV6() { } @@ -143,7 +138,7 @@ public void setAsn(ASN asn) { } - public IpInfoResultV6 datacenter(DataCenterInfo datacenter) { + public IpInfoResultV6 datacenter(DataCenter datacenter) { this.datacenter = datacenter; return this; } @@ -157,46 +152,18 @@ public IpInfoResultV6 datacenter(DataCenterInfo datacenter) { @JsonProperty(JSON_PROPERTY_DATACENTER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public DataCenterInfo getDatacenter() { + public DataCenter getDatacenter() { return datacenter; } @JsonProperty(JSON_PROPERTY_DATACENTER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDatacenter(DataCenterInfo datacenter) { + public void setDatacenter(DataCenter datacenter) { this.datacenter = datacenter; } - public IpInfoResultV6 dataCenter(DataCenter dataCenter) { - this.dataCenter = dataCenter; - return this; - } - - /** - * Get dataCenter - * @return dataCenter - * @deprecated - **/ - @Deprecated - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_DATA_CENTER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public DataCenter getDataCenter() { - return dataCenter; - } - - - @JsonProperty(JSON_PROPERTY_DATA_CENTER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setDataCenter(DataCenter dataCenter) { - this.dataCenter = dataCenter; - } - - /** * Return true if this IpInfoResult_v6 object is equal to o. */ @@ -212,13 +179,12 @@ public boolean equals(Object o) { return Objects.equals(this.address, ipInfoResultV6.address) && Objects.equals(this.geolocation, ipInfoResultV6.geolocation) && Objects.equals(this.asn, ipInfoResultV6.asn) && - Objects.equals(this.datacenter, ipInfoResultV6.datacenter) && - Objects.equals(this.dataCenter, ipInfoResultV6.dataCenter); + Objects.equals(this.datacenter, ipInfoResultV6.datacenter); } @Override public int hashCode() { - return Objects.hash(address, geolocation, asn, datacenter, dataCenter); + return Objects.hash(address, geolocation, asn, datacenter); } @Override @@ -229,7 +195,6 @@ public String toString() { sb.append(" geolocation: ").append(toIndentedString(geolocation)).append("\n"); sb.append(" asn: ").append(toIndentedString(asn)).append("\n"); sb.append(" datacenter: ").append(toIndentedString(datacenter)).append("\n"); - sb.append(" dataCenter: ").append(toIndentedString(dataCenter)).append("\n"); sb.append("}"); return sb.toString(); } From ede238ff51b8df0d764068e487438056ac9411b6 Mon Sep 17 00:00:00 2001 From: Ilya Taratukhin Date: Fri, 12 Jan 2024 12:59:40 +0100 Subject: [PATCH 7/7] chore: return better SDK description to the README.md --- README.md | 4 +--- template/README.mustache | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 5f6caee..ff24699 100644 --- a/README.md +++ b/README.md @@ -30,9 +30,7 @@ # Fingerprint Pro Server API Java SDK -**Fingerprint Pro Server API allows you to get information about visitors and about individual events in a server environment. -It can be used for data exports, decision-making, and data analysis scenarios. -Server API is intended for server-side usage, it's not intended to be used from the client side, whether it's a browser or a mobile device.** +[Fingerprint](https://fingerprint.com/) is a device intelligence platform offering 99.5% accurate visitor identification. The Fingerprint Server Java SDK is an easy way to interact with the Fingerprint [Server API](https://dev.fingerprint.com/reference/pro-server-api) from your Java application. You can retrieve visitor history or individual identification events. *Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* diff --git a/template/README.mustache b/template/README.mustache index aac4936..fa5807e 100644 --- a/template/README.mustache +++ b/template/README.mustache @@ -30,9 +30,7 @@ # Fingerprint Pro Server API Java SDK -**Fingerprint Pro Server API allows you to get information about visitors and about individual events in a server environment. -It can be used for data exports, decision-making, and data analysis scenarios. -Server API is intended for server-side usage, it's not intended to be used from the client side, whether it's a browser or a mobile device.** +[Fingerprint](https://fingerprint.com/) is a device intelligence platform offering 99.5% accurate visitor identification. The Fingerprint Server Java SDK is an easy way to interact with the Fingerprint [Server API](https://dev.fingerprint.com/reference/pro-server-api) from your Java application. You can retrieve visitor history or individual identification events. *Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*