forked from nyaruka/courier
-
Notifications
You must be signed in to change notification settings - Fork 1
/
channel_event.go
41 lines (33 loc) · 1.2 KB
/
channel_event.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package courier
import (
"time"
"github.com/nyaruka/gocommon/urns"
)
// ChannelEventType is the type of channel event this is
type ChannelEventType string
// Possible values for ChannelEventTypes
const (
EventTypeNewConversation ChannelEventType = "new_conversation"
EventTypeReferral ChannelEventType = "referral"
EventTypeStopContact ChannelEventType = "stop_contact"
EventTypeWelcomeMessage ChannelEventType = "welcome_message"
EventTypeOptIn ChannelEventType = "optin"
EventTypeOptOut ChannelEventType = "optout"
)
//-----------------------------------------------------------------------------
// ChannelEvent Interface
//-----------------------------------------------------------------------------
// ChannelEvent represents an event on a channel, such as a follow, new conversation or referral
type ChannelEvent interface {
Event
ChannelUUID() ChannelUUID
URN() urns.URN
EventType() ChannelEventType
Extra() map[string]string
CreatedOn() time.Time
OccurredOn() time.Time
WithContactName(name string) ChannelEvent
WithURNAuthTokens(tokens map[string]string) ChannelEvent
WithExtra(extra map[string]string) ChannelEvent
WithOccurredOn(time.Time) ChannelEvent
}