@@ -10,6 +10,7 @@ import (
1010)
1111
1212type InfoType = string
13+ type EventType = string
1314
1415const (
1516 InfoTypeSuiteTicket InfoType = "suite_ticket"
@@ -23,9 +24,10 @@ const (
2324 InfoTypeCorpArchAuth InfoType = "corp_arch_auth"
2425 InfoTypeApproveSpecialAuth InfoType = "approve_special_auth"
2526 InfoTypeCancelSpecialAuth InfoType = "cancel_special_auth"
26- InfoTypeChangeAppAdmin InfoType = "change_app_admin"
2727)
2828
29+ const EventTypeChangeAppAdmin EventType = "change_app_admin"
30+
2931type ChangeType = string
3032
3133const (
@@ -87,7 +89,14 @@ func (ev BaseEvent) GetTimestamp() int64 {
8789}
8890
8991func (msg BaseEvent ) ToEvent () (IEvent , error ) {
90- switch msg .GetInfoType () {
92+ infoType := msg .GetInfoType ()
93+ if infoType == "" {
94+ if msg .Event == EventTypeChangeAppAdmin {
95+ return new (EventChangeAppAdmin ), nil
96+ }
97+ return nil , errors .New (string (msg .Event ))
98+ }
99+ switch infoType {
91100 case InfoTypeSuiteTicket :
92101 return new (EventSuiteTicket ), nil
93102 case InfoTypeCreateAuth :
@@ -115,8 +124,6 @@ func (msg BaseEvent) ToEvent() (IEvent, error) {
115124 return new (EventCorpArchAuth ), nil
116125 case InfoTypeApproveSpecialAuth , InfoTypeCancelSpecialAuth :
117126 return new (EventSpecialAuth ), nil
118- case InfoTypeChangeAppAdmin :
119- return new (EventChangeAppAdmin ), nil
120127 default :
121128 return nil , errors .New ("unknown event" )
122129 }
0 commit comments