it.auties.whatsapp.model.contact.ContactStatus 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.contact;
import lombok.AllArgsConstructor;
import lombok.NonNull;
import lombok.experimental.Accessors;
import java.util.Arrays;
import java.util.Optional;
/**
* The constants of this enumerated type describe the various status that a {@link Contact} can be
* in
*/
@AllArgsConstructor
@Accessors(fluent = true)
public enum ContactStatus {
/**
* When the contact is online
*/
AVAILABLE,
/**
* When the contact is offline
*/
UNAVAILABLE,
/**
* When the contact is writing a text message
*/
COMPOSING,
/**
* When the contact is recording an audio message
*/
RECORDING;
private static ContactStatus of(int index) {
return Arrays.stream(values()).filter(entry -> entry.ordinal() == index).findFirst().orElse(null);
}
public static Optional of(@NonNull String jsonValue) {
return Arrays.stream(values()).filter(entry -> entry.name().equalsIgnoreCase(jsonValue)).findFirst();
}
/**
* Returns the name of this enumerated constant
*
* @return a lowercase non-null String
*/
public String data() {
return name().toLowerCase();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy