From a9c3c50c75e740c554310de66c9c1f899ddcdd6c Mon Sep 17 00:00:00 2001 From: tanya732 Date: Wed, 5 Feb 2025 18:37:49 +0530 Subject: [PATCH 1/3] added missing fields --- .../json/mgmt/logevents/LocationInfo.java | 154 ++++++++++++++++++ .../auth0/json/mgmt/logevents/LogEvent.java | 59 ++++++- .../json/mgmt/logevents/LogEventTest.java | 7 +- 3 files changed, 216 insertions(+), 4 deletions(-) create mode 100644 src/main/java/com/auth0/json/mgmt/logevents/LocationInfo.java diff --git a/src/main/java/com/auth0/json/mgmt/logevents/LocationInfo.java b/src/main/java/com/auth0/json/mgmt/logevents/LocationInfo.java new file mode 100644 index 000000000..5f5ad0fef --- /dev/null +++ b/src/main/java/com/auth0/json/mgmt/logevents/LocationInfo.java @@ -0,0 +1,154 @@ +package com.auth0.json.mgmt.logevents; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class LocationInfo { + @JsonProperty("country_code") + private String countryCode; + @JsonProperty("country_code3") + private String countryCode3; + @JsonProperty("country_name") + private String countryName; + @JsonProperty("city_name") + private String cityName; + @JsonProperty("latitude") + private String latitude; + @JsonProperty("longitude") + private String longitude; + @JsonProperty("time_zone") + private String timeZone; + @JsonProperty("continent_code") + private String continentCode; + + /** + * Getter for the country code. + * @return the country code. + */ + public String getCountryCode() { + return countryCode; + } + + /** + * Setter for the country code. + * @param countryCode the country code to set. + */ + public void setCountryCode(String countryCode) { + this.countryCode = countryCode; + } + + /** + * Getter for the country code 3. + * @return the country code 3. + */ + public String getCountryCode3() { + return countryCode3; + } + + /** + * Setter for the country code 3. + * @param countryCode3 the country code 3 to set. + */ + public void setCountryCode3(String countryCode3) { + this.countryCode3 = countryCode3; + } + + /** + * Getter for the country name. + * @return the country name. + */ + public String getCountryName() { + return countryName; + } + + /** + * Setter for the country name. + * @param countryName the country name to set. + */ + public void setCountryName(String countryName) { + this.countryName = countryName; + } + + /** + * Getter for the city name. + * @return the city name. + */ + public String getCityName() { + return cityName; + } + + /** + * Setter for the city name. + * @param cityName the city name to set. + */ + public void setCityName(String cityName) { + this.cityName = cityName; + } + + /** + * Getter for the latitude. + * @return the latitude. + */ + public String getLatitude() { + return latitude; + } + + /** + * Setter for the latitude. + * @param latitude the latitude to set. + */ + public void setLatitude(String latitude) { + this.latitude = latitude; + } + + /** + * Getter for the longitude. + * @return the longitude. + */ + public String getLongitude() { + return longitude; + } + + /** + * Setter for the longitude. + * @param longitude the longitude to set. + */ + public void setLongitude(String longitude) { + this.longitude = longitude; + } + + /** + * Getter for the time zone. + * @return the time zone. + */ + public String getTimeZone() { + return timeZone; + } + + /** + * Setter for the time zone. + * @param timeZone the time zone to set. + */ + public void setTimeZone(String timeZone) { + this.timeZone = timeZone; + } + + /** + * Getter for the continent code. + * @return the continent code. + */ + public String getContinentCode() { + return continentCode; + } + + /** + * Setter for the continent code. + * @param continentCode the continent code to set. + */ + public void setContinentCode(String continentCode) { + this.continentCode = continentCode; + } +} diff --git a/src/main/java/com/auth0/json/mgmt/logevents/LogEvent.java b/src/main/java/com/auth0/json/mgmt/logevents/LogEvent.java index e8bc20618..18476f553 100644 --- a/src/main/java/com/auth0/json/mgmt/logevents/LogEvent.java +++ b/src/main/java/com/auth0/json/mgmt/logevents/LogEvent.java @@ -36,7 +36,7 @@ public class LogEvent { @JsonProperty("user_name") private String userName; @JsonProperty("location_info") - private Map locationInfo; + private LocationInfo locationInfo; @JsonProperty("details") private Map details; @JsonProperty("connection") @@ -49,6 +49,16 @@ public class LogEvent { private String hostname; @JsonProperty("audience") private String audience; + @JsonProperty("scope") + private String scope; + @JsonProperty("strategy") + private String strategy; + @JsonProperty("strategy_type") + private String strategyType; + @JsonProperty("isMobile") + private boolean isMobile; + @JsonProperty("user_agent") + private String userAgent; /** * Getter for the id of this event. @@ -131,6 +141,51 @@ public String getUserId() { return userId; } + /** + * Getter for the scope of this event. + * @return the scope. + */ + @JsonProperty("scope") + public String getScope() { + return scope; + } + + /** + * Getter for the strategy of this event. + * @return the strategy. + */ + @JsonProperty("strategy") + public String getStrategy() { + return strategy; + } + + /** + * Getter for the strategy type of this event. + * @return the strategy type. + */ + @JsonProperty("strategy_type") + public String getStrategyType() { + return strategyType; + } + + /** + * Getter for the isMobile flag of this event. + * @return the isMobile flag. + */ + @JsonProperty("isMobile") + public boolean isMobile() { + return isMobile; + } + + /** + * Getter for the user agent related to this event. + * @return the user agent. + */ + @JsonProperty("user_agent") + public String getUserAgent() { + return userAgent; + } + /** * Getter for the user name related to this event. * @@ -147,7 +202,7 @@ public String getUserName() { * @return the location info object. */ @JsonProperty("location_info") - public Map getLocationInfo() { + public LocationInfo getLocationInfo() { return locationInfo; } diff --git a/src/test/java/com/auth0/json/mgmt/logevents/LogEventTest.java b/src/test/java/com/auth0/json/mgmt/logevents/LogEventTest.java index 2caa26c50..68afb40a8 100644 --- a/src/test/java/com/auth0/json/mgmt/logevents/LogEventTest.java +++ b/src/test/java/com/auth0/json/mgmt/logevents/LogEventTest.java @@ -25,7 +25,9 @@ public class LogEventTest extends JsonTest { " \"connection_id\": \"connectionId\",\n" + " \"description\": \"description\",\n" + " \"hostname\": \"hostname\",\n" + - " \"audience\": \"audience\"\n" + + " \"audience\": \"audience\",\n" + + " \"isMobile\": \"false\",\n" + + " \"user_agent\": \"okhttp 4.11.0 / Other 0.0.0\"\n" + "}"; @Test @@ -49,6 +51,7 @@ public void shouldDeserialize() throws Exception { assertThat(logEvent.getConnectionId(), is("connectionId")); assertThat(logEvent.getHostname(), is("hostname")); assertThat(logEvent.getDescription(), is("description")); - + assertThat(logEvent.isMobile(), is(false)); + assertThat(logEvent.getUserAgent(), is("okhttp 4.11.0 / Other 0.0.0")); } } From 5c6f0a72480a1ca082225bfb6b14b8b223622089 Mon Sep 17 00:00:00 2001 From: tanya732 Date: Thu, 6 Feb 2025 00:11:18 +0530 Subject: [PATCH 2/3] remove breaking change --- .../json/mgmt/logevents/LocationInfo.java | 154 ------------------ .../auth0/json/mgmt/logevents/LogEvent.java | 4 +- 2 files changed, 2 insertions(+), 156 deletions(-) delete mode 100644 src/main/java/com/auth0/json/mgmt/logevents/LocationInfo.java diff --git a/src/main/java/com/auth0/json/mgmt/logevents/LocationInfo.java b/src/main/java/com/auth0/json/mgmt/logevents/LocationInfo.java deleted file mode 100644 index 5f5ad0fef..000000000 --- a/src/main/java/com/auth0/json/mgmt/logevents/LocationInfo.java +++ /dev/null @@ -1,154 +0,0 @@ -package com.auth0.json.mgmt.logevents; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; - -@JsonIgnoreProperties(ignoreUnknown = true) -@JsonInclude(JsonInclude.Include.NON_NULL) -public class LocationInfo { - @JsonProperty("country_code") - private String countryCode; - @JsonProperty("country_code3") - private String countryCode3; - @JsonProperty("country_name") - private String countryName; - @JsonProperty("city_name") - private String cityName; - @JsonProperty("latitude") - private String latitude; - @JsonProperty("longitude") - private String longitude; - @JsonProperty("time_zone") - private String timeZone; - @JsonProperty("continent_code") - private String continentCode; - - /** - * Getter for the country code. - * @return the country code. - */ - public String getCountryCode() { - return countryCode; - } - - /** - * Setter for the country code. - * @param countryCode the country code to set. - */ - public void setCountryCode(String countryCode) { - this.countryCode = countryCode; - } - - /** - * Getter for the country code 3. - * @return the country code 3. - */ - public String getCountryCode3() { - return countryCode3; - } - - /** - * Setter for the country code 3. - * @param countryCode3 the country code 3 to set. - */ - public void setCountryCode3(String countryCode3) { - this.countryCode3 = countryCode3; - } - - /** - * Getter for the country name. - * @return the country name. - */ - public String getCountryName() { - return countryName; - } - - /** - * Setter for the country name. - * @param countryName the country name to set. - */ - public void setCountryName(String countryName) { - this.countryName = countryName; - } - - /** - * Getter for the city name. - * @return the city name. - */ - public String getCityName() { - return cityName; - } - - /** - * Setter for the city name. - * @param cityName the city name to set. - */ - public void setCityName(String cityName) { - this.cityName = cityName; - } - - /** - * Getter for the latitude. - * @return the latitude. - */ - public String getLatitude() { - return latitude; - } - - /** - * Setter for the latitude. - * @param latitude the latitude to set. - */ - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - /** - * Getter for the longitude. - * @return the longitude. - */ - public String getLongitude() { - return longitude; - } - - /** - * Setter for the longitude. - * @param longitude the longitude to set. - */ - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - /** - * Getter for the time zone. - * @return the time zone. - */ - public String getTimeZone() { - return timeZone; - } - - /** - * Setter for the time zone. - * @param timeZone the time zone to set. - */ - public void setTimeZone(String timeZone) { - this.timeZone = timeZone; - } - - /** - * Getter for the continent code. - * @return the continent code. - */ - public String getContinentCode() { - return continentCode; - } - - /** - * Setter for the continent code. - * @param continentCode the continent code to set. - */ - public void setContinentCode(String continentCode) { - this.continentCode = continentCode; - } -} diff --git a/src/main/java/com/auth0/json/mgmt/logevents/LogEvent.java b/src/main/java/com/auth0/json/mgmt/logevents/LogEvent.java index 18476f553..64553c517 100644 --- a/src/main/java/com/auth0/json/mgmt/logevents/LogEvent.java +++ b/src/main/java/com/auth0/json/mgmt/logevents/LogEvent.java @@ -36,7 +36,7 @@ public class LogEvent { @JsonProperty("user_name") private String userName; @JsonProperty("location_info") - private LocationInfo locationInfo; + private Map locationInfo; @JsonProperty("details") private Map details; @JsonProperty("connection") @@ -202,7 +202,7 @@ public String getUserName() { * @return the location info object. */ @JsonProperty("location_info") - public LocationInfo getLocationInfo() { + public Map getLocationInfo() { return locationInfo; } From 2e4d9ab6047cddc1b4b6c9ec89f5c610349e5630 Mon Sep 17 00:00:00 2001 From: tanya732 Date: Tue, 18 Feb 2025 10:34:32 +0530 Subject: [PATCH 3/3] added more fields --- .../auth0/json/mgmt/logevents/LogEvent.java | 37 +++++++++++++++++++ .../json/mgmt/logevents/LogEventTest.java | 11 ++++++ 2 files changed, 48 insertions(+) diff --git a/src/main/java/com/auth0/json/mgmt/logevents/LogEvent.java b/src/main/java/com/auth0/json/mgmt/logevents/LogEvent.java index 64553c517..f813d99cc 100644 --- a/src/main/java/com/auth0/json/mgmt/logevents/LogEvent.java +++ b/src/main/java/com/auth0/json/mgmt/logevents/LogEvent.java @@ -59,6 +59,14 @@ public class LogEvent { private boolean isMobile; @JsonProperty("user_agent") private String userAgent; + @JsonProperty("organization_id") + private String organizationId; + @JsonProperty("organization_name") + private String organizationName; + @JsonProperty("tenant_name") + private String tenantName; + @JsonProperty("$event_schema") + private Object eventSchema; /** * Getter for the id of this event. @@ -250,4 +258,33 @@ public String getHostname() { public String getAudience() { return audience; } + + /** + * @return the organization ID. + */ + public String getOrganizationId() { + return organizationId; + } + + /** + * @return the organization name. + */ + public String getOrganizationName() { + return organizationName; + } + + /** + * @return the tenant name. + */ + public String getTenantName() { + return tenantName; + } + + /** + * Getter for the event schema object. + * @return the event schema object. + */ + public Object getEventSchema() { + return eventSchema; + } } diff --git a/src/test/java/com/auth0/json/mgmt/logevents/LogEventTest.java b/src/test/java/com/auth0/json/mgmt/logevents/LogEventTest.java index 68afb40a8..9d9b791fc 100644 --- a/src/test/java/com/auth0/json/mgmt/logevents/LogEventTest.java +++ b/src/test/java/com/auth0/json/mgmt/logevents/LogEventTest.java @@ -26,6 +26,13 @@ public class LogEventTest extends JsonTest { " \"description\": \"description\",\n" + " \"hostname\": \"hostname\",\n" + " \"audience\": \"audience\",\n" + + " \"organization_id\": \"org_1\",\n" + + " \"organization_name\": \"org2\",\n" + + " \"$event_schema\": {\n" + + " \"version\": \"1.0.0\"\n" + + " },\n" + + " \"tenant_name\": \"paid-testing\",\n" + + " \"audience\": \"audience\",\n" + " \"isMobile\": \"false\",\n" + " \"user_agent\": \"okhttp 4.11.0 / Other 0.0.0\"\n" + "}"; @@ -53,5 +60,9 @@ public void shouldDeserialize() throws Exception { assertThat(logEvent.getDescription(), is("description")); assertThat(logEvent.isMobile(), is(false)); assertThat(logEvent.getUserAgent(), is("okhttp 4.11.0 / Other 0.0.0")); + assertThat(logEvent.getOrganizationId(), is("org_1")); + assertThat(logEvent.getOrganizationName(), is("org2")); + assertThat(logEvent.getTenantName(), is("paid-testing")); + assertThat(logEvent.getEventSchema(), is(notNullValue())); } }