This repository has been archived on 2025-11-26. You can view files and clone it, but cannot push or open issues or pull requests.
OpenContacts/lib/models/hub_events.dart
2024-01-27 15:39:33 +01:00

30 lines
No EOL
583 B
Dart

enum EventType {
undefined,
invocation,
streamItem,
completion,
streamInvocation,
cancelInvocation,
ping,
close;
}
enum EventTarget {
unknown,
messageSent,
receiveMessage,
messagesRead,
receiveSessionUpdate,
removeSession,
receiveStatusUpdate,
sendStatusToUser,
contactAddedOrUpdated;
factory EventTarget.parse(String? text) {
if (text == null) return EventTarget.unknown;
return EventTarget.values.firstWhere(
(element) => element.name.toLowerCase() == text.toLowerCase(),
orElse: () => EventTarget.unknown,
);
}
}