diff --git a/src/main/java/org/zendesk/client/v2/model/Comment.java b/src/main/java/org/zendesk/client/v2/model/Comment.java index 0459423e..ee10562d 100644 --- a/src/main/java/org/zendesk/client/v2/model/Comment.java +++ b/src/main/java/org/zendesk/client/v2/model/Comment.java @@ -1,15 +1,26 @@ package org.zendesk.client.v2.model; +import static com.fasterxml.jackson.annotation.JsonTypeInfo.As.EXTERNAL_PROPERTY; +import static com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME; + import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; import java.io.Serializable; import java.util.Arrays; import java.util.Date; import java.util.List; +import org.zendesk.client.v2.model.comments.VoiceComment; /** * @author stephenc * @since 09/04/2013 15:09 */ +@JsonTypeInfo(use = NAME, include = EXTERNAL_PROPERTY, property = "type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Comment.class, name = "Comment"), + @JsonSubTypes.Type(value = VoiceComment.class, name = "VoiceComment") +}) public class Comment implements Serializable { private static final long serialVersionUID = 1L; diff --git a/src/main/java/org/zendesk/client/v2/model/comments/VoiceComment.java b/src/main/java/org/zendesk/client/v2/model/comments/VoiceComment.java new file mode 100644 index 00000000..5afaed22 --- /dev/null +++ b/src/main/java/org/zendesk/client/v2/model/comments/VoiceComment.java @@ -0,0 +1,14 @@ +package org.zendesk.client.v2.model.comments; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.zendesk.client.v2.model.Comment; + +public class VoiceComment extends Comment { + + private VoiceCommentData data; + + @JsonProperty("data") + public VoiceCommentData getData() { + return data; + } +} diff --git a/src/main/java/org/zendesk/client/v2/model/comments/VoiceCommentData.java b/src/main/java/org/zendesk/client/v2/model/comments/VoiceCommentData.java new file mode 100644 index 00000000..61cf3747 --- /dev/null +++ b/src/main/java/org/zendesk/client/v2/model/comments/VoiceCommentData.java @@ -0,0 +1,17 @@ +package org.zendesk.client.v2.model.comments; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * @author besbes + * @since 05/03/2024 13:51 + */ +public class VoiceCommentData { + + private Long callDuration; + + @JsonProperty("call_duration") + public Long getCallDuration() { + return callDuration; + } +}