diff --git a/src/main/java/org/zendesk/client/v2/model/Trigger.java b/src/main/java/org/zendesk/client/v2/model/Trigger.java index 4462e6a72..9a933dfef 100644 --- a/src/main/java/org/zendesk/client/v2/model/Trigger.java +++ b/src/main/java/org/zendesk/client/v2/model/Trigger.java @@ -1,5 +1,6 @@ package org.zendesk.client.v2.model; +import com.fasterxml.jackson.annotation.JsonProperty; import java.io.Serializable; import java.util.ArrayList; import java.util.Date; @@ -20,8 +21,14 @@ public class Trigger implements Serializable { private int position; private Conditions conditions; private List actions; + + @JsonProperty("created_at") private Date createdAt; + + @JsonProperty("updated_at") private Date updatedAt; + + @JsonProperty("category_id") private String categoryId; public Long getId() { @@ -105,8 +112,6 @@ public String toString() { + categoryId + ", title=" + title - + ", active=" - + active + ", position=" + position + ", active=" @@ -115,6 +120,8 @@ public String toString() { + conditions + ", actions=" + actions + + ", createdAt=" + + createdAt + ", updatedAt=" + updatedAt + '}'; diff --git a/src/test/java/org/zendesk/client/v2/model/TriggerTest.java b/src/test/java/org/zendesk/client/v2/model/TriggerTest.java index bbc663566..9e31dda14 100644 --- a/src/test/java/org/zendesk/client/v2/model/TriggerTest.java +++ b/src/test/java/org/zendesk/client/v2/model/TriggerTest.java @@ -7,6 +7,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import java.util.Arrays; +import java.util.Date; import org.junit.Test; import org.zendesk.client.v2.Utils; @@ -44,6 +45,9 @@ public void testTriggerWithComplexActionValues() throws Exception { trigger.getActions().get(0).getValue()); assertEquals(0, trigger.getConditions().getAll().size()); assertEquals(1, trigger.getConditions().getAny().size()); + assertEquals("1", trigger.getCategoryId()); + assertEquals(new Date(1710025200000L), trigger.getCreatedAt()); + assertEquals(new Date(1710111600000L), trigger.getUpdatedAt()); assertEquals("comment_includes_word", trigger.getConditions().getAny().get(0).getField()); assertEquals("includes", trigger.getConditions().getAny().get(0).getOperator()); assertEquals("@triggerTest", trigger.getConditions().getAny().get(0).getValue()); @@ -76,6 +80,9 @@ public void testTriggerWithMultilineActionValues() throws Exception { trigger.getActions().get(1).getValue()); assertEquals(0, trigger.getConditions().getAll().size()); assertEquals(1, trigger.getConditions().getAny().size()); + assertEquals("1", trigger.getCategoryId()); + assertEquals(new Date(1710025200000L), trigger.getCreatedAt()); + assertEquals(new Date(1710111600000L), trigger.getUpdatedAt()); assertEquals("comment_includes_word", trigger.getConditions().getAny().get(0).getField()); assertEquals("includes", trigger.getConditions().getAny().get(0).getOperator()); assertEquals("@triggerTest", trigger.getConditions().getAny().get(0).getValue()); diff --git a/src/test/resources/org/zendesk/client/v2/model/TriggerTest/triggerWithComplexActions.json b/src/test/resources/org/zendesk/client/v2/model/TriggerTest/triggerWithComplexActions.json index fd3215093..c2f9014f5 100644 --- a/src/test/resources/org/zendesk/client/v2/model/TriggerTest/triggerWithComplexActions.json +++ b/src/test/resources/org/zendesk/client/v2/model/TriggerTest/triggerWithComplexActions.json @@ -1 +1 @@ -{"id":12345678,"title":"Test Trigger","active":true,"position":45,"conditions":{"all":[],"any":[{"field":"comment_includes_word","operator":"includes","value":"@triggerTest"}]},"actions":[{"field":"notification_target","value":["1234567890",[["key1","value1"],["key2","value2"]]]}],"createdAt":null,"updatedAt":null,"categoryId":null} +{"id":12345678,"title":"Test Trigger","active":true,"position":45,"conditions":{"all":[],"any":[{"field":"comment_includes_word","operator":"includes","value":"@triggerTest"}]},"actions":[{"field":"notification_target","value":["1234567890",[["key1","value1"],["key2","value2"]]]}],"created_at":1710025200000,"updated_at":1710111600000,"category_id":"1"} \ No newline at end of file diff --git a/src/test/resources/org/zendesk/client/v2/model/TriggerTest/triggerWithMultilineAction.json b/src/test/resources/org/zendesk/client/v2/model/TriggerTest/triggerWithMultilineAction.json index 60b3952fd..ba359fbfb 100644 --- a/src/test/resources/org/zendesk/client/v2/model/TriggerTest/triggerWithMultilineAction.json +++ b/src/test/resources/org/zendesk/client/v2/model/TriggerTest/triggerWithMultilineAction.json @@ -1 +1 @@ -{"id":12345678,"title":"Test Trigger","active":true,"position":45,"conditions":{"all":[],"any":[{"field":"comment_includes_word","operator":"includes","value":"@triggerTest"}]},"actions":[{"field":"notification_user","value":["09876543","Trigger Target 1 {{ticket.title}}","Test Multiline\n\n{{ticket.comments_formatted}}\n\n--------------------------"]},{"field":"notification_target","value":["98765432","{\n \"color\":\"purple\",\n \"message_format\":\"text\",\n \"message\":\"Trigger Target 2 {{ticket.title}}.\"\n}"]}],"createdAt":null,"updatedAt":null,"categoryId":null} +{"id":12345678,"title":"Test Trigger","active":true,"position":45,"conditions":{"all":[],"any":[{"field":"comment_includes_word","operator":"includes","value":"@triggerTest"}]},"actions":[{"field":"notification_user","value":["09876543","Trigger Target 1 {{ticket.title}}","Test Multiline\n\n{{ticket.comments_formatted}}\n\n--------------------------"]},{"field":"notification_target","value":["98765432","{\n \"color\":\"purple\",\n \"message_format\":\"text\",\n \"message\":\"Trigger Target 2 {{ticket.title}}.\"\n}"]}],"created_at":1710025200000,"updated_at":1710111600000,"category_id":"1"}