All Downloads are FREE. Search and download functionalities are using the official Maven repository.

app.knock.api.model.KnockMessage Maven / Gradle / Ivy

package app.knock.api.model;

import com.fasterxml.jackson.annotation.*;
import lombok.Builder;
import lombok.Singular;
import lombok.Value;
import lombok.extern.jackson.Jacksonized;

import java.time.ZonedDateTime;
import java.util.Map;

@Value
@Jacksonized
@Builder
@JsonIgnoreProperties(ignoreUnknown = true)
public class KnockMessage {

    @JsonProperty("__typename")
    String typeName;

    @JsonProperty("__cursor")
    String cursor;

    String id;
    String channelId;
    Object recipient;
    String workflow;
    String tenant;
    String status;
    ZonedDateTime readAt;
    ZonedDateTime seenAt;
    ZonedDateTime archivedAt;
    ZonedDateTime insertedAt;
    ZonedDateTime updatedAt;
    WorkflowSource source;

    @Singular("data")
    @JsonAnySetter
    @JsonSetter(nulls = Nulls.SKIP)
    Map data;

    public  T data(String key, Class clazz) {
        if (this.data != null && this.data.containsKey(key)) {
            Object o = this.data.get(key);
            return clazz.isInstance(o) ? clazz.cast(o) : null;
        }
        return null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy