From 39114f4493d43ee69ee6660ae5aafc0e54b06ed3 Mon Sep 17 00:00:00 2001 From: James Anderson Date: Thu, 16 Sep 2021 14:48:32 -0500 Subject: [PATCH] Add user_name field to LogEvent --- .../java/com/auth0/json/mgmt/logevents/LogEvent.java | 12 ++++++++++++ .../com/auth0/json/mgmt/logevents/LogEventTest.java | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) 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 63024016..f495fdb8 100644 --- a/src/main/java/com/auth0/json/mgmt/logevents/LogEvent.java +++ b/src/main/java/com/auth0/json/mgmt/logevents/LogEvent.java @@ -33,6 +33,8 @@ public class LogEvent { private String ip; @JsonProperty("user_id") private String userId; + @JsonProperty("user_name") + private String userName; @JsonProperty("location_info") private Map locationInfo; @JsonProperty("details") @@ -119,6 +121,16 @@ public String getUserId() { return userId; } + /** + * Getter for the user name related to this event. + * + * @return the user id. + */ + @JsonProperty("user_name") + public String getUserName() { + return userName; + } + /** * Getter for the location info object. * 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 6c4e1cb3..0aaa68d9 100644 --- a/src/test/java/com/auth0/json/mgmt/logevents/LogEventTest.java +++ b/src/test/java/com/auth0/json/mgmt/logevents/LogEventTest.java @@ -9,7 +9,7 @@ public class LogEventTest extends JsonTest { - private static final String json = "{\"_id\":\"123\", \"log_id\":\"123\", \"date\":\"2016-02-23T19:57:29.532Z\",\"type\":\"thetype\",\"location_info\":{},\"details\":{},\"client_id\":\"clientId\",\"client_name\":\"clientName\",\"ip\":\"233.233.233.11\",\"user_id\":\"userId\"}"; + private static final String json = "{\"_id\":\"123\", \"log_id\":\"123\", \"date\":\"2016-02-23T19:57:29.532Z\",\"type\":\"thetype\",\"location_info\":{},\"details\":{},\"client_id\":\"clientId\",\"client_name\":\"clientName\",\"ip\":\"233.233.233.11\",\"user_id\":\"userId\",\"user_name\":\"userName\"}"; @Test public void shouldDeserialize() throws Exception { @@ -24,6 +24,7 @@ public void shouldDeserialize() throws Exception { assertThat(logEvent.getClientName(), is("clientName")); assertThat(logEvent.getIP(), is("233.233.233.11")); assertThat(logEvent.getUserId(), is("userId")); + assertThat(logEvent.getUserName(), is("userName")); assertThat(logEvent.getLocationInfo(), is(notNullValue())); assertThat(logEvent.getDetails(), is(notNullValue())); }