diff --git a/src/main/java/io/castle/client/model/generated/Address.java b/src/main/java/io/castle/client/model/generated/Address.java old mode 100644 new mode 100755 index 69cbd33..022985e --- a/src/main/java/io/castle/client/model/generated/Address.java +++ b/src/main/java/io/castle/client/model/generated/Address.java @@ -13,54 +13,39 @@ package io.castle.client.model.generated; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import org.openapitools.jackson.nullable.JsonNullable; +import java.util.Objects; /** * Address */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-06-05T10:18:20.077062+02:00[Europe/Stockholm]") -public class Address { - public static final String SERIALIZED_NAME_LINE1 = "line1"; - @SerializedName(SERIALIZED_NAME_LINE1) - private String line1; - public static final String SERIALIZED_NAME_LINE2 = "line2"; - @SerializedName(SERIALIZED_NAME_LINE2) - private String line2; +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2025-01-20T18:58:06.855017776Z[GMT]") + +public class Address { + @SerializedName("line1") + private String line1 = null; - public static final String SERIALIZED_NAME_CITY = "city"; - @SerializedName(SERIALIZED_NAME_CITY) - private String city; + @SerializedName("line2") + private String line2 = null; - public static final String SERIALIZED_NAME_COUNTRY_CODE = "country_code"; - @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) - private String countryCode; + @SerializedName("city") + private String city = null; - public static final String SERIALIZED_NAME_REGION_CODE = "region_code"; - @SerializedName(SERIALIZED_NAME_REGION_CODE) - private String regionCode; + @SerializedName("country_code") + private String countryCode = null; - public static final String SERIALIZED_NAME_POSTAL_CODE = "postal_code"; - @SerializedName(SERIALIZED_NAME_POSTAL_CODE) - private String postalCode; + @SerializedName("region_code") + private String regionCode = null; - public static final String SERIALIZED_NAME_FINGERPRINT = "fingerprint"; - @SerializedName(SERIALIZED_NAME_FINGERPRINT) - private String fingerprint; + @SerializedName("postal_code") + private String postalCode = null; + @SerializedName("fingerprint") + private String fingerprint = null; public Address line1(String line1) { - this.line1 = line1; return this; } @@ -69,21 +54,16 @@ public Address line1(String line1) { * Get line1 * @return line1 **/ - @javax.annotation.Nullable @ApiModelProperty(example = "60 Rausch Street", value = "") - public String getLine1() { return line1; } - public void setLine1(String line1) { this.line1 = line1; } - public Address line2(String line2) { - this.line2 = line2; return this; } @@ -92,21 +72,16 @@ public Address line2(String line2) { * Get line2 * @return line2 **/ - @javax.annotation.Nullable @ApiModelProperty(value = "") - public String getLine2() { return line2; } - public void setLine2(String line2) { this.line2 = line2; } - public Address city(String city) { - this.city = city; return this; } @@ -115,21 +90,16 @@ public Address city(String city) { * Name of the city associated to this address. * @return city **/ - @javax.annotation.Nullable @ApiModelProperty(example = "San Francisco", value = "Name of the city associated to this address.") - public String getCity() { return city; } - public void setCity(String city) { this.city = city; } - public Address countryCode(String countryCode) { - this.countryCode = countryCode; return this; } @@ -138,21 +108,16 @@ public Address countryCode(String countryCode) { * ISO-3166 country code * @return countryCode **/ - @javax.annotation.Nullable @ApiModelProperty(example = "US", required = true, value = "ISO-3166 country code") - public String getCountryCode() { return countryCode; } - public void setCountryCode(String countryCode) { this.countryCode = countryCode; } - public Address regionCode(String regionCode) { - this.regionCode = regionCode; return this; } @@ -161,21 +126,16 @@ public Address regionCode(String regionCode) { * ISO region code * @return regionCode **/ - @javax.annotation.Nullable @ApiModelProperty(example = "CA", value = "ISO region code") - public String getRegionCode() { return regionCode; } - public void setRegionCode(String regionCode) { this.regionCode = regionCode; } - public Address postalCode(String postalCode) { - this.postalCode = postalCode; return this; } @@ -184,21 +144,16 @@ public Address postalCode(String postalCode) { * Get postalCode * @return postalCode **/ - @javax.annotation.Nullable @ApiModelProperty(example = "94103", value = "") - public String getPostalCode() { return postalCode; } - public void setPostalCode(String postalCode) { this.postalCode = postalCode; } - public Address fingerprint(String fingerprint) { - this.fingerprint = fingerprint; return this; } @@ -207,14 +162,11 @@ public Address fingerprint(String fingerprint) { * Get fingerprint * @return fingerprint **/ - @javax.annotation.Nullable @ApiModelProperty(example = "8a33j2lir9", value = "") - public String getFingerprint() { return fingerprint; } - public void setFingerprint(String fingerprint) { this.fingerprint = fingerprint; } @@ -238,23 +190,11 @@ public boolean equals(Object o) { Objects.equals(this.fingerprint, address.fingerprint); } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get())); - } - @Override public int hashCode() { return Objects.hash(line1, line2, city, countryCode, regionCode, postalCode, fingerprint); } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() - ? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get())) - : 31; - } @Override public String toString() { @@ -283,4 +223,3 @@ private String toIndentedString(Object o) { } } - diff --git a/src/main/java/io/castle/client/model/generated/Behavior.java b/src/main/java/io/castle/client/model/generated/Behavior.java new file mode 100755 index 0000000..61c1db3 --- /dev/null +++ b/src/main/java/io/castle/client/model/generated/Behavior.java @@ -0,0 +1,87 @@ +/* + * Castle API + * ## Introduction **Just getting started? Check out our [quick start guide](https://docs.castle.io/docs/quickstart)** Castle APIs uses standard HTTP response codes, authentication and verbs. JSON is used as data exchange format, both for parsing incoming request bodies, and in the returned response. This means that the `Content-Type` header should to be set to `application/json` in requests with a body, such as `POST` or `PUT`. All API requests must be made over [HTTPS](http://en.wikipedia.org/wiki/HTTP_Secure). Non-HTTPS calls will fail and the **TLS version needs to be 1.1 or higher**. ## Supported types For a list of supported types, see our [Types Reference](https://docs.castle.io/docs/events). ## Rate limits Our APIs implement rate-limiting based on the number of requests made to them. Each request will return the following headers: - `X-RateLimit-Limit` - The maximum number of requests you're permitted to make in the current time window. - `X-RateLimit-Remaining` - The number of requests remaining in the current time window. - `X-RateLimit-Reset` - The remaining time in seconds until the current time window resets. Additionally, Our Risk, Filter (and the legacy Authenticate) APIs have a per-user-id rate limit of 6 requests per second and 10 requests per 5 seconds. + * + * OpenAPI spec version: 1 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.castle.client.model.generated; + +import com.google.gson.annotations.SerializedName; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; +/** + * FilterAndRiskResponseBehavior + */ + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2025-01-20T18:58:06.855017776Z[GMT]") + +public class Behavior { + @SerializedName("fingerprint") + private String fingerprint = null; + + public Behavior fingerprint(String fingerprint) { + this.fingerprint = fingerprint; + return this; + } + + /** + * Get fingerprint + * @return fingerprint + **/ + @ApiModelProperty(example = "vOch_0a_fpkl1Tf-pVPuDA", value = "") + public String getFingerprint() { + return fingerprint; + } + + public void setFingerprint(String fingerprint) { + this.fingerprint = fingerprint; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Behavior behavior = (Behavior) o; + return Objects.equals(this.fingerprint, behavior.fingerprint); + } + + @Override + public int hashCode() { + return Objects.hash(fingerprint); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FilterAndRiskResponseBehavior {\n"); + + sb.append(" fingerprint: ").append(toIndentedString(fingerprint)).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/io/castle/client/model/generated/Device.java b/src/main/java/io/castle/client/model/generated/Device.java old mode 100644 new mode 100755 index 7305f5a..a0bfd3b --- a/src/main/java/io/castle/client/model/generated/Device.java +++ b/src/main/java/io/castle/client/model/generated/Device.java @@ -21,7 +21,9 @@ /** * Device */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-05T19:53:01.452316+01:00[Europe/Stockholm]") + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2025-01-20T18:58:06.855017776Z[GMT]") + public class Device { public static final String SERIALIZED_NAME_USER_AGENT = "user_agent"; @SerializedName(SERIALIZED_NAME_USER_AGENT) @@ -47,6 +49,8 @@ public class Device { @SerializedName(SERIALIZED_NAME_TIMEZONE) private DeviceTimezone timezone; + @SerializedName("screen") + private DeviceScreen screen = null; public Device userAgent(String userAgent) { @@ -185,6 +189,24 @@ public void setTimezone(DeviceTimezone timezone) { this.timezone = timezone; } + public Device screen(DeviceScreen screen) { + this.screen = screen; + return this; + } + + /** + * Get screen + * @return screen + **/ + @ApiModelProperty(value = "") + public DeviceScreen getScreen() { + return screen; + } + + public void setScreen(DeviceScreen screen) { + this.screen = screen; + } + @Override public boolean equals(Object o) { @@ -200,12 +222,13 @@ public boolean equals(Object o) { Objects.equals(this.hardware, device.hardware) && Objects.equals(this.os, device.os) && Objects.equals(this.software, device.software) && - Objects.equals(this.timezone, device.timezone); + Objects.equals(this.timezone, device.timezone) && + Objects.equals(this.screen, device.screen); } @Override public int hashCode() { - return Objects.hash(userAgent, fingerprint, hardware, os, software, timezone); + return Objects.hash(userAgent, fingerprint, hardware, os, software, timezone, screen); } @Override @@ -218,6 +241,7 @@ public String toString() { sb.append(" os: ").append(toIndentedString(os)).append("\n"); sb.append(" software: ").append(toIndentedString(software)).append("\n"); sb.append(" timezone: ").append(toIndentedString(timezone)).append("\n"); + sb.append(" screen: ").append(toIndentedString(screen)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/src/main/java/io/castle/client/model/generated/DeviceHardware.java b/src/main/java/io/castle/client/model/generated/DeviceHardware.java old mode 100644 new mode 100755 index c09b59f..42e2630 --- a/src/main/java/io/castle/client/model/generated/DeviceHardware.java +++ b/src/main/java/io/castle/client/model/generated/DeviceHardware.java @@ -39,9 +39,12 @@ public class DeviceHardware { @SerializedName(SERIALIZED_NAME_MODEL) private DeviceHardwareModel model; + public static final String SERIALIZED_NAME_DISPLAY = "display"; + @SerializedName(SERIALIZED_NAME_DISPLAY) + private DeviceHardwareDisplay display = null; + public DeviceHardware type(String type) { - this.type = type; return this; } @@ -103,14 +106,30 @@ public String getBrand() { return brand; } - public void setBrand(String brand) { this.brand = brand; } + public DeviceHardware display(DeviceHardwareDisplay display) { + this.display = display; + return this; + } + + /** + * Get display + * @return display + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + public DeviceHardwareDisplay getDisplay() { + return display; + } + + public void setDisplay(DeviceHardwareDisplay display) { + this.display = display; + } public DeviceHardware model(DeviceHardwareModel model) { - this.model = model; return this; } @@ -144,12 +163,13 @@ public boolean equals(Object o) { return Objects.equals(this.type, deviceHardware.type) && Objects.equals(this.name, deviceHardware.name) && Objects.equals(this.brand, deviceHardware.brand) && + Objects.equals(this.display, deviceHardware.display) && Objects.equals(this.model, deviceHardware.model); } @Override public int hashCode() { - return Objects.hash(type, name, brand, model); + return Objects.hash(type, name, brand, display, model); } @Override @@ -159,6 +179,7 @@ public String toString() { sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" brand: ").append(toIndentedString(brand)).append("\n"); + sb.append(" display: ").append(toIndentedString(display)).append("\n"); sb.append(" model: ").append(toIndentedString(model)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/io/castle/client/model/generated/FilterUser.java b/src/main/java/io/castle/client/model/generated/DeviceHardwareDisplay.java old mode 100644 new mode 100755 similarity index 54% rename from src/main/java/io/castle/client/model/generated/FilterUser.java rename to src/main/java/io/castle/client/model/generated/DeviceHardwareDisplay.java index c139c52..1db35f6 --- a/src/main/java/io/castle/client/model/generated/FilterUser.java +++ b/src/main/java/io/castle/client/model/generated/DeviceHardwareDisplay.java @@ -2,83 +2,67 @@ * Castle API * ## Introduction **Just getting started? Check out our [quick start guide](https://docs.castle.io/docs/quickstart)** Castle APIs uses standard HTTP response codes, authentication and verbs. JSON is used as data exchange format, both for parsing incoming request bodies, and in the returned response. This means that the `Content-Type` header should to be set to `application/json` in requests with a body, such as `POST` or `PUT`. All API requests must be made over [HTTPS](http://en.wikipedia.org/wiki/HTTP_Secure). Non-HTTPS calls will fail and the **TLS version needs to be 1.1 or higher**. ## Supported types For a list of supported types, see our [Types Reference](https://docs.castle.io/docs/events). ## Rate limits Our APIs implement rate-limiting based on the number of requests made to them. Each request will return the following headers: - `X-RateLimit-Limit` - The maximum number of requests you're permitted to make in the current time window. - `X-RateLimit-Remaining` - The number of requests remaining in the current time window. - `X-RateLimit-Reset` - The remaining time in seconds until the current time window resets. Additionally, Our Risk, Filter (and the legacy Authenticate) APIs have a per-user-id rate limit of 6 requests per second and 10 requests per 5 seconds. * - * The version of the OpenAPI document: 1 + * OpenAPI spec version: 1 * * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ - package io.castle.client.model.generated; import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModelProperty; import java.util.Objects; - /** - * FilterRequestAllOfUser + * DeviceHardwareDisplay */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-05T19:53:01.452316+01:00[Europe/Stockholm]") -public class FilterUser { - public static final String SERIALIZED_NAME_EMAIL = "email"; - @SerializedName(SERIALIZED_NAME_EMAIL) - private String email; - public static final String SERIALIZED_NAME_PHONE = "phone"; - @SerializedName(SERIALIZED_NAME_PHONE) - private String phone; +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2025-01-20T18:58:06.855017776Z[GMT]") + +public class DeviceHardwareDisplay { + @SerializedName("width") + private int width; + @SerializedName("height") + private int height; - public FilterUser email(String email) { - - this.email = email; + public DeviceHardwareDisplay width(Integer width) { + this.width = width; return this; } /** - * The identified user's email address - * @return email - * @deprecated + * Get width + * @return width **/ - @Deprecated - @javax.annotation.Nullable - @ApiModelProperty(example = "Rhea.Franecki@example.org", value = "The identified user's email address") - - public String getEmail() { - return email; + @ApiModelProperty(example = "1512", required = true, value = "") + public int getWidth() { + return width; } - - public void setEmail(String email) { - this.email = email; + public void setWidth(int width) { + this.width = width; } - - public FilterUser phone(String phone) { - - this.phone = phone; + public DeviceHardwareDisplay height(int height) { + this.height = height; return this; } /** - * The identified user's phone number - * @return phone - * @deprecated + * Get height + * @return height **/ - @Deprecated - @javax.annotation.Nullable - @ApiModelProperty(example = "+16175551212", value = "The identified user's phone number") - - public String getPhone() { - return phone; + @ApiModelProperty(example = "982", required = true, value = "") + public int getHeight() { + return height; } - - public void setPhone(String phone) { - this.phone = phone; + public void setHeight(int height) { + this.height = height; } @@ -90,22 +74,23 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - FilterUser filterRequestAllOfUser = (FilterUser) o; - return Objects.equals(this.email, filterRequestAllOfUser.email) && - Objects.equals(this.phone, filterRequestAllOfUser.phone); + DeviceHardwareDisplay deviceHardwareDisplay = (DeviceHardwareDisplay) o; + return Objects.equals(this.width, deviceHardwareDisplay.width) && + Objects.equals(this.height, deviceHardwareDisplay.height); } @Override public int hashCode() { - return Objects.hash(email, phone); + return Objects.hash(width, height); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class FilterRequestAllOfUser {\n"); - sb.append(" email: ").append(toIndentedString(email)).append("\n"); - sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append("class DeviceHardwareDisplay {\n"); + sb.append(" width: ").append(toIndentedString(width)).append("\n"); + sb.append(" height: ").append(toIndentedString(height)).append("\n"); sb.append("}"); return sb.toString(); } @@ -122,4 +107,3 @@ private String toIndentedString(Object o) { } } - diff --git a/src/main/java/io/castle/client/model/generated/DeviceScreen.java b/src/main/java/io/castle/client/model/generated/DeviceScreen.java new file mode 100755 index 0000000..cceb643 --- /dev/null +++ b/src/main/java/io/castle/client/model/generated/DeviceScreen.java @@ -0,0 +1,110 @@ +/* + * Castle API + * ## Introduction **Just getting started? Check out our [quick start guide](https://docs.castle.io/docs/quickstart)** Castle APIs uses standard HTTP response codes, authentication and verbs. JSON is used as data exchange format, both for parsing incoming request bodies, and in the returned response. This means that the `Content-Type` header should to be set to `application/json` in requests with a body, such as `POST` or `PUT`. All API requests must be made over [HTTPS](http://en.wikipedia.org/wiki/HTTP_Secure). Non-HTTPS calls will fail and the **TLS version needs to be 1.1 or higher**. ## Supported types For a list of supported types, see our [Types Reference](https://docs.castle.io/docs/events). ## Rate limits Our APIs implement rate-limiting based on the number of requests made to them. Each request will return the following headers: - `X-RateLimit-Limit` - The maximum number of requests you're permitted to make in the current time window. - `X-RateLimit-Remaining` - The number of requests remaining in the current time window. - `X-RateLimit-Reset` - The remaining time in seconds until the current time window resets. Additionally, Our Risk, Filter (and the legacy Authenticate) APIs have a per-user-id rate limit of 6 requests per second and 10 requests per 5 seconds. + * + * OpenAPI spec version: 1 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.castle.client.model.generated; + +import com.google.gson.annotations.SerializedName; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; +/** + * DeviceScreen + */ + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2025-01-20T18:58:06.855017776Z[GMT]") + +public class DeviceScreen { + @SerializedName("screen") + private Integer screen = null; + + @SerializedName("orientation") + private String orientation = null; + + public DeviceScreen screen(Integer screen) { + this.screen = screen; + return this; + } + + /** + * Get screen + * @return screen + **/ + @ApiModelProperty(example = "2", value = "") + public int getScreen() { + return screen; + } + + public void setScreen(int screen) { + this.screen = screen; + } + + public DeviceScreen orientation(String orientation) { + this.orientation = orientation; + return this; + } + + /** + * Get orientation + * @return orientation + **/ + @ApiModelProperty(example = "landscape", value = "") + public String getOrientation() { + return orientation; + } + + public void setOrientation(String orientation) { + this.orientation = orientation; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeviceScreen deviceScreen = (DeviceScreen) o; + return Objects.equals(this.screen, deviceScreen.screen) && + Objects.equals(this.orientation, deviceScreen.orientation); + } + + @Override + public int hashCode() { + return Objects.hash(screen, orientation); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeviceScreen {\n"); + + sb.append(" screen: ").append(toIndentedString(screen)).append("\n"); + sb.append(" orientation: ").append(toIndentedString(orientation)).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/io/castle/client/model/generated/DeviceSoftware.java b/src/main/java/io/castle/client/model/generated/DeviceSoftware.java old mode 100644 new mode 100755 index 8a3b57f..5ef80d5 --- a/src/main/java/io/castle/client/model/generated/DeviceSoftware.java +++ b/src/main/java/io/castle/client/model/generated/DeviceSoftware.java @@ -10,18 +10,18 @@ * Do not edit the class manually. */ - package io.castle.client.model.generated; import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; import java.util.Objects; - /** * DeviceSoftware */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-05T19:53:01.452316+01:00[Europe/Stockholm]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-20T18:58:06.855017776Z[GMT]") public class DeviceSoftware { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @@ -31,13 +31,19 @@ public class DeviceSoftware { @SerializedName(SERIALIZED_NAME_NAME) private String name; + public static final String SERIALIZED_NAME_LANGUAGES = "languages"; + @SerializedName(SERIALIZED_NAME_LANGUAGES) + private List languages = new ArrayList(); + public static final String SERIALIZED_NAME_VERSION = "version"; @SerializedName(SERIALIZED_NAME_VERSION) private DeviceSoftwareVersion version; + public static final String SERIALIZED_NAME_FINGERPRINT = "fingerprint"; + @SerializedName(SERIALIZED_NAME_FINGERPRINT) + private String fingerprint = null; public DeviceSoftware type(String type) { - this.type = type; return this; } @@ -81,6 +87,28 @@ public void setName(String name) { this.name = name; } + public DeviceSoftware languages(List languages) { + this.languages = languages; + return this; + } + + public DeviceSoftware addLanguagesItem(String languagesItem) { + this.languages.add(languagesItem); + return this; + } + + /** + * Get languages + * @return languages + **/ + @ApiModelProperty(example = "[\"en-us\",\"en\"]", required = true) + public List getLanguages() { + return languages; + } + + public void setLanguages(List languages) { + this.languages = languages; + } public DeviceSoftware version(DeviceSoftwareVersion version) { @@ -104,6 +132,24 @@ public void setVersion(DeviceSoftwareVersion version) { this.version = version; } + public DeviceSoftware fingerprint(String fingerprint) { + this.fingerprint = fingerprint; + return this; + } + + /** + * Get fingerprint + * @return fingerprint + **/ + @ApiModelProperty(example = "vOch_0a_fpkl1Tf-pVPuDA", required = true) + public String getFingerprint() { + return fingerprint; + } + + public void setFingerprint(String fingerprint) { + this.fingerprint = fingerprint; + } + @Override public boolean equals(Object o) { @@ -116,21 +162,26 @@ public boolean equals(Object o) { DeviceSoftware deviceSoftware = (DeviceSoftware) o; return Objects.equals(this.type, deviceSoftware.type) && Objects.equals(this.name, deviceSoftware.name) && - Objects.equals(this.version, deviceSoftware.version); + Objects.equals(this.languages, deviceSoftware.languages) && + Objects.equals(this.version, deviceSoftware.version) && + Objects.equals(this.fingerprint, deviceSoftware.fingerprint); } @Override public int hashCode() { - return Objects.hash(type, name, version); + return Objects.hash(type, name, languages, version, fingerprint); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class DeviceSoftware {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" languages: ").append(toIndentedString(languages)).append("\n"); sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" fingerprint: ").append(toIndentedString(fingerprint)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/src/main/java/io/castle/client/model/generated/DeviceTimezone.java b/src/main/java/io/castle/client/model/generated/DeviceTimezone.java old mode 100644 new mode 100755 index f64d825..a25b11b --- a/src/main/java/io/castle/client/model/generated/DeviceTimezone.java +++ b/src/main/java/io/castle/client/model/generated/DeviceTimezone.java @@ -27,10 +27,12 @@ public class DeviceTimezone { public static final String SERIALIZED_NAME_OFFSET = "offset"; @SerializedName(SERIALIZED_NAME_OFFSET) - private Integer offset; + private int offset; + @SerializedName("name") + private String name = null; - public DeviceTimezone offset(Integer offset) { + public DeviceTimezone offset(int offset) { this.offset = offset; return this; @@ -43,15 +45,33 @@ public DeviceTimezone offset(Integer offset) { @javax.annotation.Nullable @ApiModelProperty(example = "-300", value = "Time offset from UTC measured in minutes") - public Integer getOffset() { + public int getOffset() { return offset; } - public void setOffset(Integer offset) { + public void setOffset(int offset) { this.offset = offset; } + public DeviceTimezone name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(example = "America/New_York", value = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + @Override public boolean equals(Object o) { @@ -71,7 +91,7 @@ private static boolean equalsNullable(JsonNullable a, JsonNullable b) @Override public int hashCode() { - return Objects.hash(offset); + return Objects.hash(offset, name); } private static int hashCodeNullable(JsonNullable a) { @@ -88,6 +108,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class DeviceTimezone {\n"); sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/src/main/java/io/castle/client/model/generated/EventParams.java b/src/main/java/io/castle/client/model/generated/EventParams.java old mode 100644 new mode 100755 index 58f57db..a1947b3 --- a/src/main/java/io/castle/client/model/generated/EventParams.java +++ b/src/main/java/io/castle/client/model/generated/EventParams.java @@ -2,49 +2,38 @@ * Castle API * ## Introduction **Just getting started? Check out our [quick start guide](https://docs.castle.io/docs/quickstart)** Castle APIs uses standard HTTP response codes, authentication and verbs. JSON is used as data exchange format, both for parsing incoming request bodies, and in the returned response. This means that the `Content-Type` header should to be set to `application/json` in requests with a body, such as `POST` or `PUT`. All API requests must be made over [HTTPS](http://en.wikipedia.org/wiki/HTTP_Secure). Non-HTTPS calls will fail and the **TLS version needs to be 1.1 or higher**. ## Supported types For a list of supported types, see our [Types Reference](https://docs.castle.io/docs/events). ## Rate limits Our APIs implement rate-limiting based on the number of requests made to them. Each request will return the following headers: - `X-RateLimit-Limit` - The maximum number of requests you're permitted to make in the current time window. - `X-RateLimit-Remaining` - The number of requests remaining in the current time window. - `X-RateLimit-Reset` - The remaining time in seconds until the current time window resets. Additionally, Our Risk, Filter (and the legacy Authenticate) APIs have a per-user-id rate limit of 6 requests per second and 10 requests per 5 seconds. * - * The version of the OpenAPI document: 1 + * OpenAPI spec version: 1 * * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ - package io.castle.client.model.generated; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; +import java.util.Objects; /** * The params object */ @ApiModel(description = "The params object") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-05T19:53:01.452316+01:00[Europe/Stockholm]") -public class EventParams { - public static final String SERIALIZED_NAME_EMAIL = "email"; - @SerializedName(SERIALIZED_NAME_EMAIL) - private String email; +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2025-01-20T18:58:06.855017776Z[GMT]") - public static final String SERIALIZED_NAME_PHONE = "phone"; - @SerializedName(SERIALIZED_NAME_PHONE) - private String phone; +public class EventParams { + @SerializedName("email") + private String email = null; - public static final String SERIALIZED_NAME_USERNAME = "username"; - @SerializedName(SERIALIZED_NAME_USERNAME) - private String username; + @SerializedName("phone") + private String phone = null; + @SerializedName("username") + private String username = null; public EventParams email(String email) { - this.email = email; return this; } @@ -53,21 +42,16 @@ public EventParams email(String email) { * The email address sent by the user * @return email **/ - @javax.annotation.Nullable @ApiModelProperty(example = "Rhea.Franecki@example.org", value = "The email address sent by the user") - public String getEmail() { return email; } - public void setEmail(String email) { this.email = email; } - public EventParams phone(String phone) { - this.phone = phone; return this; } @@ -76,21 +60,16 @@ public EventParams phone(String phone) { * The phone number sent by the user * @return phone **/ - @javax.annotation.Nullable @ApiModelProperty(example = "+16175551212", value = "The phone number sent by the user") - public String getPhone() { return phone; } - public void setPhone(String phone) { this.phone = phone; } - public EventParams username(String username) { - this.username = username; return this; } @@ -99,14 +78,11 @@ public EventParams username(String username) { * The username sent by the user * @return username **/ - @javax.annotation.Nullable @ApiModelProperty(example = "superhero123", value = "The username sent by the user") - public String getUsername() { return username; } - public void setUsername(String username) { this.username = username; } @@ -131,6 +107,7 @@ public int hashCode() { return Objects.hash(email, phone, username); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -154,4 +131,3 @@ private String toIndentedString(Object o) { } } - diff --git a/src/main/java/io/castle/client/model/generated/Filter.java b/src/main/java/io/castle/client/model/generated/Filter.java index 4c36cd0..a925c85 100644 --- a/src/main/java/io/castle/client/model/generated/Filter.java +++ b/src/main/java/io/castle/client/model/generated/Filter.java @@ -55,7 +55,7 @@ public class Filter { public static final String SERIALIZED_NAME_USER = "user"; @SerializedName(SERIALIZED_NAME_USER) - private FilterUser user; + private User user; public static final String SERIALIZED_NAME_PARAMS = "params"; @SerializedName(SERIALIZED_NAME_PARAMS) @@ -344,7 +344,7 @@ public void setRequestToken(String requestToken) { } - public Filter user(FilterUser user) { + public Filter user(User user) { this.user = user; return this; @@ -357,12 +357,12 @@ public Filter user(FilterUser user) { @javax.annotation.Nullable @ApiModelProperty(value = "") - public FilterUser getUser() { + public User getUser() { return user; } - public void setUser(FilterUser user) { + public void setUser(User user) { this.user = user; } diff --git a/src/main/java/io/castle/client/model/generated/FilterAndRiskResponse.java b/src/main/java/io/castle/client/model/generated/FilterAndRiskResponse.java old mode 100644 new mode 100755 index 01a3d85..3531f4e --- a/src/main/java/io/castle/client/model/generated/FilterAndRiskResponse.java +++ b/src/main/java/io/castle/client/model/generated/FilterAndRiskResponse.java @@ -2,15 +2,14 @@ * Castle API * ## Introduction **Just getting started? Check out our [quick start guide](https://docs.castle.io/docs/quickstart)** Castle APIs uses standard HTTP response codes, authentication and verbs. JSON is used as data exchange format, both for parsing incoming request bodies, and in the returned response. This means that the `Content-Type` header should to be set to `application/json` in requests with a body, such as `POST` or `PUT`. All API requests must be made over [HTTPS](http://en.wikipedia.org/wiki/HTTP_Secure). Non-HTTPS calls will fail and the **TLS version needs to be 1.1 or higher**. ## Supported types For a list of supported types, see our [Types Reference](https://docs.castle.io/docs/events). ## Rate limits Our APIs implement rate-limiting based on the number of requests made to them. Each request will return the following headers: - `X-RateLimit-Limit` - The maximum number of requests you're permitted to make in the current time window. - `X-RateLimit-Remaining` - The number of requests remaining in the current time window. - `X-RateLimit-Reset` - The remaining time in seconds until the current time window resets. Additionally, Our Risk, Filter (and the legacy Authenticate) APIs have a per-user-id rate limit of 6 requests per second and 10 requests per 5 seconds. * - * The version of the OpenAPI document: 1 + * OpenAPI spec version: 1 * * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ - package io.castle.client.model.generated; import com.google.gson.annotations.SerializedName; @@ -20,125 +19,97 @@ import java.util.HashMap; import java.util.Map; import java.util.Objects; - /** * FilterAndRiskResponse */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-05T19:53:01.452316+01:00[Europe/Stockholm]") + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2025-01-20T18:58:06.855017776Z[GMT]") + public class FilterAndRiskResponse { - public static final String SERIALIZED_NAME_RISK = "risk"; - @SerializedName(SERIALIZED_NAME_RISK) + @SerializedName("risk") private Double risk; - public static final String SERIALIZED_NAME_SCORES = "scores"; - @SerializedName(SERIALIZED_NAME_SCORES) - private FilterAndRiskResponseScores scores; + @SerializedName("scores") + private FilterAndRiskResponseScores scores = null; - public static final String SERIALIZED_NAME_POLICY = "policy"; - @SerializedName(SERIALIZED_NAME_POLICY) - private Policy policy; + @SerializedName("policy") + private Policy policy = null; - public static final String SERIALIZED_NAME_SIGNALS = "signals"; - @SerializedName(SERIALIZED_NAME_SIGNALS) + @SerializedName("signals") private Map signals = new HashMap(); - public static final String SERIALIZED_NAME_DEVICE = "device"; - @SerializedName(SERIALIZED_NAME_DEVICE) - private Device device; + @SerializedName("metrics") + private Map metrics = null; - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; + @SerializedName("device") + private Device device = null; - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + @SerializedName("id") + private String id = null; - public static final String SERIALIZED_NAME_TYPE = "type"; - @SerializedName(SERIALIZED_NAME_TYPE) - private String type; + @SerializedName("name") + private String name = null; - public static final String SERIALIZED_NAME_STATUS = "status"; - @SerializedName(SERIALIZED_NAME_STATUS) - private String status; + @SerializedName("type") + private String type = null; - public static final String SERIALIZED_NAME_CREATED_AT = "created_at"; - @SerializedName(SERIALIZED_NAME_CREATED_AT) - private OffsetDateTime createdAt; + /** + * Gets or Sets status + */ + @SerializedName("status") + private String status = "$attempted"; - public static final String SERIALIZED_NAME_AUTHENTICATED = "authenticated"; - @SerializedName(SERIALIZED_NAME_AUTHENTICATED) - private Boolean authenticated; + @SerializedName("created_at") + private OffsetDateTime createdAt = null; - public static final String SERIALIZED_NAME_AUTHENTICATION_METHOD = "authentication_method"; - @SerializedName(SERIALIZED_NAME_AUTHENTICATION_METHOD) - private AuthenticationMethod authenticationMethod; + @SerializedName("authenticated") + private Boolean authenticated = null; - public static final String SERIALIZED_NAME_CHANGESET = "changeset"; - @SerializedName(SERIALIZED_NAME_CHANGESET) - private Changeset changeset; + @SerializedName("authentication_method") + private AuthenticationMethod authenticationMethod = null; - public static final String SERIALIZED_NAME_EMAIL = "email"; - @SerializedName(SERIALIZED_NAME_EMAIL) - private FilterAndRiskResponseEmail email; + @SerializedName("email") + private FilterAndRiskResponseEmail email = null; - public static final String SERIALIZED_NAME_ENDPOINT = "endpoint"; - @SerializedName(SERIALIZED_NAME_ENDPOINT) - private String endpoint; + @SerializedName("endpoint") + private String endpoint = null; - public static final String SERIALIZED_NAME_IP = "ip"; - @SerializedName(SERIALIZED_NAME_IP) - private IP ip; + @SerializedName("ip") + private IP ip = null; - public static final String SERIALIZED_NAME_PARAMS = "params"; - @SerializedName(SERIALIZED_NAME_PARAMS) - private EventParams params; + @SerializedName("params") + private EventParams params = null; - public static final String SERIALIZED_NAME_PRODUCT = "product"; - @SerializedName(SERIALIZED_NAME_PRODUCT) - private Product product; + @SerializedName("product") + private Product product = null; - public static final String SERIALIZED_NAME_SDKS = "sdks"; - @SerializedName(SERIALIZED_NAME_SDKS) - private FilterAndRiskResponseSdks sdks; + @SerializedName("sdks") + private FilterAndRiskResponseSdks sdks = null; - public static final String SERIALIZED_NAME_SESSION = "session"; - @SerializedName(SERIALIZED_NAME_SESSION) - private Session session; + @SerializedName("session") + private Session session = null; - public static final String SERIALIZED_NAME_TRANSACTION = "transaction"; - @SerializedName(SERIALIZED_NAME_TRANSACTION) - private Transaction transaction; + @SerializedName("user") + private User user = null; - public static final String SERIALIZED_NAME_USER = "user"; - @SerializedName(SERIALIZED_NAME_USER) - private RiskUser user; + @SerializedName("behavior") + private Behavior behavior = null; - public static final String SERIALIZED_NAME_PROPERTIES = "properties"; - @SerializedName(SERIALIZED_NAME_PROPERTIES) + @SerializedName("properties") private Map properties = null; - /** * Deprecated Risk Score - use `scores` instead. Calculated only when `request_token` and `context` are provided. * minimum: 0 * maximum: 1 * @return risk - * @deprecated **/ - @Deprecated - @javax.annotation.Nullable @ApiModelProperty(example = "0.65", value = "Deprecated Risk Score - use `scores` instead. Calculated only when `request_token` and `context` are provided.") - public Double getRisk() { return risk; } - - - public FilterAndRiskResponse scores(FilterAndRiskResponseScores scores) { - this.scores = scores; return this; } @@ -147,21 +118,16 @@ public FilterAndRiskResponse scores(FilterAndRiskResponseScores scores) { * Get scores * @return scores **/ - @javax.annotation.Nullable @ApiModelProperty(value = "") - public FilterAndRiskResponseScores getScores() { return scores; } - public void setScores(FilterAndRiskResponseScores scores) { this.scores = scores; } - public FilterAndRiskResponse policy(Policy policy) { - this.policy = policy; return this; } @@ -170,35 +136,34 @@ public FilterAndRiskResponse policy(Policy policy) { * Get policy * @return policy **/ - @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "") - public Policy getPolicy() { return policy; } - public void setPolicy(Policy policy) { this.policy = policy; } - /** * Signals triggered for this event/context * @return signals **/ - @javax.annotation.Nonnull @ApiModelProperty(example = "{\"bot_behavior\":{},\"proxy_ip\":{},\"disposable_email\":{},\"spoofed_device\":{},\"multiple_accounts_per_device\":{}}", required = true, value = "Signals triggered for this event/context") - public Map getSignals() { return signals; } - - + /** + * Metrics triggered for this event/context + * @return metrics + **/ + @ApiModelProperty(example = "{\"1\":{},\"2\":{},\"3\":{},\"4\":{},\"5\":{}}", value = "Metrics triggered for this event/context") + public Map getMetrics() { + return metrics; + } public FilterAndRiskResponse device(Device device) { - this.device = device; return this; } @@ -207,35 +172,25 @@ public FilterAndRiskResponse device(Device device) { * Get device * @return device **/ - @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "") - public Device getDevice() { return device; } - public void setDevice(Device device) { this.device = device; } - /** * Castle Event ID * @return id **/ - @javax.annotation.Nullable @ApiModelProperty(example = "ASZoelALT5-PaVw2pAVMXg", value = "Castle Event ID") - public String getId() { return id; } - - - public FilterAndRiskResponse name(String name) { - this.name = name; return this; } @@ -244,77 +199,70 @@ public FilterAndRiskResponse name(String name) { * Event Full Name * @return name **/ - @javax.annotation.Nullable @ApiModelProperty(example = "Login Succeeded", value = "Event Full Name") - public String getName() { return name; } - public void setName(String name) { this.name = name; } + public FilterAndRiskResponse type(String type) { + this.type = type; + return this; + } /** - * Event type + * Castle supported events available for this endpoint * @return type **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "$login", value = "Event type") - + @ApiModelProperty(required = true, value = "Castle supported events available for this endpoint") public String getType() { return type; } + public void setType(String type) { + this.type = type; + } - + public FilterAndRiskResponse status(String status) { + this.status = status; + return this; + } /** - * Event status + * Get status * @return status **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "$succeeded", value = "Event status") - + @ApiModelProperty(value = "") public String getStatus() { return status; } - - + public void setStatus(String status) { + this.status = status; + } /** * Event timestamp * @return createdAt **/ - @javax.annotation.Nullable @ApiModelProperty(example = "2021-09-27T16:46:38.313Z", value = "Event timestamp") - public OffsetDateTime getCreatedAt() { return createdAt; } - - - /** * Authenticated or Anonymous visitor * @return authenticated **/ - @javax.annotation.Nullable @ApiModelProperty(example = "true", value = "Authenticated or Anonymous visitor") - - public Boolean getAuthenticated() { + public Boolean isAuthenticated() { return authenticated; } - - - public FilterAndRiskResponse authenticationMethod(AuthenticationMethod authenticationMethod) { - this.authenticationMethod = authenticationMethod; return this; } @@ -323,44 +271,16 @@ public FilterAndRiskResponse authenticationMethod(AuthenticationMethod authentic * Get authenticationMethod * @return authenticationMethod **/ - @javax.annotation.Nullable @ApiModelProperty(value = "") - public AuthenticationMethod getAuthenticationMethod() { return authenticationMethod; } - public void setAuthenticationMethod(AuthenticationMethod authenticationMethod) { this.authenticationMethod = authenticationMethod; } - - public FilterAndRiskResponse changeset(Changeset changeset) { - - this.changeset = changeset; - return this; - } - - /** - * Get changeset - * @return changeset - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - - public Changeset getChangeset() { - return changeset; - } - - - public void setChangeset(Changeset changeset) { - this.changeset = changeset; - } - - public FilterAndRiskResponse email(FilterAndRiskResponseEmail email) { - this.email = email; return this; } @@ -369,35 +289,25 @@ public FilterAndRiskResponse email(FilterAndRiskResponseEmail email) { * Get email * @return email **/ - @javax.annotation.Nullable @ApiModelProperty(value = "") - public FilterAndRiskResponseEmail getEmail() { return email; } - public void setEmail(FilterAndRiskResponseEmail email) { this.email = email; } - /** * Castle Request Endpoint * @return endpoint **/ - @javax.annotation.Nullable @ApiModelProperty(example = "/v1/risk", value = "Castle Request Endpoint") - public String getEndpoint() { return endpoint; } - - - public FilterAndRiskResponse ip(IP ip) { - this.ip = ip; return this; } @@ -406,21 +316,16 @@ public FilterAndRiskResponse ip(IP ip) { * Get ip * @return ip **/ - @javax.annotation.Nullable @ApiModelProperty(value = "") - public IP getIp() { return ip; } - public void setIp(IP ip) { this.ip = ip; } - public FilterAndRiskResponse params(EventParams params) { - this.params = params; return this; } @@ -429,21 +334,16 @@ public FilterAndRiskResponse params(EventParams params) { * Get params * @return params **/ - @javax.annotation.Nullable @ApiModelProperty(value = "") - public EventParams getParams() { return params; } - public void setParams(EventParams params) { this.params = params; } - public FilterAndRiskResponse product(Product product) { - this.product = product; return this; } @@ -452,21 +352,16 @@ public FilterAndRiskResponse product(Product product) { * Get product * @return product **/ - @javax.annotation.Nullable @ApiModelProperty(value = "") - public Product getProduct() { return product; } - public void setProduct(Product product) { this.product = product; } - public FilterAndRiskResponse sdks(FilterAndRiskResponseSdks sdks) { - this.sdks = sdks; return this; } @@ -475,21 +370,16 @@ public FilterAndRiskResponse sdks(FilterAndRiskResponseSdks sdks) { * Get sdks * @return sdks **/ - @javax.annotation.Nullable @ApiModelProperty(value = "") - public FilterAndRiskResponseSdks getSdks() { return sdks; } - public void setSdks(FilterAndRiskResponseSdks sdks) { this.sdks = sdks; } - public FilterAndRiskResponse session(Session session) { - this.session = session; return this; } @@ -498,91 +388,65 @@ public FilterAndRiskResponse session(Session session) { * Get session * @return session **/ - @javax.annotation.Nullable @ApiModelProperty(value = "") - public Session getSession() { return session; } - public void setSession(Session session) { this.session = session; } - - public FilterAndRiskResponse transaction(Transaction transaction) { - - this.transaction = transaction; + public FilterAndRiskResponse user(User user) { + this.user = user; return this; } /** - * Get transaction - * @return transaction + * Get user + * @return user **/ - @javax.annotation.Nullable @ApiModelProperty(value = "") - - public Transaction getTransaction() { - return transaction; + public User getUser() { + return user; } - - public void setTransaction(Transaction transaction) { - this.transaction = transaction; + public void setUser(User user) { + this.user = user; } - - public FilterAndRiskResponse user(RiskUser user) { - - this.user = user; + public FilterAndRiskResponse behavior(Behavior behavior) { + this.behavior = behavior; return this; } /** - * Get user - * @return user + * Get behavior + * @return behavior **/ - @javax.annotation.Nullable @ApiModelProperty(value = "") - - public RiskUser getUser() { - return user; + public Behavior getBehavior() { + return behavior; } - - public void setUser(RiskUser user) { - this.user = user; + public void setBehavior(Behavior behavior) { + this.behavior = behavior; } - - public FilterAndRiskResponse properties(Map properties) { - + public FilterAndRiskResponse properties(Map properties) { this.properties = properties; return this; } - public FilterAndRiskResponse putPropertiesItem(String key, Object propertiesItem) { - if (this.properties == null) { - this.properties = new HashMap(); - } - this.properties.put(key, propertiesItem); - return this; - } - /** - * User defined properties + * Get properties * @return properties **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "User defined properties") - - public Map getProperties() { + @ApiModelProperty(value = "") + public Map getProperties() { return properties; } - public void setProperties(Map properties) { this.properties = properties; } @@ -596,45 +460,48 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - FilterAndRiskResponse filterAndRiskResponse = (FilterAndRiskResponse) o; - return Objects.equals(this.risk, filterAndRiskResponse.risk) && - Objects.equals(this.scores, filterAndRiskResponse.scores) && - Objects.equals(this.policy, filterAndRiskResponse.policy) && - Objects.equals(this.signals, filterAndRiskResponse.signals) && - Objects.equals(this.device, filterAndRiskResponse.device) && - Objects.equals(this.id, filterAndRiskResponse.id) && - Objects.equals(this.name, filterAndRiskResponse.name) && - Objects.equals(this.type, filterAndRiskResponse.type) && - Objects.equals(this.status, filterAndRiskResponse.status) && - Objects.equals(this.createdAt, filterAndRiskResponse.createdAt) && - Objects.equals(this.authenticated, filterAndRiskResponse.authenticated) && - Objects.equals(this.authenticationMethod, filterAndRiskResponse.authenticationMethod) && - Objects.equals(this.changeset, filterAndRiskResponse.changeset) && - Objects.equals(this.email, filterAndRiskResponse.email) && - Objects.equals(this.endpoint, filterAndRiskResponse.endpoint) && - Objects.equals(this.ip, filterAndRiskResponse.ip) && - Objects.equals(this.params, filterAndRiskResponse.params) && - Objects.equals(this.product, filterAndRiskResponse.product) && - Objects.equals(this.sdks, filterAndRiskResponse.sdks) && - Objects.equals(this.session, filterAndRiskResponse.session) && - Objects.equals(this.transaction, filterAndRiskResponse.transaction) && - Objects.equals(this.user, filterAndRiskResponse.user) && - Objects.equals(this.properties, filterAndRiskResponse.properties); + FilterAndRiskResponse loginResponse = (FilterAndRiskResponse) o; + return Objects.equals(this.risk, loginResponse.risk) && + Objects.equals(this.scores, loginResponse.scores) && + Objects.equals(this.policy, loginResponse.policy) && + Objects.equals(this.signals, loginResponse.signals) && + Objects.equals(this.metrics, loginResponse.metrics) && + Objects.equals(this.device, loginResponse.device) && + Objects.equals(this.id, loginResponse.id) && + Objects.equals(this.name, loginResponse.name) && + Objects.equals(this.type, loginResponse.type) && + Objects.equals(this.status, loginResponse.status) && + Objects.equals(this.createdAt, loginResponse.createdAt) && + Objects.equals(this.authenticated, loginResponse.authenticated) && + Objects.equals(this.authenticationMethod, loginResponse.authenticationMethod) && + Objects.equals(this.email, loginResponse.email) && + Objects.equals(this.endpoint, loginResponse.endpoint) && + Objects.equals(this.ip, loginResponse.ip) && + Objects.equals(this.params, loginResponse.params) && + Objects.equals(this.product, loginResponse.product) && + Objects.equals(this.sdks, loginResponse.sdks) && + Objects.equals(this.session, loginResponse.session) && + Objects.equals(this.user, loginResponse.user) && + Objects.equals(this.behavior, loginResponse.behavior) && + Objects.equals(this.properties, loginResponse.properties); } @Override public int hashCode() { - return Objects.hash(risk, scores, policy, signals, device, id, name, type, status, createdAt, authenticated, authenticationMethod, changeset, email, endpoint, ip, params, product, sdks, session, transaction, user, properties); + return Objects.hash(risk, scores, policy, signals, metrics, device, id, name, type, status, createdAt, authenticated, authenticationMethod, email, endpoint, ip, params, product, sdks, session, user, behavior, properties); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class FilterAndRiskResponse {\n"); + sb.append(" risk: ").append(toIndentedString(risk)).append("\n"); sb.append(" scores: ").append(toIndentedString(scores)).append("\n"); sb.append(" policy: ").append(toIndentedString(policy)).append("\n"); sb.append(" signals: ").append(toIndentedString(signals)).append("\n"); + sb.append(" metrics: ").append(toIndentedString(metrics)).append("\n"); sb.append(" device: ").append(toIndentedString(device)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); @@ -643,7 +510,6 @@ public String toString() { sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); sb.append(" authenticated: ").append(toIndentedString(authenticated)).append("\n"); sb.append(" authenticationMethod: ").append(toIndentedString(authenticationMethod)).append("\n"); - sb.append(" changeset: ").append(toIndentedString(changeset)).append("\n"); sb.append(" email: ").append(toIndentedString(email)).append("\n"); sb.append(" endpoint: ").append(toIndentedString(endpoint)).append("\n"); sb.append(" ip: ").append(toIndentedString(ip)).append("\n"); @@ -651,8 +517,8 @@ public String toString() { sb.append(" product: ").append(toIndentedString(product)).append("\n"); sb.append(" sdks: ").append(toIndentedString(sdks)).append("\n"); sb.append(" session: ").append(toIndentedString(session)).append("\n"); - sb.append(" transaction: ").append(toIndentedString(transaction)).append("\n"); sb.append(" user: ").append(toIndentedString(user)).append("\n"); + sb.append(" behavior: ").append(toIndentedString(behavior)).append("\n"); sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); sb.append("}"); return sb.toString(); @@ -670,4 +536,3 @@ private String toIndentedString(Object o) { } } - diff --git a/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseEmail.java b/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseEmail.java old mode 100644 new mode 100755 index 9f90a6a..ef9e1a2 --- a/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseEmail.java +++ b/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseEmail.java @@ -2,15 +2,14 @@ * Castle API * ## Introduction **Just getting started? Check out our [quick start guide](https://docs.castle.io/docs/quickstart)** Castle APIs uses standard HTTP response codes, authentication and verbs. JSON is used as data exchange format, both for parsing incoming request bodies, and in the returned response. This means that the `Content-Type` header should to be set to `application/json` in requests with a body, such as `POST` or `PUT`. All API requests must be made over [HTTPS](http://en.wikipedia.org/wiki/HTTP_Secure). Non-HTTPS calls will fail and the **TLS version needs to be 1.1 or higher**. ## Supported types For a list of supported types, see our [Types Reference](https://docs.castle.io/docs/events). ## Rate limits Our APIs implement rate-limiting based on the number of requests made to them. Each request will return the following headers: - `X-RateLimit-Limit` - The maximum number of requests you're permitted to make in the current time window. - `X-RateLimit-Remaining` - The number of requests remaining in the current time window. - `X-RateLimit-Reset` - The remaining time in seconds until the current time window resets. Additionally, Our Risk, Filter (and the legacy Authenticate) APIs have a per-user-id rate limit of 6 requests per second and 10 requests per 5 seconds. * - * The version of the OpenAPI document: 1 + * OpenAPI spec version: 1 * * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ - package io.castle.client.model.generated; import com.google.gson.annotations.SerializedName; @@ -18,28 +17,29 @@ import io.swagger.annotations.ApiModelProperty; import java.util.Objects; - /** * User Email Object */ -@ApiModel(description = "User Email Object") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-05T19:53:01.452316+01:00[Europe/Stockholm]") +@ApiModel(value = "User Email Object") +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2025-01-20T18:58:06.855017776Z[GMT]") + public class FilterAndRiskResponseEmail { - public static final String SERIALIZED_NAME_NORMALIZED = "normalized"; - @SerializedName(SERIALIZED_NAME_NORMALIZED) - private String normalized; + @SerializedName("normalized") + private String normalized = null; - public static final String SERIALIZED_NAME_DOMAIN = "domain"; - @SerializedName(SERIALIZED_NAME_DOMAIN) - private String domain; + @SerializedName("domain") + private String domain = null; - public static final String SERIALIZED_NAME_DISPOSABLE = "disposable"; - @SerializedName(SERIALIZED_NAME_DISPOSABLE) - private Boolean disposable; + @SerializedName("disposable") + private Boolean disposable = null; + @SerializedName("unreachable") + private Boolean unreachable = null; + + @SerializedName("domain_details") + private FilterAndRiskResponseEmailDomainDetails domainDetails = null; public FilterAndRiskResponseEmail normalized(String normalized) { - this.normalized = normalized; return this; } @@ -48,21 +48,16 @@ public FilterAndRiskResponseEmail normalized(String normalized) { * Get normalized * @return normalized **/ - @javax.annotation.Nullable @ApiModelProperty(example = "user.email@example.com", value = "") - public String getNormalized() { return normalized; } - public void setNormalized(String normalized) { this.normalized = normalized; } - public FilterAndRiskResponseEmail domain(String domain) { - this.domain = domain; return this; } @@ -71,21 +66,16 @@ public FilterAndRiskResponseEmail domain(String domain) { * Get domain * @return domain **/ - @javax.annotation.Nullable @ApiModelProperty(example = "gmail.com", value = "") - public String getDomain() { return domain; } - public void setDomain(String domain) { this.domain = domain; } - public FilterAndRiskResponseEmail disposable(Boolean disposable) { - this.disposable = disposable; return this; } @@ -94,18 +84,51 @@ public FilterAndRiskResponseEmail disposable(Boolean disposable) { * Get disposable * @return disposable **/ - @javax.annotation.Nullable @ApiModelProperty(example = "false", value = "") - - public Boolean getDisposable() { + public Boolean isDisposable() { return disposable; } - public void setDisposable(Boolean disposable) { this.disposable = disposable; } + public FilterAndRiskResponseEmail unreachable(Boolean unreachable) { + this.unreachable = unreachable; + return this; + } + + /** + * Get unreachable + * @return unreachable + **/ + @ApiModelProperty(example = "false", value = "") + public Boolean isUnreachable() { + return unreachable; + } + + public void setUnreachable(Boolean unreachable) { + this.unreachable = unreachable; + } + + public FilterAndRiskResponseEmail domainDetails(FilterAndRiskResponseEmailDomainDetails domainDetails) { + this.domainDetails = domainDetails; + return this; + } + + /** + * Get domainDetails + * @return domainDetails + **/ + @ApiModelProperty(value = "") + public FilterAndRiskResponseEmailDomainDetails getDomainDetails() { + return domainDetails; + } + + public void setDomainDetails(FilterAndRiskResponseEmailDomainDetails domainDetails) { + this.domainDetails = domainDetails; + } + @Override public boolean equals(Object o) { @@ -115,24 +138,30 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - FilterAndRiskResponseEmail filterAndRiskResponseEmail = (FilterAndRiskResponseEmail) o; - return Objects.equals(this.normalized, filterAndRiskResponseEmail.normalized) && - Objects.equals(this.domain, filterAndRiskResponseEmail.domain) && - Objects.equals(this.disposable, filterAndRiskResponseEmail.disposable); + FilterAndRiskResponseEmail email = (FilterAndRiskResponseEmail) o; + return Objects.equals(this.normalized, email.normalized) && + Objects.equals(this.domain, email.domain) && + Objects.equals(this.disposable, email.disposable) && + Objects.equals(this.unreachable, email.unreachable) && + Objects.equals(this.domainDetails, email.domainDetails); } @Override public int hashCode() { - return Objects.hash(normalized, domain, disposable); + return Objects.hash(normalized, domain, disposable, unreachable, domainDetails); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class FilterAndRiskResponseEmail {\n"); + sb.append(" normalized: ").append(toIndentedString(normalized)).append("\n"); sb.append(" domain: ").append(toIndentedString(domain)).append("\n"); sb.append(" disposable: ").append(toIndentedString(disposable)).append("\n"); + sb.append(" unreachable: ").append(toIndentedString(unreachable)).append("\n"); + sb.append(" domainDetails: ").append(toIndentedString(domainDetails)).append("\n"); sb.append("}"); return sb.toString(); } @@ -149,4 +178,3 @@ private String toIndentedString(Object o) { } } - diff --git a/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseEmailDomainDetails.java b/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseEmailDomainDetails.java new file mode 100755 index 0000000..ee136fb --- /dev/null +++ b/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseEmailDomainDetails.java @@ -0,0 +1,259 @@ +/* + * Castle API + * ## Introduction **Just getting started? Check out our [quick start guide](https://docs.castle.io/docs/quickstart)** Castle APIs uses standard HTTP response codes, authentication and verbs. JSON is used as data exchange format, both for parsing incoming request bodies, and in the returned response. This means that the `Content-Type` header should to be set to `application/json` in requests with a body, such as `POST` or `PUT`. All API requests must be made over [HTTPS](http://en.wikipedia.org/wiki/HTTP_Secure). Non-HTTPS calls will fail and the **TLS version needs to be 1.1 or higher**. ## Supported types For a list of supported types, see our [Types Reference](https://docs.castle.io/docs/events). ## Rate limits Our APIs implement rate-limiting based on the number of requests made to them. Each request will return the following headers: - `X-RateLimit-Limit` - The maximum number of requests you're permitted to make in the current time window. - `X-RateLimit-Remaining` - The number of requests remaining in the current time window. - `X-RateLimit-Reset` - The remaining time in seconds until the current time window resets. Additionally, Our Risk, Filter (and the legacy Authenticate) APIs have a per-user-id rate limit of 6 requests per second and 10 requests per 5 seconds. + * + * OpenAPI spec version: 1 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.castle.client.model.generated; + +import com.google.gson.annotations.SerializedName; +import io.swagger.annotations.ApiModelProperty; +import org.threeten.bp.OffsetDateTime; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +/** + * FilterAndRiskReponseEmailDomainDetails + */ + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2025-01-20T18:58:06.855017776Z[GMT]") + +public class FilterAndRiskResponseEmailDomainDetails { + @SerializedName("created_at") + private OffsetDateTime createdAt = null; + + @SerializedName("updated_at") + private OffsetDateTime updatedAt = null; + + @SerializedName("expires_at") + private OffsetDateTime expiresAt = null; + + @SerializedName("registrar") + private String registrar = null; + + @SerializedName("nameservers") + private List nameservers = null; + + @SerializedName("spf_record") + private FilterAndRiskResponseEmailDomainDetailsSpfRecord spfRecord = null; + + @SerializedName("dmarc_record") + private FilterAndRiskResponseEmailDomainDetailsSpfRecord dmarcRecord = null; + + @SerializedName("mx_records") + private FilterAndRiskResponseEmailDomainDetailsMxRecords mxRecords = null; + + public FilterAndRiskResponseEmailDomainDetails createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @ApiModelProperty(example = "2021-09-27T16:46:38.313Z", value = "") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public FilterAndRiskResponseEmailDomainDetails updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + **/ + @ApiModelProperty(example = "2021-09-27T16:46:38.313Z", value = "") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + public FilterAndRiskResponseEmailDomainDetails expiresAt(OffsetDateTime expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + /** + * Get expiresAt + * @return expiresAt + **/ + @ApiModelProperty(example = "2021-09-27T16:46:38.313Z", value = "") + public OffsetDateTime getExpiresAt() { + return expiresAt; + } + + public void setExpiresAt(OffsetDateTime expiresAt) { + this.expiresAt = expiresAt; + } + + public FilterAndRiskResponseEmailDomainDetails registrar(String registrar) { + this.registrar = registrar; + return this; + } + + /** + * Get registrar + * @return registrar + **/ + @ApiModelProperty(value = "") + public String getRegistrar() { + return registrar; + } + + public void setRegistrar(String registrar) { + this.registrar = registrar; + } + + public FilterAndRiskResponseEmailDomainDetails nameservers(List nameservers) { + this.nameservers = nameservers; + return this; + } + + public FilterAndRiskResponseEmailDomainDetails addNameserversItem(String nameserversItem) { + if (this.nameservers == null) { + this.nameservers = new ArrayList(); + } + this.nameservers.add(nameserversItem); + return this; + } + + /** + * Get nameservers + * @return nameservers + **/ + @ApiModelProperty(example = "[\"ns1.hosting.com\",\"ns2.hosting.com\",\"ns3.hosting.com\"]", value = "") + public List getNameservers() { + return nameservers; + } + + public void setNameservers(List nameservers) { + this.nameservers = nameservers; + } + + public FilterAndRiskResponseEmailDomainDetails spfRecord(FilterAndRiskResponseEmailDomainDetailsSpfRecord spfRecord) { + this.spfRecord = spfRecord; + return this; + } + + /** + * Get spfRecord + * @return spfRecord + **/ + @ApiModelProperty(value = "") + public FilterAndRiskResponseEmailDomainDetailsSpfRecord getSpfRecord() { + return spfRecord; + } + + public void setSpfRecord(FilterAndRiskResponseEmailDomainDetailsSpfRecord spfRecord) { + this.spfRecord = spfRecord; + } + + public FilterAndRiskResponseEmailDomainDetails dmarcRecord(FilterAndRiskResponseEmailDomainDetailsSpfRecord dmarcRecord) { + this.dmarcRecord = dmarcRecord; + return this; + } + + /** + * Get dmarcRecord + * @return dmarcRecord + **/ + @ApiModelProperty(value = "") + public FilterAndRiskResponseEmailDomainDetailsSpfRecord getDmarcRecord() { + return dmarcRecord; + } + + public void setDmarcRecord(FilterAndRiskResponseEmailDomainDetailsSpfRecord dmarcRecord) { + this.dmarcRecord = dmarcRecord; + } + + public FilterAndRiskResponseEmailDomainDetails mxRecords(FilterAndRiskResponseEmailDomainDetailsMxRecords mxRecords) { + this.mxRecords = mxRecords; + return this; + } + + /** + * Get mxRecords + * @return mxRecords + **/ + @ApiModelProperty(value = "") + public FilterAndRiskResponseEmailDomainDetailsMxRecords getMxRecords() { + return mxRecords; + } + + public void setMxRecords(FilterAndRiskResponseEmailDomainDetailsMxRecords mxRecords) { + this.mxRecords = mxRecords; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FilterAndRiskResponseEmailDomainDetails emailDomainDetails = (FilterAndRiskResponseEmailDomainDetails) o; + return Objects.equals(this.createdAt, emailDomainDetails.createdAt) && + Objects.equals(this.updatedAt, emailDomainDetails.updatedAt) && + Objects.equals(this.expiresAt, emailDomainDetails.expiresAt) && + Objects.equals(this.registrar, emailDomainDetails.registrar) && + Objects.equals(this.nameservers, emailDomainDetails.nameservers) && + Objects.equals(this.spfRecord, emailDomainDetails.spfRecord) && + Objects.equals(this.dmarcRecord, emailDomainDetails.dmarcRecord) && + Objects.equals(this.mxRecords, emailDomainDetails.mxRecords); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, updatedAt, expiresAt, registrar, nameservers, spfRecord, dmarcRecord, mxRecords); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FilterAndRiskResponseEmailDomainDetails {\n"); + + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" expiresAt: ").append(toIndentedString(expiresAt)).append("\n"); + sb.append(" registrar: ").append(toIndentedString(registrar)).append("\n"); + sb.append(" nameservers: ").append(toIndentedString(nameservers)).append("\n"); + sb.append(" spfRecord: ").append(toIndentedString(spfRecord)).append("\n"); + sb.append(" dmarcRecord: ").append(toIndentedString(dmarcRecord)).append("\n"); + sb.append(" mxRecords: ").append(toIndentedString(mxRecords)).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/io/castle/client/model/generated/FilterAndRiskResponseEmailDomainDetailsMxRecords.java b/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseEmailDomainDetailsMxRecords.java new file mode 100755 index 0000000..eb8f688 --- /dev/null +++ b/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseEmailDomainDetailsMxRecords.java @@ -0,0 +1,87 @@ +/* + * Castle API + * ## Introduction **Just getting started? Check out our [quick start guide](https://docs.castle.io/docs/quickstart)** Castle APIs uses standard HTTP response codes, authentication and verbs. JSON is used as data exchange format, both for parsing incoming request bodies, and in the returned response. This means that the `Content-Type` header should to be set to `application/json` in requests with a body, such as `POST` or `PUT`. All API requests must be made over [HTTPS](http://en.wikipedia.org/wiki/HTTP_Secure). Non-HTTPS calls will fail and the **TLS version needs to be 1.1 or higher**. ## Supported types For a list of supported types, see our [Types Reference](https://docs.castle.io/docs/events). ## Rate limits Our APIs implement rate-limiting based on the number of requests made to them. Each request will return the following headers: - `X-RateLimit-Limit` - The maximum number of requests you're permitted to make in the current time window. - `X-RateLimit-Remaining` - The number of requests remaining in the current time window. - `X-RateLimit-Reset` - The remaining time in seconds until the current time window resets. Additionally, Our Risk, Filter (and the legacy Authenticate) APIs have a per-user-id rate limit of 6 requests per second and 10 requests per 5 seconds. + * + * OpenAPI spec version: 1 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.castle.client.model.generated; + +import com.google.gson.annotations.SerializedName; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; +/** + * FilterAndRiskResponseEmailDomainDetailsMxRecords + */ + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2025-01-20T18:58:06.855017776Z[GMT]") + +public class FilterAndRiskResponseEmailDomainDetailsMxRecords { + @SerializedName("null_mx") + private Boolean nullMx = null; + + public FilterAndRiskResponseEmailDomainDetailsMxRecords nullMx(Boolean nullMx) { + this.nullMx = nullMx; + return this; + } + + /** + * Get nullMx + * @return nullMx + **/ + @ApiModelProperty(example = "false", value = "") + public Boolean isNullMx() { + return nullMx; + } + + public void setNullMx(Boolean nullMx) { + this.nullMx = nullMx; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FilterAndRiskResponseEmailDomainDetailsMxRecords emailDomainDetailsMxRecords = (FilterAndRiskResponseEmailDomainDetailsMxRecords) o; + return Objects.equals(this.nullMx, emailDomainDetailsMxRecords.nullMx); + } + + @Override + public int hashCode() { + return Objects.hash(nullMx); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FilterAndRiskResponseEmailDomainDetailsMxRecords {\n"); + + sb.append(" nullMx: ").append(toIndentedString(nullMx)).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/io/castle/client/model/generated/FilterAndRiskResponseEmailDomainDetailsSpfRecord.java b/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseEmailDomainDetailsSpfRecord.java new file mode 100755 index 0000000..692b285 --- /dev/null +++ b/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseEmailDomainDetailsSpfRecord.java @@ -0,0 +1,87 @@ +/* + * Castle API + * ## Introduction **Just getting started? Check out our [quick start guide](https://docs.castle.io/docs/quickstart)** Castle APIs uses standard HTTP response codes, authentication and verbs. JSON is used as data exchange format, both for parsing incoming request bodies, and in the returned response. This means that the `Content-Type` header should to be set to `application/json` in requests with a body, such as `POST` or `PUT`. All API requests must be made over [HTTPS](http://en.wikipedia.org/wiki/HTTP_Secure). Non-HTTPS calls will fail and the **TLS version needs to be 1.1 or higher**. ## Supported types For a list of supported types, see our [Types Reference](https://docs.castle.io/docs/events). ## Rate limits Our APIs implement rate-limiting based on the number of requests made to them. Each request will return the following headers: - `X-RateLimit-Limit` - The maximum number of requests you're permitted to make in the current time window. - `X-RateLimit-Remaining` - The number of requests remaining in the current time window. - `X-RateLimit-Reset` - The remaining time in seconds until the current time window resets. Additionally, Our Risk, Filter (and the legacy Authenticate) APIs have a per-user-id rate limit of 6 requests per second and 10 requests per 5 seconds. + * + * OpenAPI spec version: 1 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.castle.client.model.generated; + +import com.google.gson.annotations.SerializedName; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; +/** + * FilterAndRiskResponseEmailDomainDetailsSpfRecord + */ + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2025-01-20T18:58:06.855017776Z[GMT]") + +public class FilterAndRiskResponseEmailDomainDetailsSpfRecord { + @SerializedName("exists") + private Boolean exists = null; + + public FilterAndRiskResponseEmailDomainDetailsSpfRecord exists(Boolean exists) { + this.exists = exists; + return this; + } + + /** + * Get exists + * @return exists + **/ + @ApiModelProperty(example = "false", value = "") + public Boolean isExists() { + return exists; + } + + public void setExists(Boolean exists) { + this.exists = exists; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FilterAndRiskResponseEmailDomainDetailsSpfRecord emailDomainDetailsSpfRecord = (FilterAndRiskResponseEmailDomainDetailsSpfRecord) o; + return Objects.equals(this.exists, emailDomainDetailsSpfRecord.exists); + } + + @Override + public int hashCode() { + return Objects.hash(exists); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FilterAndRiskResponseEmailDomainDetailsSpfRecord {\n"); + + sb.append(" exists: ").append(toIndentedString(exists)).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/io/castle/client/model/generated/FilterAndRiskResponseScores.java b/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseScores.java index 2d8d179..1d0ea42 100644 --- a/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseScores.java +++ b/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseScores.java @@ -1,6 +1,6 @@ /* * Castle API - * ## Introduction **Just getting started? Check out our [quick start guide](https://docs.castle.io/docs/quickstart)** Castle APIs uses standard HTTP response codes, authentication and verbs. JSON is used as data exchange format, both for parsing incoming request bodies, and in the returned response. This means that the `Content-Type` header should to be set to `application/json` in requests with a body, such as `POST` or `PUT`. All API requests must be made over [HTTPS](http://en.wikipedia.org/wiki/HTTP_Secure). Non-HTTPS calls will fail and the **TLS version needs to be 1.1 or higher**. ## Supported types For a list of supported types, see our [Types Reference](https://docs.castle.io/docs/events). ## Rate limits Our APIs implement rate-limiting based on the number of requests made to them. Each request will return the following headers: - `X-RateLimit-Limit` - The maximum number of requests you're permitted to make in the current time window. - `X-RateLimit-Remaining` - The number of requests remaining in the current time window. - `X-RateLimit-Reset` - The remaining time in seconds until the current time window resets. Additionally, Our Risk, Filter (and the legacy Authenticate) APIs have a per-user-id rate limit of 6 requests per second and 10 requests per 5 seconds. + * ## Introduction **Just getting started? Check out our [quick start guide](https://docs.castle.io/docs/quickstart)** Castle APIs uses standard HTTP response codes, authentication and verbs. JSON is used as data exchange format, both for parsing incoming request bodies, and in the returned response. This means that the `Content-Type` header should to be set to `application/json` in requests with a body, such as `POST` or `PUT`. All API requests must be made over [HTTPS](http://en.wikipedia.org/wiki/HTTP_Secure). Non-HTTPS calls will fail and the **TLS version needs to be 1.1 or higher**. ## Supported types For a list of supported types, see our [Types Reference](https://docs.castle.io/docs/events). ## Rate limits Our Risk, Log (and the legacy Authenticate) APIs have a per-user-id rate limit of 6 requests per second and 10 requests per 5 seconds. * * The version of the OpenAPI document: 1 * @@ -13,40 +13,30 @@ package io.castle.client.model.generated; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.castle.client.model.generated.FilterAndRiskResponseScoresAccountAbuse; -import io.castle.client.model.generated.FilterAndRiskResponseScoresAccountTakeover; -import io.castle.client.model.generated.FilterAndRiskResponseScoresBot; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; + +import java.util.Objects; /** - * Castle Scores breakdown. Calculated only when `request_token` and `context` are provided. + * FilterResponseScores */ -@ApiModel(description = "Castle Scores breakdown. Calculated only when `request_token` and `context` are provided.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-05T19:53:01.452316+01:00[Europe/Stockholm]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-09-05T12:03:37.030848+02:00[Europe/Stockholm]") public class FilterAndRiskResponseScores { public static final String SERIALIZED_NAME_ACCOUNT_ABUSE = "account_abuse"; @SerializedName(SERIALIZED_NAME_ACCOUNT_ABUSE) - private FilterAndRiskResponseScoresAccountAbuse accountAbuse; + private Score accountAbuse; public static final String SERIALIZED_NAME_ACCOUNT_TAKEOVER = "account_takeover"; @SerializedName(SERIALIZED_NAME_ACCOUNT_TAKEOVER) - private FilterAndRiskResponseScoresAccountTakeover accountTakeover; + private Score accountTakeover; public static final String SERIALIZED_NAME_BOT = "bot"; @SerializedName(SERIALIZED_NAME_BOT) - private FilterAndRiskResponseScoresBot bot; + private Score bot; - public FilterAndRiskResponseScores accountAbuse(FilterAndRiskResponseScoresAccountAbuse accountAbuse) { + public FilterAndRiskResponseScores accountAbuse(Score accountAbuse) { this.accountAbuse = accountAbuse; return this; @@ -59,17 +49,17 @@ public FilterAndRiskResponseScores accountAbuse(FilterAndRiskResponseScoresAccou @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "") - public FilterAndRiskResponseScoresAccountAbuse getAccountAbuse() { + public Score getAccountAbuse() { return accountAbuse; } - public void setAccountAbuse(FilterAndRiskResponseScoresAccountAbuse accountAbuse) { + public void setAccountAbuse(Score accountAbuse) { this.accountAbuse = accountAbuse; } - public FilterAndRiskResponseScores accountTakeover(FilterAndRiskResponseScoresAccountTakeover accountTakeover) { + public FilterAndRiskResponseScores accountTakeover(Score accountTakeover) { this.accountTakeover = accountTakeover; return this; @@ -82,17 +72,17 @@ public FilterAndRiskResponseScores accountTakeover(FilterAndRiskResponseScoresAc @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "") - public FilterAndRiskResponseScoresAccountTakeover getAccountTakeover() { + public Score getAccountTakeover() { return accountTakeover; } - public void setAccountTakeover(FilterAndRiskResponseScoresAccountTakeover accountTakeover) { + public void setAccountTakeover(Score accountTakeover) { this.accountTakeover = accountTakeover; } - public FilterAndRiskResponseScores bot(FilterAndRiskResponseScoresBot bot) { + public FilterAndRiskResponseScores bot(Score bot) { this.bot = bot; return this; @@ -105,12 +95,12 @@ public FilterAndRiskResponseScores bot(FilterAndRiskResponseScoresBot bot) { @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "") - public FilterAndRiskResponseScoresBot getBot() { + public Score getBot() { return bot; } - public void setBot(FilterAndRiskResponseScoresBot bot) { + public void setBot(Score bot) { this.bot = bot; } @@ -123,10 +113,10 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - FilterAndRiskResponseScores filterAndRiskResponseScores = (FilterAndRiskResponseScores) o; - return Objects.equals(this.accountAbuse, filterAndRiskResponseScores.accountAbuse) && - Objects.equals(this.accountTakeover, filterAndRiskResponseScores.accountTakeover) && - Objects.equals(this.bot, filterAndRiskResponseScores.bot); + FilterAndRiskResponseScores scores = (FilterAndRiskResponseScores) o; + return Objects.equals(this.accountAbuse, scores.accountAbuse) && + Objects.equals(this.accountTakeover, scores.accountTakeover) && + Objects.equals(this.bot, scores.bot); } @Override @@ -137,7 +127,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class FilterAndRiskResponseScores {\n"); + sb.append("class FilterResponseScores {\n"); sb.append(" accountAbuse: ").append(toIndentedString(accountAbuse)).append("\n"); sb.append(" accountTakeover: ").append(toIndentedString(accountTakeover)).append("\n"); sb.append(" bot: ").append(toIndentedString(bot)).append("\n"); diff --git a/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseScoresAccountAbuse.java b/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseScoresAccountAbuse.java old mode 100644 new mode 100755 index 9d48f72..e3a015f --- a/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseScoresAccountAbuse.java +++ b/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseScoresAccountAbuse.java @@ -2,48 +2,42 @@ * Castle API * ## Introduction **Just getting started? Check out our [quick start guide](https://docs.castle.io/docs/quickstart)** Castle APIs uses standard HTTP response codes, authentication and verbs. JSON is used as data exchange format, both for parsing incoming request bodies, and in the returned response. This means that the `Content-Type` header should to be set to `application/json` in requests with a body, such as `POST` or `PUT`. All API requests must be made over [HTTPS](http://en.wikipedia.org/wiki/HTTP_Secure). Non-HTTPS calls will fail and the **TLS version needs to be 1.1 or higher**. ## Supported types For a list of supported types, see our [Types Reference](https://docs.castle.io/docs/events). ## Rate limits Our APIs implement rate-limiting based on the number of requests made to them. Each request will return the following headers: - `X-RateLimit-Limit` - The maximum number of requests you're permitted to make in the current time window. - `X-RateLimit-Remaining` - The number of requests remaining in the current time window. - `X-RateLimit-Reset` - The remaining time in seconds until the current time window resets. Additionally, Our Risk, Filter (and the legacy Authenticate) APIs have a per-user-id rate limit of 6 requests per second and 10 requests per 5 seconds. * - * The version of the OpenAPI document: 1 + * OpenAPI spec version: 1 * * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ - package io.castle.client.model.generated; import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModelProperty; import java.util.Objects; - /** * FilterAndRiskResponseScoresAccountAbuse */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-05T19:53:01.452316+01:00[Europe/Stockholm]") + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2025-01-20T18:58:06.855017776Z[GMT]") + public class FilterAndRiskResponseScoresAccountAbuse { - public static final String SERIALIZED_NAME_SCORE = "score"; - @SerializedName(SERIALIZED_NAME_SCORE) + @SerializedName("score") private double score; - /** * Calculated Account Abuse Risk Score. * minimum: 0 * maximum: 1 * @return score **/ - @javax.annotation.Nonnull @ApiModelProperty(example = "0.65", required = true, value = "Calculated Account Abuse Risk Score.") - public double getScore() { return score; } - - @Override public boolean equals(Object o) { if (this == o) { @@ -52,8 +46,8 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - FilterAndRiskResponseScoresAccountAbuse filterAndRiskResponseScoresAccountAbuse = (FilterAndRiskResponseScoresAccountAbuse) o; - return Objects.equals(this.score, filterAndRiskResponseScoresAccountAbuse.score); + FilterAndRiskResponseScoresAccountAbuse scoresAccountAbuse = (FilterAndRiskResponseScoresAccountAbuse) o; + return Objects.equals(this.score, scoresAccountAbuse.score); } @Override @@ -61,10 +55,12 @@ public int hashCode() { return Objects.hash(score); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class FilterAndRiskResponseScoresAccountAbuse {\n"); + sb.append(" score: ").append(toIndentedString(score)).append("\n"); sb.append("}"); return sb.toString(); @@ -82,4 +78,3 @@ private String toIndentedString(Object o) { } } - diff --git a/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseScoresAccountTakeover.java b/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseScoresAccountTakeover.java old mode 100644 new mode 100755 index 4f04b56..6065b8f --- a/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseScoresAccountTakeover.java +++ b/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseScoresAccountTakeover.java @@ -2,48 +2,42 @@ * Castle API * ## Introduction **Just getting started? Check out our [quick start guide](https://docs.castle.io/docs/quickstart)** Castle APIs uses standard HTTP response codes, authentication and verbs. JSON is used as data exchange format, both for parsing incoming request bodies, and in the returned response. This means that the `Content-Type` header should to be set to `application/json` in requests with a body, such as `POST` or `PUT`. All API requests must be made over [HTTPS](http://en.wikipedia.org/wiki/HTTP_Secure). Non-HTTPS calls will fail and the **TLS version needs to be 1.1 or higher**. ## Supported types For a list of supported types, see our [Types Reference](https://docs.castle.io/docs/events). ## Rate limits Our APIs implement rate-limiting based on the number of requests made to them. Each request will return the following headers: - `X-RateLimit-Limit` - The maximum number of requests you're permitted to make in the current time window. - `X-RateLimit-Remaining` - The number of requests remaining in the current time window. - `X-RateLimit-Reset` - The remaining time in seconds until the current time window resets. Additionally, Our Risk, Filter (and the legacy Authenticate) APIs have a per-user-id rate limit of 6 requests per second and 10 requests per 5 seconds. * - * The version of the OpenAPI document: 1 + * OpenAPI spec version: 1 * * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ - package io.castle.client.model.generated; import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModelProperty; import java.util.Objects; - /** * FilterAndRiskResponseScoresAccountTakeover */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-05T19:53:01.452316+01:00[Europe/Stockholm]") + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2025-01-20T18:58:06.855017776Z[GMT]") + public class FilterAndRiskResponseScoresAccountTakeover { - public static final String SERIALIZED_NAME_SCORE = "score"; - @SerializedName(SERIALIZED_NAME_SCORE) + @SerializedName("score") private double score; - /** * Calculated Account Takeover Risk Score. * minimum: 0 * maximum: 1 * @return score **/ - @javax.annotation.Nonnull @ApiModelProperty(example = "0.77", required = true, value = "Calculated Account Takeover Risk Score.") - public double getScore() { return score; } - - @Override public boolean equals(Object o) { if (this == o) { @@ -52,8 +46,8 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - FilterAndRiskResponseScoresAccountTakeover filterAndRiskResponseScoresAccountTakeover = (FilterAndRiskResponseScoresAccountTakeover) o; - return Objects.equals(this.score, filterAndRiskResponseScoresAccountTakeover.score); + FilterAndRiskResponseScoresAccountTakeover scoresAccountTakeover = (FilterAndRiskResponseScoresAccountTakeover) o; + return Objects.equals(this.score, scoresAccountTakeover.score); } @Override @@ -61,10 +55,12 @@ public int hashCode() { return Objects.hash(score); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class FilterAndRiskResponseScoresAccountTakeover {\n"); + sb.append(" score: ").append(toIndentedString(score)).append("\n"); sb.append("}"); return sb.toString(); @@ -82,4 +78,3 @@ private String toIndentedString(Object o) { } } - diff --git a/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseScoresBot.java b/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseScoresBot.java old mode 100644 new mode 100755 index 91d1041..8b8f678 --- a/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseScoresBot.java +++ b/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseScoresBot.java @@ -2,48 +2,42 @@ * Castle API * ## Introduction **Just getting started? Check out our [quick start guide](https://docs.castle.io/docs/quickstart)** Castle APIs uses standard HTTP response codes, authentication and verbs. JSON is used as data exchange format, both for parsing incoming request bodies, and in the returned response. This means that the `Content-Type` header should to be set to `application/json` in requests with a body, such as `POST` or `PUT`. All API requests must be made over [HTTPS](http://en.wikipedia.org/wiki/HTTP_Secure). Non-HTTPS calls will fail and the **TLS version needs to be 1.1 or higher**. ## Supported types For a list of supported types, see our [Types Reference](https://docs.castle.io/docs/events). ## Rate limits Our APIs implement rate-limiting based on the number of requests made to them. Each request will return the following headers: - `X-RateLimit-Limit` - The maximum number of requests you're permitted to make in the current time window. - `X-RateLimit-Remaining` - The number of requests remaining in the current time window. - `X-RateLimit-Reset` - The remaining time in seconds until the current time window resets. Additionally, Our Risk, Filter (and the legacy Authenticate) APIs have a per-user-id rate limit of 6 requests per second and 10 requests per 5 seconds. * - * The version of the OpenAPI document: 1 + * OpenAPI spec version: 1 * * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ - package io.castle.client.model.generated; import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModelProperty; import java.util.Objects; - /** * FilterAndRiskResponseScoresBot */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-05T19:53:01.452316+01:00[Europe/Stockholm]") + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2025-01-20T18:58:06.855017776Z[GMT]") + public class FilterAndRiskResponseScoresBot { - public static final String SERIALIZED_NAME_SCORE = "score"; - @SerializedName(SERIALIZED_NAME_SCORE) + @SerializedName("score") private double score; - /** * Calculated Bot Risk Score. * minimum: 0 * maximum: 1 * @return score **/ - @javax.annotation.Nonnull @ApiModelProperty(example = "0.34", required = true, value = "Calculated Bot Risk Score.") - public double getScore() { return score; } - - @Override public boolean equals(Object o) { if (this == o) { @@ -52,8 +46,8 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - FilterAndRiskResponseScoresBot filterAndRiskResponseScoresBot = (FilterAndRiskResponseScoresBot) o; - return Objects.equals(this.score, filterAndRiskResponseScoresBot.score); + FilterAndRiskResponseScoresBot scoresBot = (FilterAndRiskResponseScoresBot) o; + return Objects.equals(this.score, scoresBot.score); } @Override @@ -61,10 +55,12 @@ public int hashCode() { return Objects.hash(score); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class FilterAndRiskResponseScoresBot {\n"); + sb.append(" score: ").append(toIndentedString(score)).append("\n"); sb.append("}"); return sb.toString(); @@ -82,4 +78,3 @@ private String toIndentedString(Object o) { } } - diff --git a/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseSdks.java b/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseSdks.java old mode 100644 new mode 100755 index 8a63262..6bd21e1 --- a/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseSdks.java +++ b/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseSdks.java @@ -2,47 +2,35 @@ * Castle API * ## Introduction **Just getting started? Check out our [quick start guide](https://docs.castle.io/docs/quickstart)** Castle APIs uses standard HTTP response codes, authentication and verbs. JSON is used as data exchange format, both for parsing incoming request bodies, and in the returned response. This means that the `Content-Type` header should to be set to `application/json` in requests with a body, such as `POST` or `PUT`. All API requests must be made over [HTTPS](http://en.wikipedia.org/wiki/HTTP_Secure). Non-HTTPS calls will fail and the **TLS version needs to be 1.1 or higher**. ## Supported types For a list of supported types, see our [Types Reference](https://docs.castle.io/docs/events). ## Rate limits Our APIs implement rate-limiting based on the number of requests made to them. Each request will return the following headers: - `X-RateLimit-Limit` - The maximum number of requests you're permitted to make in the current time window. - `X-RateLimit-Remaining` - The number of requests remaining in the current time window. - `X-RateLimit-Reset` - The remaining time in seconds until the current time window resets. Additionally, Our Risk, Filter (and the legacy Authenticate) APIs have a per-user-id rate limit of 6 requests per second and 10 requests per 5 seconds. * - * The version of the OpenAPI document: 1 + * OpenAPI spec version: 1 * * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ - package io.castle.client.model.generated; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.castle.client.model.generated.FilterAndRiskResponseSdksClient; -import io.castle.client.model.generated.FilterAndRiskResponseSdksServer; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; +import java.util.Objects; /** * Castle SDKs details */ -@ApiModel(description = "Castle SDKs details") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-05T19:53:01.452316+01:00[Europe/Stockholm]") -public class FilterAndRiskResponseSdks { - public static final String SERIALIZED_NAME_CLIENT = "client"; - @SerializedName(SERIALIZED_NAME_CLIENT) - private FilterAndRiskResponseSdksClient client; +@ApiModel(value = "Castle SDKs details") +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2025-01-20T18:58:06.855017776Z[GMT]") - public static final String SERIALIZED_NAME_SERVER = "server"; - @SerializedName(SERIALIZED_NAME_SERVER) - private FilterAndRiskResponseSdksServer server; +public class FilterAndRiskResponseSdks { + @SerializedName("client") + private FilterAndRiskResponseSdksClient client = null; + @SerializedName("server") + private FilterAndRiskResponseSdksServer server = null; public FilterAndRiskResponseSdks client(FilterAndRiskResponseSdksClient client) { - this.client = client; return this; } @@ -51,21 +39,16 @@ public FilterAndRiskResponseSdks client(FilterAndRiskResponseSdksClient client) * Get client * @return client **/ - @javax.annotation.Nullable @ApiModelProperty(value = "") - public FilterAndRiskResponseSdksClient getClient() { return client; } - public void setClient(FilterAndRiskResponseSdksClient client) { this.client = client; } - public FilterAndRiskResponseSdks server(FilterAndRiskResponseSdksServer server) { - this.server = server; return this; } @@ -74,14 +57,11 @@ public FilterAndRiskResponseSdks server(FilterAndRiskResponseSdksServer server) * Get server * @return server **/ - @javax.annotation.Nullable @ApiModelProperty(value = "") - public FilterAndRiskResponseSdksServer getServer() { return server; } - public void setServer(FilterAndRiskResponseSdksServer server) { this.server = server; } @@ -95,9 +75,9 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - FilterAndRiskResponseSdks filterAndRiskResponseSdks = (FilterAndRiskResponseSdks) o; - return Objects.equals(this.client, filterAndRiskResponseSdks.client) && - Objects.equals(this.server, filterAndRiskResponseSdks.server); + FilterAndRiskResponseSdks sdks = (FilterAndRiskResponseSdks) o; + return Objects.equals(this.client, sdks.client) && + Objects.equals(this.server, sdks.server); } @Override @@ -105,10 +85,12 @@ public int hashCode() { return Objects.hash(client, server); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class FilterAndRiskResponseSdks {\n"); + sb.append(" client: ").append(toIndentedString(client)).append("\n"); sb.append(" server: ").append(toIndentedString(server)).append("\n"); sb.append("}"); @@ -127,4 +109,3 @@ private String toIndentedString(Object o) { } } - diff --git a/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseSdksClient.java b/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseSdksClient.java old mode 100644 new mode 100755 index 13332ed..44ac474 --- a/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseSdksClient.java +++ b/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseSdksClient.java @@ -2,44 +2,34 @@ * Castle API * ## Introduction **Just getting started? Check out our [quick start guide](https://docs.castle.io/docs/quickstart)** Castle APIs uses standard HTTP response codes, authentication and verbs. JSON is used as data exchange format, both for parsing incoming request bodies, and in the returned response. This means that the `Content-Type` header should to be set to `application/json` in requests with a body, such as `POST` or `PUT`. All API requests must be made over [HTTPS](http://en.wikipedia.org/wiki/HTTP_Secure). Non-HTTPS calls will fail and the **TLS version needs to be 1.1 or higher**. ## Supported types For a list of supported types, see our [Types Reference](https://docs.castle.io/docs/events). ## Rate limits Our APIs implement rate-limiting based on the number of requests made to them. Each request will return the following headers: - `X-RateLimit-Limit` - The maximum number of requests you're permitted to make in the current time window. - `X-RateLimit-Remaining` - The number of requests remaining in the current time window. - `X-RateLimit-Reset` - The remaining time in seconds until the current time window resets. Additionally, Our Risk, Filter (and the legacy Authenticate) APIs have a per-user-id rate limit of 6 requests per second and 10 requests per 5 seconds. * - * The version of the OpenAPI document: 1 + * OpenAPI spec version: 1 * * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ - package io.castle.client.model.generated; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; +import java.util.Objects; /** * FilterAndRiskResponseSdksClient */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-05T19:53:01.452316+01:00[Europe/Stockholm]") -public class FilterAndRiskResponseSdksClient { - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - public static final String SERIALIZED_NAME_VERSION = "version"; - @SerializedName(SERIALIZED_NAME_VERSION) - private String version; +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2025-01-20T18:58:06.855017776Z[GMT]") +public class FilterAndRiskResponseSdksClient { + @SerializedName("name") + private String name = null; + + @SerializedName("version") + private String version = null; public FilterAndRiskResponseSdksClient name(String name) { - this.name = name; return this; } @@ -48,21 +38,16 @@ public FilterAndRiskResponseSdksClient name(String name) { * Get name * @return name **/ - @javax.annotation.Nullable @ApiModelProperty(example = "castle-web", value = "") - public String getName() { return name; } - public void setName(String name) { this.name = name; } - public FilterAndRiskResponseSdksClient version(String version) { - this.version = version; return this; } @@ -71,14 +56,11 @@ public FilterAndRiskResponseSdksClient version(String version) { * Get version * @return version **/ - @javax.annotation.Nullable @ApiModelProperty(example = "2.0.0", value = "") - public String getVersion() { return version; } - public void setVersion(String version) { this.version = version; } @@ -92,9 +74,9 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - FilterAndRiskResponseSdksClient filterAndRiskResponseSdksClient = (FilterAndRiskResponseSdksClient) o; - return Objects.equals(this.name, filterAndRiskResponseSdksClient.name) && - Objects.equals(this.version, filterAndRiskResponseSdksClient.version); + FilterAndRiskResponseSdksClient sdksClient = (FilterAndRiskResponseSdksClient) o; + return Objects.equals(this.name, sdksClient.name) && + Objects.equals(this.version, sdksClient.version); } @Override @@ -102,10 +84,12 @@ public int hashCode() { return Objects.hash(name, version); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class FilterAndRiskResponseSdksClient {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" version: ").append(toIndentedString(version)).append("\n"); sb.append("}"); @@ -124,4 +108,3 @@ private String toIndentedString(Object o) { } } - diff --git a/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseSdksServer.java b/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseSdksServer.java old mode 100644 new mode 100755 index 58a965f..7a076e8 --- a/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseSdksServer.java +++ b/src/main/java/io/castle/client/model/generated/FilterAndRiskResponseSdksServer.java @@ -2,44 +2,34 @@ * Castle API * ## Introduction **Just getting started? Check out our [quick start guide](https://docs.castle.io/docs/quickstart)** Castle APIs uses standard HTTP response codes, authentication and verbs. JSON is used as data exchange format, both for parsing incoming request bodies, and in the returned response. This means that the `Content-Type` header should to be set to `application/json` in requests with a body, such as `POST` or `PUT`. All API requests must be made over [HTTPS](http://en.wikipedia.org/wiki/HTTP_Secure). Non-HTTPS calls will fail and the **TLS version needs to be 1.1 or higher**. ## Supported types For a list of supported types, see our [Types Reference](https://docs.castle.io/docs/events). ## Rate limits Our APIs implement rate-limiting based on the number of requests made to them. Each request will return the following headers: - `X-RateLimit-Limit` - The maximum number of requests you're permitted to make in the current time window. - `X-RateLimit-Remaining` - The number of requests remaining in the current time window. - `X-RateLimit-Reset` - The remaining time in seconds until the current time window resets. Additionally, Our Risk, Filter (and the legacy Authenticate) APIs have a per-user-id rate limit of 6 requests per second and 10 requests per 5 seconds. * - * The version of the OpenAPI document: 1 + * OpenAPI spec version: 1 * * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ - package io.castle.client.model.generated; -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; +import java.util.Objects; /** * FilterAndRiskResponseSdksServer */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-05T19:53:01.452316+01:00[Europe/Stockholm]") -public class FilterAndRiskResponseSdksServer { - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - public static final String SERIALIZED_NAME_VERSION = "version"; - @SerializedName(SERIALIZED_NAME_VERSION) - private String version; +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2025-01-20T18:58:06.855017776Z[GMT]") +public class FilterAndRiskResponseSdksServer { + @SerializedName("name") + private String name = null; + + @SerializedName("version") + private String version = null; public FilterAndRiskResponseSdksServer name(String name) { - this.name = name; return this; } @@ -48,21 +38,16 @@ public FilterAndRiskResponseSdksServer name(String name) { * Get name * @return name **/ - @javax.annotation.Nullable @ApiModelProperty(example = "castle-postman", value = "") - public String getName() { return name; } - public void setName(String name) { this.name = name; } - public FilterAndRiskResponseSdksServer version(String version) { - this.version = version; return this; } @@ -71,14 +56,11 @@ public FilterAndRiskResponseSdksServer version(String version) { * Get version * @return version **/ - @javax.annotation.Nullable @ApiModelProperty(example = "0.1.0", value = "") - public String getVersion() { return version; } - public void setVersion(String version) { this.version = version; } @@ -92,9 +74,9 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - FilterAndRiskResponseSdksServer filterAndRiskResponseSdksServer = (FilterAndRiskResponseSdksServer) o; - return Objects.equals(this.name, filterAndRiskResponseSdksServer.name) && - Objects.equals(this.version, filterAndRiskResponseSdksServer.version); + FilterAndRiskResponseSdksServer sdksServer = (FilterAndRiskResponseSdksServer) o; + return Objects.equals(this.name, sdksServer.name) && + Objects.equals(this.version, sdksServer.version); } @Override @@ -102,10 +84,12 @@ public int hashCode() { return Objects.hash(name, version); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class FilterAndRiskResponseSdksServer {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" version: ").append(toIndentedString(version)).append("\n"); sb.append("}"); @@ -124,4 +108,3 @@ private String toIndentedString(Object o) { } } - diff --git a/src/main/java/io/castle/client/model/generated/IP.java b/src/main/java/io/castle/client/model/generated/IP.java old mode 100644 new mode 100755 index ba31279..42dc2a3 --- a/src/main/java/io/castle/client/model/generated/IP.java +++ b/src/main/java/io/castle/client/model/generated/IP.java @@ -2,129 +2,64 @@ * Castle API * ## Introduction **Just getting started? Check out our [quick start guide](https://docs.castle.io/docs/quickstart)** Castle APIs uses standard HTTP response codes, authentication and verbs. JSON is used as data exchange format, both for parsing incoming request bodies, and in the returned response. This means that the `Content-Type` header should to be set to `application/json` in requests with a body, such as `POST` or `PUT`. All API requests must be made over [HTTPS](http://en.wikipedia.org/wiki/HTTP_Secure). Non-HTTPS calls will fail and the **TLS version needs to be 1.1 or higher**. ## Supported types For a list of supported types, see our [Types Reference](https://docs.castle.io/docs/events). ## Rate limits Our APIs implement rate-limiting based on the number of requests made to them. Each request will return the following headers: - `X-RateLimit-Limit` - The maximum number of requests you're permitted to make in the current time window. - `X-RateLimit-Remaining` - The number of requests remaining in the current time window. - `X-RateLimit-Reset` - The remaining time in seconds until the current time window resets. Additionally, Our Risk, Filter (and the legacy Authenticate) APIs have a per-user-id rate limit of 6 requests per second and 10 requests per 5 seconds. * - * The version of the OpenAPI document: 1 + * OpenAPI spec version: 1 * * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ - package io.castle.client.model.generated; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; import java.util.Objects; - /** * IP */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-05T19:53:01.452316+01:00[Europe/Stockholm]") -public class IP { - public static final String SERIALIZED_NAME_CONNECTION = "connection"; - @SerializedName(SERIALIZED_NAME_CONNECTION) - private IPConnection connection; - public static final String SERIALIZED_NAME_LOCATION = "location"; - @SerializedName(SERIALIZED_NAME_LOCATION) - private IPLocation location; - - /** - * Gets or Sets tags - */ - @JsonAdapter(TagsEnum.Adapter.class) - public enum TagsEnum { - DATACENTER("datacenter"), - - TOR("tor"), - - PROXY("proxy"); - - private String value; - - TagsEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2025-01-20T18:58:06.855017776Z[GMT]") - public static TagsEnum fromValue(String value) { - for (TagsEnum b : TagsEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } +public class IP { + @SerializedName("asn") + private Integer asn = null; - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final TagsEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public TagsEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return TagsEnum.fromValue(value); - } - } - } + @SerializedName("location") + private IPLocation location = null; - public static final String SERIALIZED_NAME_TAGS = "tags"; - @SerializedName(SERIALIZED_NAME_TAGS) - private List tags = new ArrayList(); + @SerializedName("address") + private String address = null; - public static final String SERIALIZED_NAME_VALUE = "value"; - @SerializedName(SERIALIZED_NAME_VALUE) - private String value; + @SerializedName("isp") + private IPIsp isp = null; - public static final String SERIALIZED_NAME_COORDINATES = "coordinates"; - @SerializedName(SERIALIZED_NAME_COORDINATES) - private Coordinates coordinates; + @SerializedName("type") + private String type = null; + @SerializedName("privacy") + private IPPrivacy privacy = null; - public IP connection(IPConnection connection) { - - this.connection = connection; + public IP asn(Integer asn) { + this.asn = asn; return this; } /** - * Get connection - * @return connection + * Get asn + * @return asn **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - - public IPConnection getConnection() { - return connection; + @ApiModelProperty(example = "14618", required = true, value = "") + public int getAsn() { + return asn; } - - public void setConnection(IPConnection connection) { - this.connection = connection; + public void setAsn(int asn) { + this.asn = asn; } - public IP location(IPLocation location) { - this.location = location; return this; } @@ -133,90 +68,85 @@ public IP location(IPLocation location) { * Get location * @return location **/ - @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "") - public IPLocation getLocation() { return location; } - public void setLocation(IPLocation location) { this.location = location; } - - public IP tags(List tags) { - - this.tags = tags; - return this; - } - - public IP addTagsItem(TagsEnum tagsItem) { - this.tags.add(tagsItem); + public IP address(String address) { + this.address = address; return this; } /** - * Get tags - * @return tags + * Get address + * @return address **/ - @javax.annotation.Nonnull - @ApiModelProperty(example = "[\"datacenter\"]", required = true, value = "") - - public List getTags() { - return tags; + @ApiModelProperty(example = "34.200.81.5", required = true, value = "") + public String getAddress() { + return address; } - - public void setTags(List tags) { - this.tags = tags; + public void setAddress(String address) { + this.address = address; } - - public IP value(String value) { - - this.value = value; + public IP isp(IPIsp isp) { + this.isp = isp; return this; } /** - * Get value - * @return value + * Get isp + * @return isp **/ - @javax.annotation.Nonnull - @ApiModelProperty(example = "34.200.81.5", required = true, value = "") + @ApiModelProperty(required = true, value = "") + public IPIsp getIsp() { + return isp; + } - public String getValue() { - return value; + public void setIsp(IPIsp isp) { + this.isp = isp; } + public IP type(String type) { + this.type = type; + return this; + } - public void setValue(String value) { - this.value = value; + /** + * Get type + * @return type + **/ + @ApiModelProperty(example = "ipv4", required = true, value = "") + public String getType() { + return type; } + public void setType(String type) { + this.type = type; + } - public IP coordinates(Coordinates coordinates) { - - this.coordinates = coordinates; + public IP privacy(IPPrivacy privacy) { + this.privacy = privacy; return this; } /** - * Get coordinates - * @return coordinates + * Get privacy + * @return privacy **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - - public Coordinates getCoordinates() { - return coordinates; + @ApiModelProperty(value = "") + public IPPrivacy getPrivacy() { + return privacy; } - - public void setCoordinates(Coordinates coordinates) { - this.coordinates = coordinates; + public void setPrivacy(IPPrivacy privacy) { + this.privacy = privacy; } @@ -229,27 +159,30 @@ public boolean equals(Object o) { return false; } IP IP = (IP) o; - return Objects.equals(this.connection, IP.connection) && + return Objects.equals(this.asn, IP.asn) && Objects.equals(this.location, IP.location) && - Objects.equals(this.tags, IP.tags) && - Objects.equals(this.value, IP.value) && - Objects.equals(this.coordinates, IP.coordinates); + Objects.equals(this.address, IP.address) && + Objects.equals(this.isp, IP.isp) && + Objects.equals(this.type, IP.type) && + Objects.equals(this.privacy, IP.privacy); } @Override public int hashCode() { - return Objects.hash(connection, location, tags, value, coordinates); + return Objects.hash(asn, location, address, isp, type, privacy); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class IP {\n"); - sb.append(" connection: ").append(toIndentedString(connection)).append("\n"); + sb.append(" asn: ").append(toIndentedString(asn)).append("\n"); sb.append(" location: ").append(toIndentedString(location)).append("\n"); - sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); - sb.append(" value: ").append(toIndentedString(value)).append("\n"); - sb.append(" coordinates: ").append(toIndentedString(coordinates)).append("\n"); + sb.append(" address: ").append(toIndentedString(address)).append("\n"); + sb.append(" isp: ").append(toIndentedString(isp)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" privacy: ").append(toIndentedString(privacy)).append("\n"); sb.append("}"); return sb.toString(); } @@ -266,4 +199,3 @@ private String toIndentedString(Object o) { } } - diff --git a/src/main/java/io/castle/client/model/generated/IPConnection.java b/src/main/java/io/castle/client/model/generated/IPIsp.java old mode 100644 new mode 100755 similarity index 64% rename from src/main/java/io/castle/client/model/generated/IPConnection.java rename to src/main/java/io/castle/client/model/generated/IPIsp.java index 345a0e8..7eccb15 --- a/src/main/java/io/castle/client/model/generated/IPConnection.java +++ b/src/main/java/io/castle/client/model/generated/IPIsp.java @@ -2,61 +2,52 @@ * Castle API * ## Introduction **Just getting started? Check out our [quick start guide](https://docs.castle.io/docs/quickstart)** Castle APIs uses standard HTTP response codes, authentication and verbs. JSON is used as data exchange format, both for parsing incoming request bodies, and in the returned response. This means that the `Content-Type` header should to be set to `application/json` in requests with a body, such as `POST` or `PUT`. All API requests must be made over [HTTPS](http://en.wikipedia.org/wiki/HTTP_Secure). Non-HTTPS calls will fail and the **TLS version needs to be 1.1 or higher**. ## Supported types For a list of supported types, see our [Types Reference](https://docs.castle.io/docs/events). ## Rate limits Our APIs implement rate-limiting based on the number of requests made to them. Each request will return the following headers: - `X-RateLimit-Limit` - The maximum number of requests you're permitted to make in the current time window. - `X-RateLimit-Remaining` - The number of requests remaining in the current time window. - `X-RateLimit-Reset` - The remaining time in seconds until the current time window resets. Additionally, Our Risk, Filter (and the legacy Authenticate) APIs have a per-user-id rate limit of 6 requests per second and 10 requests per 5 seconds. * - * The version of the OpenAPI document: 1 + * OpenAPI spec version: 1 * * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ - package io.castle.client.model.generated; import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModelProperty; import java.util.Objects; - /** - * IPConnection + * IPIsp */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-05T19:53:01.452316+01:00[Europe/Stockholm]") -public class IPConnection { - public static final String SERIALIZED_NAME_ASN = "asn"; - @SerializedName(SERIALIZED_NAME_ASN) - private Integer asn; - public static final String SERIALIZED_NAME_ORGANIZATION = "organization"; - @SerializedName(SERIALIZED_NAME_ORGANIZATION) - private String organization; +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2025-01-20T18:58:06.855017776Z[GMT]") + +public class IPIsp { + @SerializedName("name") + private String name = null; + @SerializedName("organization") + private String organization = null; - public IPConnection asn(Integer asn) { - - this.asn = asn; + public IPIsp name(String name) { + this.name = name; return this; } /** - * Get asn - * @return asn + * Get name + * @return name **/ - @javax.annotation.Nonnull - @ApiModelProperty(example = "14618", required = true, value = "") - - public Integer getAsn() { - return asn; + @ApiModelProperty(example = "verizon fios", value = "") + public String getName() { + return name; } - - public void setAsn(Integer asn) { - this.asn = asn; + public void setName(String name) { + this.name = name; } - - public IPConnection organization(String organization) { - + public IPIsp organization(String organization) { this.organization = organization; return this; } @@ -65,14 +56,11 @@ public IPConnection organization(String organization) { * Get organization * @return organization **/ - @javax.annotation.Nonnull - @ApiModelProperty(example = "Amazon.com", required = true, value = "") - + @ApiModelProperty(example = "verizon fios", value = "") public String getOrganization() { return organization; } - public void setOrganization(String organization) { this.organization = organization; } @@ -86,21 +74,22 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - IPConnection ipConnection = (IPConnection) o; - return Objects.equals(this.asn, ipConnection.asn) && - Objects.equals(this.organization, ipConnection.organization); + IPIsp ipIsp = (IPIsp) o; + return Objects.equals(this.name, ipIsp.name) && + Objects.equals(this.organization, ipIsp.organization); } @Override public int hashCode() { - return Objects.hash(asn, organization); + return Objects.hash(name, organization); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class IPConnection {\n"); - sb.append(" asn: ").append(toIndentedString(asn)).append("\n"); + sb.append("class IPIsp {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" organization: ").append(toIndentedString(organization)).append("\n"); sb.append("}"); return sb.toString(); @@ -118,4 +107,3 @@ private String toIndentedString(Object o) { } } - diff --git a/src/main/java/io/castle/client/model/generated/IPLocation.java b/src/main/java/io/castle/client/model/generated/IPLocation.java old mode 100644 new mode 100755 index 8238858..4661691 --- a/src/main/java/io/castle/client/model/generated/IPLocation.java +++ b/src/main/java/io/castle/client/model/generated/IPLocation.java @@ -2,50 +2,49 @@ * Castle API * ## Introduction **Just getting started? Check out our [quick start guide](https://docs.castle.io/docs/quickstart)** Castle APIs uses standard HTTP response codes, authentication and verbs. JSON is used as data exchange format, both for parsing incoming request bodies, and in the returned response. This means that the `Content-Type` header should to be set to `application/json` in requests with a body, such as `POST` or `PUT`. All API requests must be made over [HTTPS](http://en.wikipedia.org/wiki/HTTP_Secure). Non-HTTPS calls will fail and the **TLS version needs to be 1.1 or higher**. ## Supported types For a list of supported types, see our [Types Reference](https://docs.castle.io/docs/events). ## Rate limits Our APIs implement rate-limiting based on the number of requests made to them. Each request will return the following headers: - `X-RateLimit-Limit` - The maximum number of requests you're permitted to make in the current time window. - `X-RateLimit-Remaining` - The number of requests remaining in the current time window. - `X-RateLimit-Reset` - The remaining time in seconds until the current time window resets. Additionally, Our Risk, Filter (and the legacy Authenticate) APIs have a per-user-id rate limit of 6 requests per second and 10 requests per 5 seconds. * - * The version of the OpenAPI document: 1 + * OpenAPI spec version: 1 * * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ - package io.castle.client.model.generated; import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModelProperty; import java.util.Objects; - /** * IPLocation */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-05T19:53:01.452316+01:00[Europe/Stockholm]") + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2025-01-20T18:58:06.855017776Z[GMT]") + public class IPLocation { - public static final String SERIALIZED_NAME_CITY = "city"; - @SerializedName(SERIALIZED_NAME_CITY) - private String city; + @SerializedName("city") + private String city = null; + + @SerializedName("continent_code") + private String continentCode = null; - public static final String SERIALIZED_NAME_CONTINENT_CODE = "continent_code"; - @SerializedName(SERIALIZED_NAME_CONTINENT_CODE) - private String continentCode; + @SerializedName("country_code") + private String countryCode = null; - public static final String SERIALIZED_NAME_COUNTRY_CODE = "country_code"; - @SerializedName(SERIALIZED_NAME_COUNTRY_CODE) - private String countryCode; + @SerializedName("postal_code") + private String postalCode = null; - public static final String SERIALIZED_NAME_POSTAL_CODE = "postal_code"; - @SerializedName(SERIALIZED_NAME_POSTAL_CODE) - private String postalCode; + @SerializedName("region_code") + private String regionCode = null; - public static final String SERIALIZED_NAME_REGION_CODE = "region_code"; - @SerializedName(SERIALIZED_NAME_REGION_CODE) - private String regionCode; + @SerializedName("latitude") + private double latitude; + @SerializedName("longitude") + private double longitude; public IPLocation city(String city) { - this.city = city; return this; } @@ -54,21 +53,16 @@ public IPLocation city(String city) { * Get city * @return city **/ - @javax.annotation.Nullable @ApiModelProperty(example = "Ashburn", required = true, value = "") - public String getCity() { return city; } - public void setCity(String city) { this.city = city; } - public IPLocation continentCode(String continentCode) { - this.continentCode = continentCode; return this; } @@ -77,21 +71,16 @@ public IPLocation continentCode(String continentCode) { * Get continentCode * @return continentCode **/ - @javax.annotation.Nullable @ApiModelProperty(example = "NA", required = true, value = "") - public String getContinentCode() { return continentCode; } - public void setContinentCode(String continentCode) { this.continentCode = continentCode; } - public IPLocation countryCode(String countryCode) { - this.countryCode = countryCode; return this; } @@ -100,21 +89,16 @@ public IPLocation countryCode(String countryCode) { * Get countryCode * @return countryCode **/ - @javax.annotation.Nullable @ApiModelProperty(example = "US", required = true, value = "") - public String getCountryCode() { return countryCode; } - public void setCountryCode(String countryCode) { this.countryCode = countryCode; } - public IPLocation postalCode(String postalCode) { - this.postalCode = postalCode; return this; } @@ -123,21 +107,16 @@ public IPLocation postalCode(String postalCode) { * Get postalCode * @return postalCode **/ - @javax.annotation.Nullable @ApiModelProperty(example = "20149", required = true, value = "") - public String getPostalCode() { return postalCode; } - public void setPostalCode(String postalCode) { this.postalCode = postalCode; } - public IPLocation regionCode(String regionCode) { - this.regionCode = regionCode; return this; } @@ -146,18 +125,51 @@ public IPLocation regionCode(String regionCode) { * Get regionCode * @return regionCode **/ - @javax.annotation.Nullable @ApiModelProperty(example = "VA", required = true, value = "") - public String getRegionCode() { return regionCode; } - public void setRegionCode(String regionCode) { this.regionCode = regionCode; } + public IPLocation latitude(double latitude) { + this.latitude = latitude; + return this; + } + + /** + * Get latitude + * @return latitude + **/ + @ApiModelProperty(example = "52.3583", required = true, value = "") + public double getLatitude() { + return latitude; + } + + public void setLatitude(double latitude) { + this.latitude = latitude; + } + + public IPLocation longitude(double longitude) { + this.longitude = longitude; + return this; + } + + /** + * Get longitude + * @return longitude + **/ + @ApiModelProperty(example = "4.8488", required = true, value = "") + public double getLongitude() { + return longitude; + } + + public void setLongitude(double longitude) { + this.longitude = longitude; + } + @Override public boolean equals(Object o) { @@ -172,23 +184,29 @@ public boolean equals(Object o) { Objects.equals(this.continentCode, ipLocation.continentCode) && Objects.equals(this.countryCode, ipLocation.countryCode) && Objects.equals(this.postalCode, ipLocation.postalCode) && - Objects.equals(this.regionCode, ipLocation.regionCode); + Objects.equals(this.regionCode, ipLocation.regionCode) && + Objects.equals(this.latitude, ipLocation.latitude) && + Objects.equals(this.longitude, ipLocation.longitude); } @Override public int hashCode() { - return Objects.hash(city, continentCode, countryCode, postalCode, regionCode); + return Objects.hash(city, continentCode, countryCode, postalCode, regionCode, latitude, longitude); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class IPLocation {\n"); + sb.append(" city: ").append(toIndentedString(city)).append("\n"); sb.append(" continentCode: ").append(toIndentedString(continentCode)).append("\n"); sb.append(" countryCode: ").append(toIndentedString(countryCode)).append("\n"); sb.append(" postalCode: ").append(toIndentedString(postalCode)).append("\n"); sb.append(" regionCode: ").append(toIndentedString(regionCode)).append("\n"); + sb.append(" latitude: ").append(toIndentedString(latitude)).append("\n"); + sb.append(" longitude: ").append(toIndentedString(longitude)).append("\n"); sb.append("}"); return sb.toString(); } @@ -205,4 +223,3 @@ private String toIndentedString(Object o) { } } - diff --git a/src/main/java/io/castle/client/model/generated/IPPrivacy.java b/src/main/java/io/castle/client/model/generated/IPPrivacy.java new file mode 100755 index 0000000..91f7d78 --- /dev/null +++ b/src/main/java/io/castle/client/model/generated/IPPrivacy.java @@ -0,0 +1,156 @@ +/* + * Castle API + * ## Introduction **Just getting started? Check out our [quick start guide](https://docs.castle.io/docs/quickstart)** Castle APIs uses standard HTTP response codes, authentication and verbs. JSON is used as data exchange format, both for parsing incoming request bodies, and in the returned response. This means that the `Content-Type` header should to be set to `application/json` in requests with a body, such as `POST` or `PUT`. All API requests must be made over [HTTPS](http://en.wikipedia.org/wiki/HTTP_Secure). Non-HTTPS calls will fail and the **TLS version needs to be 1.1 or higher**. ## Supported types For a list of supported types, see our [Types Reference](https://docs.castle.io/docs/events). ## Rate limits Our APIs implement rate-limiting based on the number of requests made to them. Each request will return the following headers: - `X-RateLimit-Limit` - The maximum number of requests you're permitted to make in the current time window. - `X-RateLimit-Remaining` - The number of requests remaining in the current time window. - `X-RateLimit-Reset` - The remaining time in seconds until the current time window resets. Additionally, Our Risk, Filter (and the legacy Authenticate) APIs have a per-user-id rate limit of 6 requests per second and 10 requests per 5 seconds. + * + * OpenAPI spec version: 1 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +package io.castle.client.model.generated; + +import com.google.gson.annotations.SerializedName; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; +/** + * IPPrivacy + */ + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2025-01-20T18:58:06.855017776Z[GMT]") + +public class IPPrivacy { + @SerializedName("anonymous") + private Boolean anonymous = null; + + @SerializedName("datacenter") + private Boolean datacenter = null; + + @SerializedName("proxy") + private Boolean proxy = null; + + @SerializedName("tor") + private Boolean tor = null; + + public IPPrivacy anonymous(Boolean anonymous) { + this.anonymous = anonymous; + return this; + } + + /** + * Get anonymous + * @return anonymous + **/ + @ApiModelProperty(example = "false", value = "") + public Boolean isAnonymous() { + return anonymous; + } + + public void setAnonymous(Boolean anonymous) { + this.anonymous = anonymous; + } + + public IPPrivacy datacenter(Boolean datacenter) { + this.datacenter = datacenter; + return this; + } + + /** + * Get datacenter + * @return datacenter + **/ + @ApiModelProperty(example = "false", value = "") + public Boolean isDatacenter() { + return datacenter; + } + + public void setDatacenter(Boolean datacenter) { + this.datacenter = datacenter; + } + + public IPPrivacy proxy(Boolean proxy) { + this.proxy = proxy; + return this; + } + + /** + * Get proxy + * @return proxy + **/ + @ApiModelProperty(example = "false", value = "") + public Boolean isProxy() { + return proxy; + } + + public void setProxy(Boolean proxy) { + this.proxy = proxy; + } + + public IPPrivacy tor(Boolean tor) { + this.tor = tor; + return this; + } + + /** + * Get tor + * @return tor + **/ + @ApiModelProperty(example = "false", value = "") + public Boolean isTor() { + return tor; + } + + public void setTor(Boolean tor) { + this.tor = tor; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IPPrivacy ipPrivacy = (IPPrivacy) o; + return Objects.equals(this.anonymous, ipPrivacy.anonymous) && + Objects.equals(this.datacenter, ipPrivacy.datacenter) && + Objects.equals(this.proxy, ipPrivacy.proxy) && + Objects.equals(this.tor, ipPrivacy.tor); + } + + @Override + public int hashCode() { + return Objects.hash(anonymous, datacenter, proxy, tor); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IPPrivacy {\n"); + + sb.append(" anonymous: ").append(toIndentedString(anonymous)).append("\n"); + sb.append(" datacenter: ").append(toIndentedString(datacenter)).append("\n"); + sb.append(" proxy: ").append(toIndentedString(proxy)).append("\n"); + sb.append(" tor: ").append(toIndentedString(tor)).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/io/castle/client/model/generated/Scores.java b/src/main/java/io/castle/client/model/generated/Scores.java deleted file mode 100644 index 098160a..0000000 --- a/src/main/java/io/castle/client/model/generated/Scores.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Castle API - * ## Introduction **Just getting started? Check out our [quick start guide](https://docs.castle.io/docs/quickstart)** Castle APIs uses standard HTTP response codes, authentication and verbs. JSON is used as data exchange format, both for parsing incoming request bodies, and in the returned response. This means that the `Content-Type` header should to be set to `application/json` in requests with a body, such as `POST` or `PUT`. All API requests must be made over [HTTPS](http://en.wikipedia.org/wiki/HTTP_Secure). Non-HTTPS calls will fail and the **TLS version needs to be 1.1 or higher**. ## Supported types For a list of supported types, see our [Types Reference](https://docs.castle.io/docs/events). ## Rate limits Our Risk, Log (and the legacy Authenticate) APIs have a per-user-id rate limit of 6 requests per second and 10 requests per 5 seconds. - * - * The version of the OpenAPI document: 1 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package io.castle.client.model.generated; - -import java.util.Objects; - -import com.google.gson.annotations.SerializedName; -import io.swagger.annotations.ApiModelProperty; - -/** - * FilterResponseScores - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-09-05T12:03:37.030848+02:00[Europe/Stockholm]") -public class Scores { - public static final String SERIALIZED_NAME_ACCOUNT_ABUSE = "account_abuse"; - @SerializedName(SERIALIZED_NAME_ACCOUNT_ABUSE) - private Score accountAbuse; - - public static final String SERIALIZED_NAME_ACCOUNT_TAKEOVER = "account_takeover"; - @SerializedName(SERIALIZED_NAME_ACCOUNT_TAKEOVER) - private Score accountTakeover; - - public static final String SERIALIZED_NAME_BOT = "bot"; - @SerializedName(SERIALIZED_NAME_BOT) - private Score bot; - - - public Scores accountAbuse(Score accountAbuse) { - - this.accountAbuse = accountAbuse; - return this; - } - - /** - * Get accountAbuse - * @return accountAbuse - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - - public Score getAccountAbuse() { - return accountAbuse; - } - - - public void setAccountAbuse(Score accountAbuse) { - this.accountAbuse = accountAbuse; - } - - - public Scores accountTakeover(Score accountTakeover) { - - this.accountTakeover = accountTakeover; - return this; - } - - /** - * Get accountTakeover - * @return accountTakeover - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - - public Score getAccountTakeover() { - return accountTakeover; - } - - - public void setAccountTakeover(Score accountTakeover) { - this.accountTakeover = accountTakeover; - } - - - public Scores bot(Score bot) { - - this.bot = bot; - return this; - } - - /** - * Get bot - * @return bot - **/ - @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "") - - public Score getBot() { - return bot; - } - - - public void setBot(Score bot) { - this.bot = bot; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Scores scores = (Scores) o; - return Objects.equals(this.accountAbuse, scores.accountAbuse) && - Objects.equals(this.accountTakeover, scores.accountTakeover) && - Objects.equals(this.bot, scores.bot); - } - - @Override - public int hashCode() { - return Objects.hash(accountAbuse, accountTakeover, bot); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class FilterResponseScores {\n"); - sb.append(" accountAbuse: ").append(toIndentedString(accountAbuse)).append("\n"); - sb.append(" accountTakeover: ").append(toIndentedString(accountTakeover)).append("\n"); - sb.append(" bot: ").append(toIndentedString(bot)).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/io/castle/client/model/generated/User.java b/src/main/java/io/castle/client/model/generated/User.java old mode 100644 new mode 100755 index 60acef3..2486ad6 --- a/src/main/java/io/castle/client/model/generated/User.java +++ b/src/main/java/io/castle/client/model/generated/User.java @@ -2,61 +2,51 @@ * Castle API * ## Introduction **Just getting started? Check out our [quick start guide](https://docs.castle.io/docs/quickstart)** Castle APIs uses standard HTTP response codes, authentication and verbs. JSON is used as data exchange format, both for parsing incoming request bodies, and in the returned response. This means that the `Content-Type` header should to be set to `application/json` in requests with a body, such as `POST` or `PUT`. All API requests must be made over [HTTPS](http://en.wikipedia.org/wiki/HTTP_Secure). Non-HTTPS calls will fail and the **TLS version needs to be 1.1 or higher**. ## Supported types For a list of supported types, see our [Types Reference](https://docs.castle.io/docs/events). ## Rate limits Our APIs implement rate-limiting based on the number of requests made to them. Each request will return the following headers: - `X-RateLimit-Limit` - The maximum number of requests you're permitted to make in the current time window. - `X-RateLimit-Remaining` - The number of requests remaining in the current time window. - `X-RateLimit-Reset` - The remaining time in seconds until the current time window resets. Additionally, Our Risk, Filter (and the legacy Authenticate) APIs have a per-user-id rate limit of 6 requests per second and 10 requests per 5 seconds. * - * The version of the OpenAPI document: 1 + * OpenAPI spec version: 1 * * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ - package io.castle.client.model.generated; import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModelProperty; -import org.openapitools.jackson.nullable.JsonNullable; import org.threeten.bp.OffsetDateTime; -import java.util.Arrays; +import java.util.HashMap; import java.util.Objects; - /** - * UserForMonitorAndRisk + * User */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-12-05T19:53:01.452316+01:00[Europe/Stockholm]") -public class User { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - private String id; - public static final String SERIALIZED_NAME_EMAIL = "email"; - @SerializedName(SERIALIZED_NAME_EMAIL) - private String email; +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2025-01-20T18:58:06.855017776Z[GMT]") + +public class User { + @SerializedName("id") + private String id = null; - public static final String SERIALIZED_NAME_PHONE = "phone"; - @SerializedName(SERIALIZED_NAME_PHONE) - private String phone; + @SerializedName("email") + private String email = null; - public static final String SERIALIZED_NAME_REGISTERED_AT = "registered_at"; - @SerializedName(SERIALIZED_NAME_REGISTERED_AT) - private OffsetDateTime registeredAt; + @SerializedName("phone") + private String phone = null; - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + @SerializedName("registered_at") + private OffsetDateTime registeredAt = null; - public static final String SERIALIZED_NAME_TRAITS = "traits"; - @SerializedName(SERIALIZED_NAME_TRAITS) - private Object traits; + @SerializedName("name") + private String name = null; - public static final String SERIALIZED_NAME_ADDRESS = "address"; - @SerializedName(SERIALIZED_NAME_ADDRESS) - private Address address; + @SerializedName("traits") + private HashMap traits = null; + @SerializedName("address") + private Address address = null; public User id(String id) { - this.id = id; return this; } @@ -65,90 +55,70 @@ public User id(String id) { * A unique user identifier * @return id **/ - @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "A unique user identifier") - public String getId() { return id; } - public void setId(String id) { this.id = id; } - public User email(String email) { - this.email = email; return this; } /** - * The identified user's email address + * The identified user's email address * @return email **/ - @javax.annotation.Nullable @ApiModelProperty(value = "The identified user's email address") - public String getEmail() { return email; } - public void setEmail(String email) { this.email = email; } - public User phone(String phone) { - this.phone = phone; return this; } /** - * The identified user's phone number E.164 formatted + * The identified user's phone number E.164 formatted * @return phone **/ - @javax.annotation.Nullable @ApiModelProperty(value = "The identified user's phone number E.164 formatted") - public String getPhone() { return phone; } - public void setPhone(String phone) { this.phone = phone; } - public User registeredAt(OffsetDateTime registeredAt) { - this.registeredAt = registeredAt; return this; } /** - * The ISO8601 timestamp of the user's account creation + * The ISO8601 timestamp of the user's account creation * @return registeredAt **/ - @javax.annotation.Nullable @ApiModelProperty(value = "The ISO8601 timestamp of the user's account creation") - public OffsetDateTime getRegisteredAt() { return registeredAt; } - public void setRegisteredAt(OffsetDateTime registeredAt) { this.registeredAt = registeredAt; } - public User name(String name) { - this.name = name; return this; } @@ -157,21 +127,16 @@ public User name(String name) { * The full name of the user * @return name **/ - @javax.annotation.Nullable @ApiModelProperty(value = "The full name of the user") - public String getName() { return name; } - public void setName(String name) { this.name = name; } - - public User traits(Object traits) { - + public User traits(HashMap traits) { this.traits = traits; return this; } @@ -180,21 +145,16 @@ public User traits(Object traits) { * Known traits of the identified user * @return traits **/ - @javax.annotation.Nullable @ApiModelProperty(value = "Known traits of the identified user") - - public Object getTraits() { + public HashMap getTraits() { return traits; } - - public void setTraits(Object traits) { + public void setTraits(HashMap traits) { this.traits = traits; } - public User address(Address address) { - this.address = address; return this; } @@ -203,14 +163,11 @@ public User address(Address address) { * Get address * @return address **/ - @javax.annotation.Nullable @ApiModelProperty(value = "") - public Address getAddress() { return address; } - public void setAddress(Address address) { this.address = address; } @@ -224,18 +181,14 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - User userForMonitorAndRisk = (User) o; - return Objects.equals(this.id, userForMonitorAndRisk.id) && - Objects.equals(this.email, userForMonitorAndRisk.email) && - Objects.equals(this.phone, userForMonitorAndRisk.phone) && - Objects.equals(this.registeredAt, userForMonitorAndRisk.registeredAt) && - Objects.equals(this.name, userForMonitorAndRisk.name) && - Objects.equals(this.traits, userForMonitorAndRisk.traits) && - Objects.equals(this.address, userForMonitorAndRisk.address); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get())); + User user = (User) o; + return Objects.equals(this.id, user.id) && + Objects.equals(this.email, user.email) && + Objects.equals(this.phone, user.phone) && + Objects.equals(this.registeredAt, user.registeredAt) && + Objects.equals(this.name, user.name) && + Objects.equals(this.traits, user.traits) && + Objects.equals(this.address, user.address); } @Override @@ -243,19 +196,11 @@ public int hashCode() { return Objects.hash(id, email, phone, registeredAt, name, traits, address); } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() - ? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get())) - : 31; - } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class UserForMonitorAndRisk {\n"); + sb.append("class User {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" email: ").append(toIndentedString(email)).append("\n"); sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); @@ -279,4 +224,3 @@ private String toIndentedString(Object o) { } } - diff --git a/src/test/java/io/castle/client/CastleFilterHttpTest.java b/src/test/java/io/castle/client/CastleFilterHttpTest.java index f29dd65..f2133ca 100644 --- a/src/test/java/io/castle/client/CastleFilterHttpTest.java +++ b/src/test/java/io/castle/client/CastleFilterHttpTest.java @@ -1,19 +1,20 @@ package io.castle.client; import com.google.gson.JsonParser; +import io.castle.client.internal.json.CastleGsonModel; import io.castle.client.model.AuthenticateAction; import io.castle.client.model.AuthenticateFailoverStrategy; import io.castle.client.model.generated.*; +import jakarta.servlet.http.HttpServletRequest; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.RecordedRequest; -import org.assertj.core.api.Assertions; import org.junit.Assert; import org.junit.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.threeten.bp.OffsetDateTime; -import jakarta.servlet.http.HttpServletRequest; import java.util.HashMap; +import java.util.List; public class CastleFilterHttpTest extends AbstractCastleHttpLayerTest { @@ -21,34 +22,191 @@ public CastleFilterHttpTest() { super(new AuthenticateFailoverStrategy(AuthenticateAction.CHALLENGE)); } - @Test public void risk() throws InterruptedException { + @Test public void filter() throws InterruptedException { MockResponse mockResponse = new MockResponse(); mockResponse.setBody("{\n" + - "\"risk\": 0.65,\n" + - "\"scores\": {\n" + - "\"account_abuse\": {\n" + - "\"score\": 0.65\n" + - "},\n" + - "\"account_takeover\": {\n" + - "\"score\": 0.77\n" + - "},\n" + - "\"bot\": {\n" + - "\"score\": 0.34\n" + - "}\n" + - "},\n" + - "\"policy\": {\n" + - "\"name\": \"Challenge risk >= 60\",\n" + - "\"id\": \"2ee938c8-24c2-4c26-9d25-19511dd75029\",\n" + - "\"revision_id\": \"900b183a-9f6d-4579-8c47-9ddcccf637b4\",\n" + - "\"action\": \"challenge\"\n" + - "},\n" + - "\"signals\": {\n" + - "\"bot_behavior\": { },\n" + - "\"proxy_ip\": { },\n" + - "\"disposable_email\": { },\n" + - "\"spoofed_device\": { },\n" + - "\"multiple_accounts_per_device\": { }\n" + - "}\n" + + " \"risk\": 0.65,\n" + + " \"scores\": {\n" + + " \"account_abuse\": {\n" + + " \"score\": 0.65\n" + + " },\n" + + " \"account_takeover\": {\n" + + " \"score\": 0.77\n" + + " },\n" + + " \"bot\": {\n" + + " \"score\": 0.34\n" + + " }\n" + + " },\n" + + " \"policy\": {\n" + + " \"name\": \"Challenge risk >= 60\",\n" + + " \"id\": \"2ee938c8-24c2-4c26-9d25-19511dd75029\",\n" + + " \"revision_id\": \"900b183a-9f6d-4579-8c47-9ddcccf637b4\",\n" + + " \"action\": \"challenge\"\n" + + " },\n" + + " \"signals\": {\n" + + " \"bot_behavior\": {},\n" + + " \"proxy_ip\": {},\n" + + " \"disposable_email\": {},\n" + + " \"spoofed_device\": {},\n" + + " \"multiple_accounts_per_device\": {}\n" + + " },\n" + + " \"metrics\": {\n" + + " \"1\": {},\n" + + " \"2\": {},\n" + + " \"3\": {},\n" + + " \"4\": {},\n" + + " \"5\": {}\n" + + " },\n" + + " \"device\": {\n" + + " \"user_agent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36\",\n" + + " \"fingerprint\": \"ohvjn8adSnetYTzZ8B7bOP\",\n" + + " \"hardware\": {\n" + + " \"type\": \"computer\",\n" + + " \"name\": null,\n" + + " \"brand\": null,\n" + + " \"display\": {\n" + + " \"width\": 1512,\n" + + " \"height\": 982\n" + + " },\n" + + " \"model\": {\n" + + " \"name\": null,\n" + + " \"code\": null\n" + + " }\n" + + " },\n" + + " \"os\": {\n" + + " \"name\": \"Windows 10\",\n" + + " \"version\": {\n" + + " \"major\": \"10\",\n" + + " \"full\": null\n" + + " }\n" + + " },\n" + + " \"software\": {\n" + + " \"type\": \"browser\",\n" + + " \"name\": \"Chrome\",\n" + + " \"languages\": [\n" + + " \"en-us\",\n" + + " \"en\"\n" + + " ],\n" + + " \"version\": {\n" + + " \"major\": \"91\",\n" + + " \"full\": \"91.0.4472\"\n" + + " },\n" + + " \"fingerprint\": \"vOch_0a_fpkl1Tf-pVPuDA\"\n" + + " },\n" + + " \"timezone\": {\n" + + " \"offset\": -300,\n" + + " \"name\": \"America/New_York\"\n" + + " },\n" + + " \"screen\": {\n" + + " \"screen\": 2,\n" + + " \"orientation\": \"landscape\"\n" + + " },\n" + + " \"token\": \"eyJhbGciOiJIUzI1NiJ9.eyJ0b2tlbiI6IjEzc2x6RzNHQ0RzeFJCejdJWF9SUDJkV1Y0RFgiLCJxdWFsaWZpZXIiOiJBUUlEQ2pFME5EZzFPREF3T1RZIiwiYW5vbnltb3VzIjpmYWxzZSwidmVyc2lvbiI6MC4zfQ.y3vOt-W1IpOi7Oyn1jll1uDw1YL-JPZtNMTU-PyaYhQ\"\n" + + " },\n" + + " \"id\": \"ASZoelALT5-PaVw2pAVMXg\",\n" + + " \"name\": \"Login Succeeded\",\n" + + " \"type\": \"$challenge\",\n" + + " \"status\": \"$succeeded\",\n" + + " \"created_at\": \"2021-09-27T16:46:38.313Z\",\n" + + " \"authenticated\": true,\n" + + " \"authentication_method\": {\n" + + " \"type\": \"$social\",\n" + + " \"variant\": \"facebook\"\n" + + " },\n" + + " \"email\": {\n" + + " \"normalized\": \"user.email@example.com\",\n" + + " \"domain\": \"gmail.com\",\n" + + " \"disposable\": false,\n" + + " \"unreachable\": false,\n" + + " \"domain_details\": {\n" + + " \"created_at\": \"2021-09-27T16:46:38.313Z\",\n" + + " \"updated_at\": \"2021-09-27T16:46:38.313Z\",\n" + + " \"expires_at\": \"2021-09-27T16:46:38.313Z\",\n" + + " \"registrar\": \"string\",\n" + + " \"nameservers\": [\n" + + " \"ns1.hosting.com\",\n" + + " \"ns2.hosting.com\",\n" + + " \"ns3.hosting.com\"\n" + + " ],\n" + + " \"spf_record\": {\n" + + " \"exists\": false\n" + + " },\n" + + " \"dmarc_record\": {\n" + + " \"exists\": false\n" + + " },\n" + + " \"mx_records\": {\n" + + " \"null_mx\": false\n" + + " }\n" + + " }\n" + + " },\n" + + " \"endpoint\": \"/v1/risk\",\n" + + " \"ip\": {\n" + + " \"asn\": 14618,\n" + + " \"location\": {\n" + + " \"city\": \"Ashburn\",\n" + + " \"continent_code\": \"NA\",\n" + + " \"country_code\": \"US\",\n" + + " \"postal_code\": \"20149\",\n" + + " \"region_code\": \"VA\",\n" + + " \"latitude\": 52.3583,\n" + + " \"longitude\": 4.8488\n" + + " },\n" + + " \"address\": \"34.200.81.5\",\n" + + " \"isp\": {\n" + + " \"name\": \"verizon fios\",\n" + + " \"organization\": \"verizon fios\"\n" + + " },\n" + + " \"type\": \"ipv4\",\n" + + " \"privacy\": {\n" + + " \"anonymous\": false,\n" + + " \"datacenter\": false,\n" + + " \"proxy\": false,\n" + + " \"tor\": false\n" + + " }\n" + + " },\n" + + " \"params\": {\n" + + " \"email\": \"Rhea.Franecki@example.org\",\n" + + " \"phone\": \"+16175551212\",\n" + + " \"username\": \"superhero123\"\n" + + " },\n" + + " \"product\": {\n" + + " \"id\": \"string\"\n" + + " },\n" + + " \"sdks\": {\n" + + " \"client\": {\n" + + " \"name\": \"castle-web\",\n" + + " \"version\": \"2.0.0\"\n" + + " },\n" + + " \"server\": {\n" + + " \"name\": \"castle-postman\",\n" + + " \"version\": \"0.1.0\"\n" + + " }\n" + + " },\n" + + " \"session\": {\n" + + " \"id\": \"string\",\n" + + " \"created_at\": \"2019-08-24T14:15:22Z\"\n" + + " },\n" + + " \"user\": {\n" + + " \"id\": \"string\",\n" + + " \"email\": \"пошта@укр.нет\",\n" + + " \"phone\": \"string\",\n" + + " \"registered_at\": \"2019-08-24T14:15:22Z\",\n" + + " \"name\": \"string\",\n" + + " \"traits\": {},\n" + + " \"address\": {\n" + + " \"line1\": \"60 Rausch Street\",\n" + + " \"line2\": \"string\",\n" + + " \"city\": \"San Francisco\",\n" + + " \"country_code\": \"US\",\n" + + " \"region_code\": \"CA\",\n" + + " \"postal_code\": \"94103\",\n" + + " \"fingerprint\": \"8a33j2lir9\"\n" + + " }\n" + + " },\n" + + " \"behavior\": {\n" + + " \"fingerprint\": \"vOch_0a_fpkl1Tf-pVPuDA\"\n" + + " },\n" + + " \"properties\": {}\n" + "}"); mockResponse.setResponseCode(201); server.enqueue(mockResponse); @@ -56,102 +214,144 @@ public CastleFilterHttpTest() { // And a mock Request HttpServletRequest request = new MockHttpServletRequest(); - Filter filter = new Filter() - .type(Filter.TypeEnum.CHALLENGE) - .status(Filter.StatusEnum.SUCCEEDED) - .requestToken("4-ugt5CFooaxt5KbpISi1Kurm5KTpqawlYmFs5PXsqKootPgRB3z12OpvPOWOQ9PkztagtqicAnk9Qowu7FlU9qabyi4k2QR6KUUL5p3gr-A2w8Ju8gWe0XyRi_OkmFj2oZiU9OTPAjijjIK4sA-a7f19GC_xzhYurdkWM-ZY1jR_l4R8JloVdGTfj7IhXY6_pd5SNGThjmM2DoSjWNup74xC3v-l3lI0ZMlDZPGJAyd3jsVnd5JXc6CZlmdxSQMk8UxHPyYbk7Sn24cjMQxHPqZZVvRkypP2Z1VW82eZVLYwD5jxc48Y4vCI4C1gDJWiIVMXssRDTmrPME9aeZPSc-ZelmSpX5T3p1iU9Gb1jnYmCdp7gnJ"); - - FilterUser user = new FilterUser() - .email("12345"); - filter.user(user); - - Context context = new Context() - .ip("211.96.77.55") - .addHeadersItem("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15"); - filter.context(context); - - Product product = new Product() - .id("1234"); - filter.product(product); - - AuthenticationMethod authenticationMethod = new AuthenticationMethod() - .type(AuthenticationMethodType.SOCIAL) - .variant("facebook"); - filter.authenticationMethod(authenticationMethod); - - filter.putPropertiesItem("property1", new HashMap()); - filter.putPropertiesItem("property2", new HashMap()); - - filter.createdAt(OffsetDateTime.parse("2022-05-20T09:03:27.468+02:00")); + Filter filter = createFilter(); FilterAndRiskResponse response = sdk.onRequest(request).filter(filter); // Check response object Assert.assertNotNull(response.getRisk()); - Assert.assertEquals(response.getRisk(), 0.65, 0); - Assert.assertEquals(response.getSignals().size(), 5); - Assert.assertEquals(response.getPolicy().getAction(), Policy.ActionEnum.CHALLENGE); - Assert.assertEquals(response.getPolicy().getId(), "2ee938c8-24c2-4c26-9d25-19511dd75029"); - Assert.assertEquals(response.getPolicy().getRevisionId(), "900b183a-9f6d-4579-8c47-9ddcccf637b4"); - Assert.assertEquals(response.getPolicy().getName(), "Challenge risk >= 60"); + Assert.assertEquals(0.65, response.getRisk(), 0); + Assert.assertEquals(5, response.getSignals().size()); + Assert.assertEquals(Policy.ActionEnum.CHALLENGE, response.getPolicy().getAction()); + Assert.assertEquals("2ee938c8-24c2-4c26-9d25-19511dd75029", response.getPolicy().getId()); + Assert.assertEquals("900b183a-9f6d-4579-8c47-9ddcccf637b4", response.getPolicy().getRevisionId()); + Assert.assertEquals("Challenge risk >= 60", response.getPolicy().getName()); Assert.assertNotNull(response.getScores()); - Assert.assertEquals(response.getScores().getAccountAbuse().getScore(), 0.65, 0.0); - Assert.assertEquals(response.getScores().getAccountTakeover().getScore(), 0.77, 0.0); - Assert.assertEquals(response.getScores().getBot().getScore(), 0.34, 0.0); + Assert.assertEquals(0.65, response.getScores().getAccountAbuse().getScore(), 0.0); + Assert.assertEquals(0.77, response.getScores().getAccountTakeover().getScore(), 0.0); + Assert.assertEquals(0.34, response.getScores().getBot().getScore(), 0.0); + Assert.assertEquals(5, response.getMetrics().size()); + Assert.assertEquals("ohvjn8adSnetYTzZ8B7bOP", response.getDevice().getFingerprint()); + //Assert.assertEquals("eyJhbGciOiJIUzI1NiJ9.eyJ0b2tlbiI6IjEzc2x6RzNHQ0RzeFJCejdJWF9SUDJkV1Y0RFgiLCJxdWFsaWZpZXIiOiJBUUlEQ2pFME5EZzFPREF3T1RZIiwiYW5vbnltb3VzIjpmYWxzZSwidmVyc2lvbiI6MC4zfQ.y3vOt-W1IpOi7Oyn1jll1uDw1YL-JPZtNMTU-PyaYhQ", response.getDevice().getHardware().getToken()); + Assert.assertEquals("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36", response.getDevice().getUserAgent()); + Assert.assertEquals("Windows 10", response.getDevice().getOs().getName()); + Assert.assertEquals("10", response.getDevice().getOs().getVersion().getMajor()); + Assert.assertEquals("Chrome", response.getDevice().getSoftware().getName()); + Assert.assertEquals("browser", response.getDevice().getSoftware().getType()); + Assert.assertEquals("en-us", response.getDevice().getSoftware().getLanguages().get(0)); + Assert.assertEquals("en", response.getDevice().getSoftware().getLanguages().get(1)); + Assert.assertEquals("91.0.4472", response.getDevice().getSoftware().getVersion().getFull()); + Assert.assertEquals("91", response.getDevice().getSoftware().getVersion().getMajor()); + Assert.assertEquals(2, response.getDevice().getScreen().getScreen()); + Assert.assertEquals("landscape", response.getDevice().getScreen().getOrientation()); + Assert.assertEquals("America/New_York", response.getDevice().getTimezone().getName()); + Assert.assertEquals(-300, response.getDevice().getTimezone().getOffset()); + Assert.assertEquals("ASZoelALT5-PaVw2pAVMXg", response.getId()); + Assert.assertEquals("Login Succeeded", response.getName()); + Assert.assertEquals("$challenge", response.getType()); + Assert.assertEquals("$succeeded", response.getStatus()); + Assert.assertEquals(OffsetDateTime.parse("2021-09-27T16:46:38.313Z"), response.getCreatedAt()); + Assert.assertTrue(response.isAuthenticated()); + Assert.assertEquals(AuthenticationMethodType.SOCIAL, response.getAuthenticationMethod().getType()); + Assert.assertEquals("facebook", response.getAuthenticationMethod().getVariant()); + Assert.assertEquals("user.email@example.com", response.getEmail().getNormalized()); + Assert.assertEquals("gmail.com", response.getEmail().getDomain()); + Assert.assertFalse(response.getEmail().isDisposable()); + Assert.assertFalse(response.getEmail().isUnreachable()); + Assert.assertEquals(OffsetDateTime.parse("2021-09-27T16:46:38.313Z"), response.getEmail().getDomainDetails().getCreatedAt()); + Assert.assertEquals(OffsetDateTime.parse("2021-09-27T16:46:38.313Z"), response.getEmail().getDomainDetails().getUpdatedAt()); + Assert.assertEquals(OffsetDateTime.parse("2021-09-27T16:46:38.313Z"), response.getEmail().getDomainDetails().getExpiresAt()); + Assert.assertEquals("string", response.getEmail().getDomainDetails().getRegistrar()); + Assert.assertEquals(3, response.getEmail().getDomainDetails().getNameservers().size()); + Assert.assertEquals("ns1.hosting.com", response.getEmail().getDomainDetails().getNameservers().get(0)); + Assert.assertEquals("ns2.hosting.com", response.getEmail().getDomainDetails().getNameservers().get(1)); + Assert.assertEquals("ns3.hosting.com", response.getEmail().getDomainDetails().getNameservers().get(2)); + Assert.assertFalse(response.getEmail().getDomainDetails().getSpfRecord().isExists()); + Assert.assertFalse(response.getEmail().getDomainDetails().getDmarcRecord().isExists()); + Assert.assertFalse(response.getEmail().getDomainDetails().getMxRecords().isNullMx()); + Assert.assertEquals("/v1/risk", response.getEndpoint()); + Assert.assertEquals(14618, response.getIp().getAsn()); + Assert.assertEquals("Ashburn", response.getIp().getLocation().getCity()); + Assert.assertEquals("NA", response.getIp().getLocation().getContinentCode()); + Assert.assertEquals("US", response.getIp().getLocation().getCountryCode()); + Assert.assertEquals("20149", response.getIp().getLocation().getPostalCode()); + Assert.assertEquals("VA", response.getIp().getLocation().getRegionCode()); + Assert.assertEquals(52.3583, response.getIp().getLocation().getLatitude(), 0.0); + Assert.assertEquals(4.8488, response.getIp().getLocation().getLongitude(), 0.0); + Assert.assertEquals("34.200.81.5", response.getIp().getAddress()); + Assert.assertEquals("verizon fios", response.getIp().getIsp().getName()); + Assert.assertEquals("verizon fios", response.getIp().getIsp().getOrganization()); + Assert.assertEquals("ipv4", response.getIp().getType()); + Assert.assertFalse(response.getIp().getPrivacy().isAnonymous()); + Assert.assertFalse(response.getIp().getPrivacy().isDatacenter()); + Assert.assertFalse(response.getIp().getPrivacy().isProxy()); + Assert.assertFalse(response.getIp().getPrivacy().isTor()); + Assert.assertEquals("string", response.getProduct().getId()); + Assert.assertEquals("Rhea.Franecki@example.org", response.getParams().getEmail()); + Assert.assertEquals("+16175551212", response.getParams().getPhone()); + Assert.assertEquals("superhero123", response.getParams().getUsername()); + Assert.assertEquals("castle-web", response.getSdks().getClient().getName()); + Assert.assertEquals("2.0.0", response.getSdks().getClient().getVersion()); + Assert.assertEquals("castle-postman", response.getSdks().getServer().getName()); + Assert.assertEquals("0.1.0", response.getSdks().getServer().getVersion()); + Assert.assertEquals("string", response.getUser().getId()); + Assert.assertEquals("пошта@укр.нет", response.getUser().getEmail()); + Assert.assertEquals("string", response.getUser().getPhone()); + Assert.assertEquals(OffsetDateTime.parse("2019-08-24T14:15:22Z"), response.getUser().getRegisteredAt()); + Assert.assertEquals("string", response.getUser().getName()); + Assert.assertEquals(0, response.getUser().getTraits().size()); + Assert.assertEquals("60 Rausch Street", response.getUser().getAddress().getLine1()); + Assert.assertEquals("string", response.getUser().getAddress().getLine2()); + Assert.assertEquals("San Francisco", response.getUser().getAddress().getCity()); + Assert.assertEquals("US", response.getUser().getAddress().getCountryCode()); + Assert.assertEquals("CA", response.getUser().getAddress().getRegionCode()); + Assert.assertEquals("94103", response.getUser().getAddress().getPostalCode()); + Assert.assertEquals("8a33j2lir9", response.getUser().getAddress().getFingerprint()); + Assert.assertEquals("vOch_0a_fpkl1Tf-pVPuDA", response.getBehavior().getFingerprint()); + Assert.assertEquals(0, response.getProperties().size()); // Then RecordedRequest recordedRequest = server.takeRequest(); Assert.assertEquals(testServerBaseUrl.resolve("v1/filter"), recordedRequest.getRequestUrl()); Assert.assertEquals("POST", recordedRequest.getMethod()); - - String body = recordedRequest.getBody().readUtf8(); - - String expected = "{\"context\":{\"headers\":[[\"User-Agent\",\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15\"]],\"ip\":\"211.96.77.55\"},\"properties\":{\"property2\":{},\"property1\":{}},\"product\":{\"id\":\"1234\"},\"created_at\":\"2022-05-20T09:03:27.468+02:00\",\"request_token\":\"4-ugt5CFooaxt5KbpISi1Kurm5KTpqawlYmFs5PXsqKootPgRB3z12OpvPOWOQ9PkztagtqicAnk9Qowu7FlU9qabyi4k2QR6KUUL5p3gr-A2w8Ju8gWe0XyRi_OkmFj2oZiU9OTPAjijjIK4sA-a7f19GC_xzhYurdkWM-ZY1jR_l4R8JloVdGTfj7IhXY6_pd5SNGThjmM2DoSjWNup74xC3v-l3lI0ZMlDZPGJAyd3jsVnd5JXc6CZlmdxSQMk8UxHPyYbk7Sn24cjMQxHPqZZVvRkypP2Z1VW82eZVLYwD5jxc48Y4vCI4C1gDJWiIVMXssRDTmrPME9aeZPSc-ZelmSpX5T3p1iU9Gb1jnYmCdp7gnJ\",\"user\":{\"email\":\"12345\"},\"skip_request_token_validation\":false,\"skip_context_validation\":false,\"type\":\"$challenge\",\"status\":\"$succeeded\",\"authentication_method\":{\"type\":\"$social\",\"variant\":\"facebook\"}}"; - Assertions.assertThat(JsonParser.parseString(body)).isEqualTo(JsonParser.parseString(expected)); } - @Test - public void nullable() { - MockResponse mockResponse = new MockResponse(); - mockResponse.setBody("{\n" + - "\"policy\": {\n" + - "\"name\": \"Challenge risk >= 60\",\n" + - "\"id\": \"2ee938c8-24c2-4c26-9d25-19511dd75029\",\n" + - "\"revision_id\": \"900b183a-9f6d-4579-8c47-9ddcccf637b4\",\n" + - "\"action\": \"challenge\"\n" + - "},\n" + - "\"signals\": {\n" + - "\"bot_behavior\": { },\n" + - "\"proxy_ip\": { },\n" + - "\"disposable_email\": { },\n" + - "\"spoofed_device\": { },\n" + - "\"multiple_accounts_per_device\": { }\n" + - "}\n" + - "}"); - mockResponse.setResponseCode(201); - server.enqueue(mockResponse); - - // And a mock Request - HttpServletRequest request = new MockHttpServletRequest(); - + private Filter createFilter() { Filter filter = new Filter() - .type(Filter.TypeEnum.CHALLENGE) + .type(Filter.TypeEnum.LOGIN) .status(Filter.StatusEnum.ATTEMPTED) - .requestToken("4-ugt5CFooaxt5KbpISi1Kurm5KTpqawlYmFs5PXsqKootPgRB3z12OpvPOWOQ9PkztagtqicAnk9Qowu7FlU9qabyi4k2QR6KUUL5p3gr-A2w8Ju8gWe0XyRi_OkmFj2oZiU9OTPAjijjIK4sA-a7f19GC_xzhYurdkWM-ZY1jR_l4R8JloVdGTfj7IhXY6_pd5SNGThjmM2DoSjWNup74xC3v-l3lI0ZMlDZPGJAyd3jsVnd5JXc6CZlmdxSQMk8UxHPyYbk7Sn24cjMQxHPqZZVvRkypP2Z1VW82eZVLYwD5jxc48Y4vCI4C1gDJWiIVMXssRDTmrPME9aeZPSc-ZelmSpX5T3p1iU9Gb1jnYmCdp7gnJ"); + .requestToken("test_lZWva9rsNe3u0_EIc6R8V3t5beV38piPAQbhgREGygYCAo2FRSv1tAQ4-cb6ArKHOWK_zG18hO1uZ8K0LDbNqU9njuhscoLyaj3NyGxyiO0iS4ziIkm-oVom3LEsN9i6InSbuzo-w7ErJqrkYW2CrjA23LEyN92wIkCE82dggvktPtWvMmrl42Bj2uM7Zdn2AQGXC6qGTIECRlwaAgZcgcAGeX4"); - FilterUser user = new FilterUser() - .email("12345"); + User user = new User() + .email("Rhea.Franecki@example.org") + .phone("+16175551212"); filter.user(user); + FilterRequestParams filterRequestParams = new FilterRequestParams() + .email("Rhea.Franecki@example.org") + .phone("+16175551212") + .username("superhero123"); + filter.setParams(filterRequestParams); + Context context = new Context() .ip("211.96.77.55") - .addHeadersItem("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15"); + .addHeadersItem("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15") + .addHeadersItem("Accept-Encoding", "gzip, deflate, br") + .addHeadersItem("Accept-Language", "en-us") + .addHeadersItem("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") + .addHeadersItem("Connection", "close") + .addHeadersItem("Host", "castle.io"); filter.context(context); Product product = new Product() - .id("1234"); + .id("string"); filter.product(product); + Session session = new Session() + .id("string") + .createdAt(OffsetDateTime.parse("2019-08-24T14:15:22Z")); + filter.session(session); + AuthenticationMethod authenticationMethod = new AuthenticationMethod() .type(AuthenticationMethodType.SOCIAL) .variant("facebook"); @@ -160,17 +360,92 @@ public void nullable() { filter.putPropertiesItem("property1", new HashMap()); filter.putPropertiesItem("property2", new HashMap()); - filter.createdAt(OffsetDateTime.parse("2022-05-20T09:03:27.468+02:00")); + filter.createdAt(OffsetDateTime.parse("2019-08-24T14:15:22Z")); - FilterAndRiskResponse response = sdk.onRequest(request).filter(filter); + filter.matchingUserId("123"); + filter.skipRequestTokenValidation(false); + filter.skipContextValidation(false); + filter.expand(List.of("all")); - // Check response object - Assert.assertNull(response.getRisk()); - Assert.assertEquals(response.getSignals().size(), 5); - Assert.assertEquals(response.getPolicy().getAction(), Policy.ActionEnum.CHALLENGE); - Assert.assertEquals(response.getPolicy().getId(), "2ee938c8-24c2-4c26-9d25-19511dd75029"); - Assert.assertEquals(response.getPolicy().getRevisionId(), "900b183a-9f6d-4579-8c47-9ddcccf637b4"); - Assert.assertEquals(response.getPolicy().getName(), "Challenge risk >= 60"); - Assert.assertNull(response.getScores()); + return filter; + } + + @Test + public void compareFilterJson() { + Filter filter = createFilter(); + + // Convert filter object to JSON + CastleGsonModel gson = new CastleGsonModel(); + String filterJson = gson.getGson().toJson(filter); + + // Provided JSON + String providedJson = "{\n" + + " \"context\": {\n" + + " \"headers\": [\n" + + " [\n" + + " \"User-Agent\",\n" + + " \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15\"\n" + + " ],\n" + + " [\n" + + " \"Accept-Encoding\",\n" + + " \"gzip, deflate, br\"\n" + + " ],\n" + + " [\n" + + " \"Accept-Language\",\n" + + " \"en-us\"\n" + + " ],\n" + + " [\n" + + " \"Accept\",\n" + + " \"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\"\n" + + " ],\n" + + " [\n" + + " \"Connection\",\n" + + " \"close\"\n" + + " ],\n" + + " [\n" + + " \"Host\",\n" + + " \"castle.io\"\n" + + " ]\n" + + " ],\n" + + " \"ip\": \"211.96.77.55\"\n" + + " },\n" + + " \"properties\": {\n" + + " \"property1\": {},\n" + + " \"property2\": {}\n" + + " },\n" + + " \"product\": {\n" + + " \"id\": \"string\"\n" + + " },\n" + + " \"session\": {\n" + + " \"id\": \"string\",\n" + + " \"created_at\": \"2019-08-24T14:15:22Z\"\n" + + " },\n" + + " \"created_at\": \"2019-08-24T14:15:22Z\",\n" + + " \"request_token\": \"test_lZWva9rsNe3u0_EIc6R8V3t5beV38piPAQbhgREGygYCAo2FRSv1tAQ4-cb6ArKHOWK_zG18hO1uZ8K0LDbNqU9njuhscoLyaj3NyGxyiO0iS4ziIkm-oVom3LEsN9i6InSbuzo-w7ErJqrkYW2CrjA23LEyN92wIkCE82dggvktPtWvMmrl42Bj2uM7Zdn2AQGXC6qGTIECRlwaAgZcgcAGeX4\",\n" + + " \"user\": {\n" + + " \"email\": \"Rhea.Franecki@example.org\",\n" + + " \"phone\": \"+16175551212\"\n" + + " },\n" + + " \"params\": {\n" + + " \"email\": \"Rhea.Franecki@example.org\",\n" + + " \"phone\": \"+16175551212\",\n" + + " \"username\": \"superhero123\"\n" + + " },\n" + + " \"matching_user_id\": \"123\",\n" + + " \"skip_request_token_validation\": false,\n" + + " \"skip_context_validation\": false,\n" + + " \"expand\": [\n" + + " \"all\"\n" + + " ],\n" + + " \"type\": \"$login\",\n" + + " \"status\": \"$attempted\",\n" + + " \"authentication_method\": {\n" + + " \"type\": \"$social\",\n" + + " \"variant\": \"facebook\"\n" + + " }\n" + + "}"; + + // Compare the JSON strings + Assert.assertEquals(JsonParser.parseString(providedJson), JsonParser.parseString(filterJson)); } } diff --git a/src/test/java/io/castle/client/CastleRiskHttpTest.java b/src/test/java/io/castle/client/CastleRiskHttpTest.java index 777db30..1839050 100644 --- a/src/test/java/io/castle/client/CastleRiskHttpTest.java +++ b/src/test/java/io/castle/client/CastleRiskHttpTest.java @@ -1,19 +1,20 @@ package io.castle.client; import com.google.gson.JsonParser; +import io.castle.client.internal.json.CastleGsonModel; import io.castle.client.model.AuthenticateAction; import io.castle.client.model.AuthenticateFailoverStrategy; import io.castle.client.model.generated.*; import jakarta.servlet.http.HttpServletRequest; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.RecordedRequest; -import org.assertj.core.api.Assertions; import org.junit.Assert; import org.junit.Test; import org.springframework.mock.web.MockHttpServletRequest; import org.threeten.bp.OffsetDateTime; import java.util.HashMap; +import java.util.List; public class CastleRiskHttpTest extends AbstractCastleHttpLayerTest { @@ -27,7 +28,7 @@ public CastleRiskHttpTest() { " \"risk\": 0.65,\n" + " \"scores\": {\n" + " \"account_abuse\": {\n" + - " \"score\": 0.65\n" + + " \"score\": 0.65\n" + " },\n" + " \"account_takeover\": {\n" + " \"score\": 0.77\n" + @@ -49,9 +50,163 @@ public CastleRiskHttpTest() { " \"spoofed_device\": {},\n" + " \"multiple_accounts_per_device\": {}\n" + " },\n" + + " \"metrics\": {\n" + + " \"1\": {},\n" + + " \"2\": {},\n" + + " \"3\": {},\n" + + " \"4\": {},\n" + + " \"5\": {}\n" + + " },\n" + " \"device\": {\n" + - " \"fingerprint\": \"eyJhbGciOiJIUzI1NiJ9.eyJ0b2tlbiI6IjEzc2x6RzNHQ0RzeFJCejdJWF9SUDJkV1Y0RFgiLCJxdWFsaWZpZXIiOiJBUUlEQ2pFME5EZzFPREF3T1RZIiwiYW5vbnltb3VzIjpmYWxzZSwidmVyc2lvbiI6MC4zfQ.y3vOt-W1IpOi7Oyn1jll1uDw1YL-JPZtNMTU-PyaYhQ\"\n" + - " }\n" + + " \"user_agent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36\",\n" + + " \"fingerprint\": \"ohvjn8adSnetYTzZ8B7bOP\",\n" + + " \"hardware\": {\n" + + " \"type\": \"computer\",\n" + + " \"name\": null,\n" + + " \"brand\": null,\n" + + " \"display\": {\n" + + " \"width\": 1512,\n" + + " \"height\": 982\n" + + " },\n" + + " \"model\": {\n" + + " \"name\": null,\n" + + " \"code\": null\n" + + " }\n" + + " },\n" + + " \"os\": {\n" + + " \"name\": \"Windows 10\",\n" + + " \"version\": {\n" + + " \"major\": \"10\",\n" + + " \"full\": null\n" + + " }\n" + + " },\n" + + " \"software\": {\n" + + " \"type\": \"browser\",\n" + + " \"name\": \"Chrome\",\n" + + " \"languages\": [\n" + + " \"en-us\",\n" + + " \"en\"\n" + + " ],\n" + + " \"version\": {\n" + + " \"major\": \"91\",\n" + + " \"full\": \"91.0.4472\"\n" + + " },\n" + + " \"fingerprint\": \"vOch_0a_fpkl1Tf-pVPuDA\"\n" + + " },\n" + + " \"timezone\": {\n" + + " \"offset\": -300,\n" + + " \"name\": \"America/New_York\"\n" + + " },\n" + + " \"screen\": {\n" + + " \"screen\": 2,\n" + + " \"orientation\": \"landscape\"\n" + + " },\n" + + " \"token\": \"eyJhbGciOiJIUzI1NiJ9.eyJ0b2tlbiI6IjEzc2x6RzNHQ0RzeFJCejdJWF9SUDJkV1Y0RFgiLCJxdWFsaWZpZXIiOiJBUUlEQ2pFME5EZzFPREF3T1RZIiwiYW5vbnltb3VzIjpmYWxzZSwidmVyc2lvbiI6MC4zfQ.y3vOt-W1IpOi7Oyn1jll1uDw1YL-JPZtNMTU-PyaYhQ\"\n" + + " },\n" + + " \"id\": \"ASZoelALT5-PaVw2pAVMXg\",\n" + + " \"name\": \"Login Succeeded\",\n" + + " \"type\": \"$challenge\",\n" + + " \"status\": \"$succeeded\",\n" + + " \"created_at\": \"2021-09-27T16:46:38.313Z\",\n" + + " \"authenticated\": true,\n" + + " \"authentication_method\": {\n" + + " \"type\": \"$social\",\n" + + " \"variant\": \"facebook\"\n" + + " },\n" + + " \"email\": {\n" + + " \"normalized\": \"user.email@example.com\",\n" + + " \"domain\": \"gmail.com\",\n" + + " \"disposable\": false,\n" + + " \"unreachable\": false,\n" + + " \"domain_details\": {\n" + + " \"created_at\": \"2021-09-27T16:46:38.313Z\",\n" + + " \"updated_at\": \"2021-09-27T16:46:38.313Z\",\n" + + " \"expires_at\": \"2021-09-27T16:46:38.313Z\",\n" + + " \"registrar\": \"string\",\n" + + " \"nameservers\": [\n" + + " \"ns1.hosting.com\",\n" + + " \"ns2.hosting.com\",\n" + + " \"ns3.hosting.com\"\n" + + " ],\n" + + " \"spf_record\": {\n" + + " \"exists\": false\n" + + " },\n" + + " \"dmarc_record\": {\n" + + " \"exists\": false\n" + + " },\n" + + " \"mx_records\": {\n" + + " \"null_mx\": false\n" + + " }\n" + + " }\n" + + " },\n" + + " \"endpoint\": \"/v1/risk\",\n" + + " \"ip\": {\n" + + " \"asn\": 14618,\n" + + " \"location\": {\n" + + " \"city\": \"Ashburn\",\n" + + " \"continent_code\": \"NA\",\n" + + " \"country_code\": \"US\",\n" + + " \"postal_code\": \"20149\",\n" + + " \"region_code\": \"VA\",\n" + + " \"latitude\": 52.3583,\n" + + " \"longitude\": 4.8488\n" + + " },\n" + + " \"address\": \"34.200.81.5\",\n" + + " \"isp\": {\n" + + " \"name\": \"verizon fios\",\n" + + " \"organization\": \"verizon fios\"\n" + + " },\n" + + " \"type\": \"ipv4\",\n" + + " \"privacy\": {\n" + + " \"anonymous\": false,\n" + + " \"datacenter\": false,\n" + + " \"proxy\": false,\n" + + " \"tor\": false\n" + + " }\n" + + " },\n" + + " \"params\": {\n" + + " \"email\": \"Rhea.Franecki@example.org\",\n" + + " \"phone\": \"+16175551212\",\n" + + " \"username\": \"superhero123\"\n" + + " },\n" + + " \"product\": {\n" + + " \"id\": \"string\"\n" + + " },\n" + + " \"sdks\": {\n" + + " \"client\": {\n" + + " \"name\": \"castle-web\",\n" + + " \"version\": \"2.0.0\"\n" + + " },\n" + + " \"server\": {\n" + + " \"name\": \"castle-postman\",\n" + + " \"version\": \"0.1.0\"\n" + + " }\n" + + " },\n" + + " \"session\": {\n" + + " \"id\": \"string\",\n" + + " \"created_at\": \"2019-08-24T14:15:22Z\"\n" + + " },\n" + + " \"user\": {\n" + + " \"id\": \"string\",\n" + + " \"email\": \"пошта@укр.нет\",\n" + + " \"phone\": \"string\",\n" + + " \"registered_at\": \"2019-08-24T14:15:22Z\",\n" + + " \"name\": \"string\",\n" + + " \"traits\": {},\n" + + " \"address\": {\n" + + " \"line1\": \"60 Rausch Street\",\n" + + " \"line2\": \"string\",\n" + + " \"city\": \"San Francisco\",\n" + + " \"country_code\": \"US\",\n" + + " \"region_code\": \"CA\",\n" + + " \"postal_code\": \"94103\",\n" + + " \"fingerprint\": \"8a33j2lir9\"\n" + + " }\n" + + " },\n" + + " \"behavior\": {\n" + + " \"fingerprint\": \"vOch_0a_fpkl1Tf-pVPuDA\"\n" + + " },\n" + + " \"properties\": {}\n" + "}"); mockResponse.setResponseCode(201); server.enqueue(mockResponse); @@ -59,146 +214,223 @@ public CastleRiskHttpTest() { // And a mock Request HttpServletRequest request = new MockHttpServletRequest(); - Risk risk = new Risk().type(Risk.TypeEnum.PROFILE_UPDATE) - .status(Risk.StatusEnum.SUCCEEDED) - .requestToken("4-ugt5CFooaxt5KbpISi1Kurm5KTpqawlYmFs5PXsqKootPgRB3z12OpvPOWOQ9PkztagtqicAnk9Qowu7FlU9qabyi4k2QR6KUUL5p3gr-A2w8Ju8gWe0XyRi_OkmFj2oZiU9OTPAjijjIK4sA-a7f19GC_xzhYurdkWM-ZY1jR_l4R8JloVdGTfj7IhXY6_pd5SNGThjmM2DoSjWNup74xC3v-l3lI0ZMlDZPGJAyd3jsVnd5JXc6CZlmdxSQMk8UxHPyYbk7Sn24cjMQxHPqZZVvRkypP2Z1VW82eZVLYwD5jxc48Y4vCI4C1gDJWiIVMXssRDTmrPME9aeZPSc-ZelmSpX5T3p1iU9Gb1jnYmCdp7gnJ"); - - RiskUser user = new RiskUser() - .id("12345"); - risk.user(user); - - Context context = new Context() - .ip("211.96.77.55") - .addHeadersItem("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15"); - risk.context(context); - - Changeset changeSet = new Changeset() - .email(new ChangesetEntry() - .from(null) - .to("after@example.com")) - .password(new ChangedChangesetEntry()) - .authenticationMethodType(new ChangesetEntry() - .from("$authenticator") - .to("$email")) - .name(new ChangesetEntry() - .from("Jon Snow") - .to("King of the North")); - risk.changeset(changeSet); - - Product product = new Product() - .id("1234"); - risk.product(product); - - risk.putPropertiesItem("property1", new HashMap()); - risk.putPropertiesItem("property2", new HashMap()); - - risk.createdAt(OffsetDateTime.parse("2022-05-20T09:03:27.468+02:00")); + Risk risk = createRisk(); FilterAndRiskResponse response = sdk.onRequest(request).risk(risk); // Check response object Assert.assertNotNull(response.getRisk()); - Assert.assertEquals(response.getRisk(), 0.65, 0); - Assert.assertEquals(response.getSignals().size(), 5); - Assert.assertEquals(response.getDevice().getFingerprint(), "eyJhbGciOiJIUzI1NiJ9.eyJ0b2tlbiI6IjEzc2x6RzNHQ0RzeFJCejdJWF9SUDJkV1Y0RFgiLCJxdWFsaWZpZXIiOiJBUUlEQ2pFME5EZzFPREF3T1RZIiwiYW5vbnltb3VzIjpmYWxzZSwidmVyc2lvbiI6MC4zfQ.y3vOt-W1IpOi7Oyn1jll1uDw1YL-JPZtNMTU-PyaYhQ"); - Assert.assertEquals(response.getPolicy().getAction(), Policy.ActionEnum.CHALLENGE); - Assert.assertEquals(response.getPolicy().getId(), "2ee938c8-24c2-4c26-9d25-19511dd75029"); - Assert.assertEquals(response.getPolicy().getRevisionId(), "900b183a-9f6d-4579-8c47-9ddcccf637b4"); - Assert.assertEquals(response.getPolicy().getName(), "Challenge risk >= 60"); + Assert.assertEquals(0.65, response.getRisk(), 0); + Assert.assertEquals(5, response.getSignals().size()); + Assert.assertEquals(5, response.getMetrics().size()); + Assert.assertEquals("ohvjn8adSnetYTzZ8B7bOP", response.getDevice().getFingerprint()); + Assert.assertEquals("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36", response.getDevice().getUserAgent()); + + Assert.assertEquals("America/New_York", response.getDevice().getTimezone().getName()); + Assert.assertEquals(-300, response.getDevice().getTimezone().getOffset()); + + Assert.assertEquals(2, response.getDevice().getScreen().getScreen()); + Assert.assertEquals("landscape", response.getDevice().getScreen().getOrientation()); + Assert.assertEquals("ASZoelALT5-PaVw2pAVMXg", response.getId()); + + Assert.assertEquals(Policy.ActionEnum.CHALLENGE, response.getPolicy().getAction()); + Assert.assertEquals("2ee938c8-24c2-4c26-9d25-19511dd75029", response.getPolicy().getId()); + Assert.assertEquals("900b183a-9f6d-4579-8c47-9ddcccf637b4", response.getPolicy().getRevisionId()); + Assert.assertEquals("Challenge risk >= 60", response.getPolicy().getName()); + + Assert.assertEquals(1512, response.getDevice().getHardware().getDisplay().getWidth()); + Assert.assertEquals(982, response.getDevice().getHardware().getDisplay().getHeight()); + + Assert.assertEquals("Chrome", response.getDevice().getSoftware().getName()); + Assert.assertEquals("vOch_0a_fpkl1Tf-pVPuDA", response.getDevice().getSoftware().getFingerprint()); + Assert.assertEquals("browser", response.getDevice().getSoftware().getType()); + + Assert.assertEquals(2, response.getDevice().getSoftware().getLanguages().size()); + Assert.assertEquals("en-us", response.getDevice().getSoftware().getLanguages().get(0)); + Assert.assertEquals("en", response.getDevice().getSoftware().getLanguages().get(1)); + + Assert.assertEquals("91", response.getDevice().getSoftware().getVersion().getMajor()); + Assert.assertEquals("91.0.4472", response.getDevice().getSoftware().getVersion().getFull()); + + Assert.assertEquals("vOch_0a_fpkl1Tf-pVPuDA", response.getBehavior().getFingerprint()); + + Assert.assertEquals("ns1.hosting.com", response.getEmail().getDomainDetails().getNameservers().get(0)); + Assert.assertEquals("ns2.hosting.com", response.getEmail().getDomainDetails().getNameservers().get(1)); + Assert.assertEquals("ns3.hosting.com", response.getEmail().getDomainDetails().getNameservers().get(2)); + Assert.assertEquals(false, response.getEmail().getDomainDetails().getSpfRecord().isExists()); + Assert.assertEquals(false, response.getEmail().getDomainDetails().getDmarcRecord().isExists()); + Assert.assertEquals(false, response.getEmail().getDomainDetails().getMxRecords().isNullMx()); + + Assert.assertEquals("string", response.getProduct().getId()); + + Assert.assertEquals("castle-web", response.getSdks().getClient().getName()); + Assert.assertEquals("2.0.0", response.getSdks().getClient().getVersion()); + Assert.assertEquals("castle-postman", response.getSdks().getServer().getName()); + Assert.assertEquals("0.1.0", response.getSdks().getServer().getVersion()); + + Assert.assertEquals("string", response.getSession().getId()); + Assert.assertEquals(OffsetDateTime.parse("2019-08-24T14:15:22Z"), response.getSession().getCreatedAt()); + + Assert.assertEquals("string", response.getUser().getId()); + Assert.assertEquals("пошта@укр.нет", response.getUser().getEmail()); + Assert.assertEquals("string", response.getUser().getPhone()); + Assert.assertEquals(OffsetDateTime.parse("2019-08-24T14:15:22Z"), response.getUser().getRegisteredAt()); + Assert.assertEquals("string", response.getUser().getName()); + + Assert.assertEquals("60 Rausch Street", response.getUser().getAddress().getLine1()); + Assert.assertEquals("string", response.getUser().getAddress().getLine2()); + Assert.assertEquals("San Francisco", response.getUser().getAddress().getCity()); + Assert.assertEquals("US", response.getUser().getAddress().getCountryCode()); + Assert.assertEquals("CA", response.getUser().getAddress().getRegionCode()); + Assert.assertEquals("94103", response.getUser().getAddress().getPostalCode()); + Assert.assertEquals("8a33j2lir9", response.getUser().getAddress().getFingerprint()); // Then RecordedRequest recordedRequest = server.takeRequest(); Assert.assertEquals(testServerBaseUrl.resolve("v1/risk"), recordedRequest.getRequestUrl()); Assert.assertEquals("POST", recordedRequest.getMethod()); - - String body = recordedRequest.getBody().readUtf8(); - - String expected = "{\"context\":{\"headers\":[[\"User-Agent\",\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15\"]],\"ip\":\"211.96.77.55\"},\"properties\":{\"property2\":{},\"property1\":{}},\"product\":{\"id\":\"1234\"},\"created_at\":\"2022-05-20T09:03:27.468+02:00\",\"request_token\":\"4-ugt5CFooaxt5KbpISi1Kurm5KTpqawlYmFs5PXsqKootPgRB3z12OpvPOWOQ9PkztagtqicAnk9Qowu7FlU9qabyi4k2QR6KUUL5p3gr-A2w8Ju8gWe0XyRi_OkmFj2oZiU9OTPAjijjIK4sA-a7f19GC_xzhYurdkWM-ZY1jR_l4R8JloVdGTfj7IhXY6_pd5SNGThjmM2DoSjWNup74xC3v-l3lI0ZMlDZPGJAyd3jsVnd5JXc6CZlmdxSQMk8UxHPyYbk7Sn24cjMQxHPqZZVvRkypP2Z1VW82eZVLYwD5jxc48Y4vCI4C1gDJWiIVMXssRDTmrPME9aeZPSc-ZelmSpX5T3p1iU9Gb1jnYmCdp7gnJ\",\"user\":{\"id\":\"12345\"},\"skip_request_token_validation\":false,\"skip_context_validation\":false,\"type\":\"$profile_update\",\"status\":\"$succeeded\",\"changeset\":{\"password\":{\"changed\":true},\"email\":{\"from\":null,\"to\":\"after@example.com\"},\"authentication_method.type\":{\"from\":\"$authenticator\",\"to\":\"$email\"},\"name\":{\"from\":\"Jon Snow\",\"to\":\"King of the North\"}}}"; - Assertions.assertThat(JsonParser.parseString(body)).isEqualTo(JsonParser.parseString(expected)); } - @Test public void nullable() throws InterruptedException { - MockResponse mockResponse = new MockResponse(); - mockResponse.setBody("{\n" + - " \"policy\": {\n" + - " \"name\": \"Challenge risk >= 60\",\n" + - " \"id\": \"2ee938c8-24c2-4c26-9d25-19511dd75029\",\n" + - " \"revision_id\": \"900b183a-9f6d-4579-8c47-9ddcccf637b4\",\n" + - " \"action\": \"challenge\"\n" + - " },\n" + - " \"signals\": {\n" + - " \"bot_behavior\": {},\n" + - " \"proxy_ip\": {},\n" + - " \"disposable_email\": {},\n" + - " \"spoofed_device\": {},\n" + - " \"multiple_accounts_per_device\": {}\n" + - " },\n" + - " \"device\": {\n" + - " \"fingerprint\": \"eyJhbGciOiJIUzI1NiJ9.eyJ0b2tlbiI6IjEzc2x6RzNHQ0RzeFJCejdJWF9SUDJkV1Y0RFgiLCJxdWFsaWZpZXIiOiJBUUlEQ2pFME5EZzFPREF3T1RZIiwiYW5vbnltb3VzIjpmYWxzZSwidmVyc2lvbiI6MC4zfQ.y3vOt-W1IpOi7Oyn1jll1uDw1YL-JPZtNMTU-PyaYhQ\"\n" + - " }\n" + - "}"); - mockResponse.setResponseCode(201); - server.enqueue(mockResponse); - - // And a mock Request - HttpServletRequest request = new MockHttpServletRequest(); - - Risk risk = new Risk().type(Risk.TypeEnum.PROFILE_UPDATE) + private Risk createRisk() { + Risk risk = new Risk().type(Risk.TypeEnum.LOGIN) .status(Risk.StatusEnum.SUCCEEDED) - .requestToken("4-ugt5CFooaxt5KbpISi1Kurm5KTpqawlYmFs5PXsqKootPgRB3z12OpvPOWOQ9PkztagtqicAnk9Qowu7FlU9qabyi4k2QR6KUUL5p3gr-A2w8Ju8gWe0XyRi_OkmFj2oZiU9OTPAjijjIK4sA-a7f19GC_xzhYurdkWM-ZY1jR_l4R8JloVdGTfj7IhXY6_pd5SNGThjmM2DoSjWNup74xC3v-l3lI0ZMlDZPGJAyd3jsVnd5JXc6CZlmdxSQMk8UxHPyYbk7Sn24cjMQxHPqZZVvRkypP2Z1VW82eZVLYwD5jxc48Y4vCI4C1gDJWiIVMXssRDTmrPME9aeZPSc-ZelmSpX5T3p1iU9Gb1jnYmCdp7gnJ"); + .requestToken("test_lZWva9rsNe3u0_EIc6R8V3t5beV38piPAQbhgREGygYCAo2FRSv1tAQ4-cb6ArKHOWK_zG18hO1uZ8K0LDbNqU9njuhscoLyaj3NyGxyiO0iS4ziIkm-oVom3LEsN9i6InSbuzo-w7ErJqrkYW2CrjA23LEyN92wIkCE82dggvktPtWvMmrl42Bj2uM7Zdn2AQGXC6qGTIECRlwaAgZcgcAGeX4"); RiskUser user = new RiskUser() - .id("12345"); + .id("string") + .email("пошта@укр.нет") + .phone("string") + .registeredAt(OffsetDateTime.parse("2019-08-24T14:15:22Z")) + .name("string") + .traits(new HashMap<>()) + .address(new Address() + .line1("60 Rausch Street") + .line2("string") + .city("San Francisco") + .countryCode("US") + .regionCode("CA") + .postalCode("94103") + .fingerprint("8a33j2lir9")); risk.user(user); Context context = new Context() .ip("211.96.77.55") - .addHeadersItem("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15"); + .addHeadersItem("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15") + .addHeadersItem("Accept-Encoding", "gzip, deflate, br") + .addHeadersItem("Accept-Language", "en-us") + .addHeadersItem("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") + .addHeadersItem("Connection", "close") + .addHeadersItem("Host", "castle.io"); risk.context(context); - Changeset changeSet = new Changeset() - .email(new ChangesetEntry() - .from("before@exmaple.com") - .to("after@example.com")) - .password(new ChangedChangesetEntry()) - .authenticationMethodType(new ChangesetEntry() - .from("$authenticator") - .to("$email")) - .name(new ChangesetEntry() - .from("Jon Snow") - .to("King of the North")); - risk.changeset(changeSet); - - Product product = new Product() - .id("1234"); + Product product = new Product().id("string"); risk.product(product); + Session session = new Session() + .id("string") + .createdAt(OffsetDateTime.parse("2019-08-24T14:15:22Z")); + risk.session(session); + risk.putPropertiesItem("property1", new HashMap()); risk.putPropertiesItem("property2", new HashMap()); - risk.createdAt(OffsetDateTime.parse("2022-05-20T09:03:27.468+02:00")); + risk.createdAt(OffsetDateTime.parse("2019-08-24T14:15:22Z")); - FilterAndRiskResponse response = sdk.onRequest(request).risk(risk); - - // Check response object - Assert.assertNull(response.getRisk()); - Assert.assertEquals(response.getSignals().size(), 5); - Assert.assertEquals(response.getDevice().getFingerprint(), "eyJhbGciOiJIUzI1NiJ9.eyJ0b2tlbiI6IjEzc2x6RzNHQ0RzeFJCejdJWF9SUDJkV1Y0RFgiLCJxdWFsaWZpZXIiOiJBUUlEQ2pFME5EZzFPREF3T1RZIiwiYW5vbnltb3VzIjpmYWxzZSwidmVyc2lvbiI6MC4zfQ.y3vOt-W1IpOi7Oyn1jll1uDw1YL-JPZtNMTU-PyaYhQ"); - Assert.assertEquals(response.getPolicy().getAction(), Policy.ActionEnum.CHALLENGE); - Assert.assertEquals(response.getPolicy().getId(), "2ee938c8-24c2-4c26-9d25-19511dd75029"); - Assert.assertEquals(response.getPolicy().getRevisionId(), "900b183a-9f6d-4579-8c47-9ddcccf637b4"); - Assert.assertEquals(response.getPolicy().getName(), "Challenge risk >= 60"); - Assert.assertNull(response.getRisk()); + risk.skipContextValidation(false); + risk.skipRequestTokenValidation(false); + risk.expand(List.of("all")); + AuthenticationMethod authenticationMethod = new AuthenticationMethod() + .type(AuthenticationMethodType.SOCIAL) + .variant("facebook"); + risk.authenticationMethod(authenticationMethod); - // Then - RecordedRequest recordedRequest = server.takeRequest(); - Assert.assertEquals(testServerBaseUrl.resolve("v1/risk"), recordedRequest.getRequestUrl()); - Assert.assertEquals("POST", recordedRequest.getMethod()); + return risk; + } - String body = recordedRequest.getBody().readUtf8(); + @Test + public void compareRiskJson() { + Risk risk = createRisk(); + + // Convert risk object to JSON + CastleGsonModel gson = new CastleGsonModel(); + String riskJson = gson.getGson().toJson(risk); + + // Provided JSON + String providedJson = "{\n" + + " \"context\": {\n" + + " \"headers\": [\n" + + " [\n" + + " \"User-Agent\",\n" + + " \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15\"\n" + + " ],\n" + + " [\n" + + " \"Accept-Encoding\",\n" + + " \"gzip, deflate, br\"\n" + + " ],\n" + + " [\n" + + " \"Accept-Language\",\n" + + " \"en-us\"\n" + + " ],\n" + + " [\n" + + " \"Accept\",\n" + + " \"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\"\n" + + " ],\n" + + " [\n" + + " \"Connection\",\n" + + " \"close\"\n" + + " ],\n" + + " [\n" + + " \"Host\",\n" + + " \"castle.io\"\n" + + " ]\n" + + " ],\n" + + " \"ip\": \"211.96.77.55\"\n" + + " },\n" + + " \"properties\": {\n" + + " \"property1\": {},\n" + + " \"property2\": {}\n" + + " },\n" + + " \"product\": {\n" + + " \"id\": \"string\"\n" + + " },\n" + + " \"session\": {\n" + + " \"id\": \"string\",\n" + + " \"created_at\": \"2019-08-24T14:15:22Z\"\n" + + " },\n" + + " \"created_at\": \"2019-08-24T14:15:22Z\",\n" + + " \"request_token\": \"test_lZWva9rsNe3u0_EIc6R8V3t5beV38piPAQbhgREGygYCAo2FRSv1tAQ4-cb6ArKHOWK_zG18hO1uZ8K0LDbNqU9njuhscoLyaj3NyGxyiO0iS4ziIkm-oVom3LEsN9i6InSbuzo-w7ErJqrkYW2CrjA23LEyN92wIkCE82dggvktPtWvMmrl42Bj2uM7Zdn2AQGXC6qGTIECRlwaAgZcgcAGeX4\",\n" + + " \"user\": {\n" + + " \"id\": \"string\",\n" + + " \"email\": \"пошта@укр.нет\",\n" + + " \"phone\": \"string\",\n" + + " \"registered_at\": \"2019-08-24T14:15:22Z\",\n" + + " \"name\": \"string\",\n" + + " \"traits\": {},\n" + + " \"address\": {\n" + + " \"line1\": \"60 Rausch Street\",\n" + + " \"line2\": \"string\",\n" + + " \"city\": \"San Francisco\",\n" + + " \"country_code\": \"US\",\n" + + " \"region_code\": \"CA\",\n" + + " \"postal_code\": \"94103\",\n" + + " \"fingerprint\": \"8a33j2lir9\"\n" + + " }\n" + + " },\n" + + " \"skip_request_token_validation\": false,\n" + + " \"skip_context_validation\": false,\n" + + " \"expand\": [\n" + + " \"all\"\n" + + " ],\n" + + " \"type\": \"$login\",\n" + + " \"status\": \"$succeeded\",\n" + + " \"authentication_method\": {\n" + + " \"type\": \"$social\",\n" + + " \"variant\": \"facebook\"\n" + + " }\n" + + "}"; - String expected = "{\"context\":{\"headers\":[[\"User-Agent\",\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15\"]],\"ip\":\"211.96.77.55\"},\"properties\":{\"property2\":{},\"property1\":{}},\"product\":{\"id\":\"1234\"},\"created_at\":\"2022-05-20T09:03:27.468+02:00\",\"request_token\":\"4-ugt5CFooaxt5KbpISi1Kurm5KTpqawlYmFs5PXsqKootPgRB3z12OpvPOWOQ9PkztagtqicAnk9Qowu7FlU9qabyi4k2QR6KUUL5p3gr-A2w8Ju8gWe0XyRi_OkmFj2oZiU9OTPAjijjIK4sA-a7f19GC_xzhYurdkWM-ZY1jR_l4R8JloVdGTfj7IhXY6_pd5SNGThjmM2DoSjWNup74xC3v-l3lI0ZMlDZPGJAyd3jsVnd5JXc6CZlmdxSQMk8UxHPyYbk7Sn24cjMQxHPqZZVvRkypP2Z1VW82eZVLYwD5jxc48Y4vCI4C1gDJWiIVMXssRDTmrPME9aeZPSc-ZelmSpX5T3p1iU9Gb1jnYmCdp7gnJ\",\"user\":{\"id\":\"12345\"},\"skip_request_token_validation\":false,\"skip_context_validation\":false,\"type\":\"$profile_update\",\"status\":\"$succeeded\",\"changeset\":{\"password\":{\"changed\":true},\"email\":{\"from\":\"before@exmaple.com\",\"to\":\"after@example.com\"},\"authentication_method.type\":{\"from\":\"$authenticator\",\"to\":\"$email\"},\"name\":{\"from\":\"Jon Snow\",\"to\":\"King of the North\"}}}"; - Assertions.assertThat(JsonParser.parseString(body)).isEqualTo(JsonParser.parseString(expected)); + // Compare the JSON strings + Assert.assertEquals(JsonParser.parseString(providedJson), JsonParser.parseString(riskJson)); } }