it.auties.whatsapp.model.response.ContactAboutResponse Maven / Gradle / Ivy
package it.auties.whatsapp.model.response;
import com.fasterxml.jackson.core.type.TypeReference;
import it.auties.whatsapp.model.node.Node;
import it.auties.whatsapp.util.Clock;
import it.auties.whatsapp.util.Json;
import java.time.ZonedDateTime;
import java.util.List;
import java.util.Map;
import java.util.Optional;
public record ContactAboutResponse(Optional about, Optional timestamp) {
public static ContactAboutResponse ofNode(Node source) {
return new ContactAboutResponse(
source.contentAsString(),
Clock.parseSeconds(source.attributes().getLong("t"))
);
}
@SuppressWarnings("unchecked")
public static Optional ofJson(String json) {
try {
var parsedJson = Json.readValue(json, new TypeReference