it.auties.whatsapp.socket.SocketState 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.socket;
import it.auties.whatsapp.api.DisconnectReason;
public enum SocketState {
WAITING,
CONNECTED,
DISCONNECTED,
RECONNECTING,
LOGGED_OUT,
RESTORE;
static SocketState of(DisconnectReason reason) {
return switch (reason) {
case DISCONNECTED -> DISCONNECTED;
case RECONNECTING -> RECONNECTING;
case LOGGED_OUT -> LOGGED_OUT;
case RESTORE -> RESTORE;
};
}
DisconnectReason toReason() {
return switch (this) {
case WAITING, CONNECTED, RECONNECTING -> DisconnectReason.RECONNECTING;
case DISCONNECTED -> DisconnectReason.DISCONNECTED;
case LOGGED_OUT -> DisconnectReason.LOGGED_OUT;
case RESTORE -> DisconnectReason.RESTORE;
};
}
}