Skip to content

Instantly share code, notes, and snippets.

@ItsDoot
Created April 23, 2018 02:52
Show Gist options
  • Save ItsDoot/07c39137ce3d3cef819a3d40a67a24e5 to your computer and use it in GitHub Desktop.
Save ItsDoot/07c39137ce3d3cef819a3d40a67a24e5 to your computer and use it in GitHub Desktop.
shared abstract class UserStatus of online | idle | doNotDisturb | invisible | offline {
shared static UserStatus|ParseException parse(String string) =>
parseUserStatus(string) else ParseException("illegal format for UserStatus");
shared new () {}
}
"A value representing online status for a [[User]]."
shared object online extends UserStatus() {
string => "online";
}
"A value representing idle status for a [[User]]."
shared object idle extends UserStatus() {
string => "idle";
}
"A value representing do-not-disturb status for a [[User]]."
shared object doNotDisturb extends UserStatus() {
string => "dnd";
}
"A value representing invisible status for a [[User]]."
shared object invisible extends UserStatus() {
string => "invisible";
}
"A value representing offline status for a [[User]]."
shared object offline extends UserStatus() {
string => "offline";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment