11package com .maxmind .minfraud .response ;
22
33import com .fasterxml .jackson .annotation .JsonProperty ;
4+ import com .maxmind .geoip2 .record .Anonymizer ;
45import com .maxmind .geoip2 .record .City ;
56import com .maxmind .geoip2 .record .Continent ;
67import com .maxmind .geoip2 .record .Country ;
1415/**
1516 * This class contains minFraud response data related to the IP location.
1617 *
18+ * @param anonymizer Anonymizer record for the requested IP address. This contains
19+ * information about whether the IP address is an anonymous network.
1720 * @param city City record for the requested IP address.
1821 * @param continent Continent record for the requested IP address.
1922 * @param country Country record for the requested IP address.
2932 * @param traits Traits record for the requested IP address.
3033 */
3134public record IpAddress (
35+ @ JsonProperty ("anonymizer" )
36+ Anonymizer anonymizer ,
3237 @ JsonProperty ("city" )
3338 City city ,
3439
@@ -67,6 +72,7 @@ public record IpAddress(
6772 * Compact canonical constructor that sets defaults for null values.
6873 */
6974 public IpAddress {
75+ anonymizer = anonymizer != null ? anonymizer : new Anonymizer ();
7076 location = location != null ? location : new GeoIp2Location ();
7177 riskReasons = riskReasons != null ? List .copyOf (riskReasons ) : List .of ();
7278 subdivisions = subdivisions != null ? List .copyOf (subdivisions ) : List .of ();
@@ -77,7 +83,42 @@ public record IpAddress(
7783 */
7884 public IpAddress () {
7985 this (null , null , null , null , null , null ,
80- null , null , null , null , null );
86+ null , null , null , null , null , null );
87+ }
88+
89+ /**
90+ * Constructs an instance of {@code IpAddress}.
91+ *
92+ * @param city City record for the requested IP address.
93+ * @param continent Continent record for the requested IP address.
94+ * @param country Country record for the requested IP address.
95+ * @param location Location record for the requested IP address.
96+ * @param postal Postal record for the requested IP address.
97+ * @param registeredCountry Registered country record for the requested IP address.
98+ * @param representedCountry Represented country record for the requested IP address.
99+ * @param risk The risk associated with the IP address.
100+ * @param riskReasons List of risk reason objects.
101+ * @param subdivisions List of subdivision records for the requested IP address.
102+ * @param traits Traits record for the requested IP address.
103+ * @deprecated Use the canonical constructor instead. This constructor will be removed in 5.0.0.
104+ */
105+ @ Deprecated (since = "4.1.0" , forRemoval = true )
106+ public IpAddress (
107+ City city ,
108+ Continent continent ,
109+ Country country ,
110+ GeoIp2Location location ,
111+ Postal postal ,
112+ Country registeredCountry ,
113+ RepresentedCountry representedCountry ,
114+ Double risk ,
115+ List <IpRiskReason > riskReasons ,
116+ List <Subdivision > subdivisions ,
117+ Traits traits
118+ ) {
119+ this (null , city , continent , country , location , postal ,
120+ registeredCountry , representedCountry , risk , riskReasons ,
121+ subdivisions , traits );
81122 }
82123
83124 /**
0 commit comments