it.auties.whatsapp.model.response.HasWhatsappResponse 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.contact.ContactJid;
import it.auties.whatsapp.model.request.Node;
import lombok.NonNull;
import java.util.NoSuchElementException;
public record HasWhatsappResponse(@NonNull ContactJid contact, boolean hasWhatsapp) implements ResponseWrapper {
public HasWhatsappResponse(@NonNull Node source) {
this(source.attributes()
.getJid("jid")
.orElseThrow(() -> new NoSuchElementException("Missing jid in HasWhatsappResponse")), source.findNode("contact")
.orElseThrow(() -> new NoSuchElementException("Missing contact in HasWhatsappResponse"))
.attributes()
.getRequiredString("type")
.equals("in"));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy