unified gateway interface
This commit is contained in:
@@ -11,4 +11,11 @@ const (
|
||||
NAArchived NotificationAction = "archived"
|
||||
NASent NotificationAction = "sent"
|
||||
NAPasswordReset NotificationAction = "password_reset"
|
||||
|
||||
NADiscoveryServiceAnnounce NotificationAction = "service.announce"
|
||||
NADiscoveryGatewayAnnounce NotificationAction = "gateway.announce"
|
||||
NADiscoveryHeartbeat NotificationAction = "service.heartbeat"
|
||||
NADiscoveryLookupRequest NotificationAction = "request.lookup"
|
||||
NADiscoveryLookupResponse NotificationAction = "response.lookup"
|
||||
NADiscoveryRefreshUI NotificationAction = "event.refresh_ui"
|
||||
)
|
||||
|
||||
@@ -36,7 +36,11 @@ func (ne *NotificationEventImp) Equals(other *NotificationEventImp) bool {
|
||||
}
|
||||
|
||||
func (ne *NotificationEventImp) ToString() string {
|
||||
return ne.StringType() + messageDelimiter + ne.StringAction()
|
||||
action := ne.StringAction()
|
||||
if strings.Contains(action, ".") {
|
||||
return ne.StringType() + "." + action
|
||||
}
|
||||
return ne.StringType() + messageDelimiter + action
|
||||
}
|
||||
|
||||
func (ne *NotificationEventImp) StringType() string {
|
||||
@@ -76,7 +80,13 @@ func StringToNotificationAction(s string) (nm.NotificationAction, error) {
|
||||
nm.NAUpdated,
|
||||
nm.NADeleted,
|
||||
nm.NAAssigned,
|
||||
nm.NAPasswordReset:
|
||||
nm.NAPasswordReset,
|
||||
nm.NADiscoveryServiceAnnounce,
|
||||
nm.NADiscoveryGatewayAnnounce,
|
||||
nm.NADiscoveryHeartbeat,
|
||||
nm.NADiscoveryLookupRequest,
|
||||
nm.NADiscoveryLookupResponse,
|
||||
nm.NADiscoveryRefreshUI:
|
||||
return nm.NotificationAction(s), nil
|
||||
default:
|
||||
return "", merrors.DataConflict("invalid Notification action: " + s)
|
||||
|
||||
Reference in New Issue
Block a user