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

it.auties.whatsapp.model.response.HasWhatsappResponse Maven / Gradle / Ivy

There is a newer version: 3.5.1
Show newest version
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