it.auties.whatsapp.model.response.ContactStatusResponse Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of whatsappweb4j Show documentation
Show all versions of whatsappweb4j Show documentation
Standalone fully-featured Whatsapp Web API for Java and Kotlin
package it.auties.whatsapp.model.response;
import it.auties.whatsapp.model.request.Node;
import it.auties.whatsapp.util.Clock;
import lombok.NonNull;
import java.time.ZonedDateTime;
import java.util.NoSuchElementException;
public record ContactStatusResponse(@NonNull String status, @NonNull ZonedDateTime timestamp) implements ResponseWrapper {
public ContactStatusResponse(@NonNull Node source) {
this(
source.contentAsString().orElseThrow(() -> new NoSuchElementException("Missing status")),
Clock.parseSeconds(source.attributes().getLong("t"))
);
}
}