-
Notifications
You must be signed in to change notification settings - Fork 79
/
event.go
27 lines (22 loc) · 866 Bytes
/
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
package intercom
import "fmt"
// EventService handles interactions with the API through an EventRepository.
type EventService struct {
Repository EventRepository
}
// An Event represents a new event that happens to a User.
type Event struct {
ID string `json:"id,omitempty"`
Email string `json:"email,omitempty"`
UserID string `json:"user_id,omitempty"`
EventName string `json:"event_name,omitempty"`
CreatedAt int64 `json:"created_at,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
// Save a new Event
func (e *EventService) Save(event *Event) error {
return e.Repository.save(event)
}
func (e Event) String() string {
return fmt.Sprintf("[intercom] event { name: %s, user_id: %s, email: %s }", e.EventName, e.UserID, e.Email)
}