Documentation ¶
Overview ¶
Package events defines a struct for each type of event and provides various other helper functions.
Index ¶
- Variables
- func ECLog(e Event) string
- func ValidEventType(eventType string) bool
- type Bounce
- type Click
- type Creation
- type Delay
- type Delivery
- type ECLogger
- type Event
- type EventCommon
- type Events
- type GenerationFailure
- type GenerationRejection
- type GeoIP
- type Injection
- type LatLong
- type LinkUnsubscribe
- type ListUnsubscribe
- type Open
- type OutOfBand
- type PolicyRejection
- type RelayContent
- type RelayDelivery
- type RelayInjection
- type RelayMessage
- type RelayPermfail
- type RelayRejection
- type RelayTempfail
- type SMSStatus
- type SpamComplaint
- type Timestamp
- type Unknown
Constants ¶
This section is empty.
Variables ¶
var (
ErrNotImplemented = errors.New("not implemented")
)
Functions ¶
func ValidEventType ¶
ValidEventType returns true if the event name parameter is valid.
Types ¶
type Bounce ¶
type Bounce struct { EventCommon Binding string `json:"binding"` BindingGroup string `json:"binding_group"` BounceClass string `json:"bounce_class"` CampaignID string `json:"campaign_id"` CustomerID string `json:"customer_id"` DeliveryMethod string `json:"delv_method"` DeviceToken string `json:"device_token"` ErrorCode string `json:"error_code"` IPAddress string `json:"ip_address"` MessageID string `json:"message_id"` MessageFrom string `json:"msg_from"` MessageSize string `json:"msg_size"` Retries string `json:"num_retries"` Metadata map[string]string `json:"rcpt_meta"` Tags []string `json:"rcpt_tags"` Recipient string `json:"rcpt_to"` RecipientType string `json:"rcpt_type"` RawReason string `json:"raw_reason"` Reason string `json:"reason"` ReceiveProtocol string `json:"recv_method"` RoutingDomain string `json:"routing_domain"` Subject string `json:"subject"` TemplateID string `json:"template_id"` TemplateVersion string `json:"template_version"` Timestamp Timestamp `json:"timestamp"` TransmissionID string `json:"transmission_id"` }
func (*Bounce) ECLog ¶
ECLog emits a Bounce in the same format that it would be logged to bouncelog.ec: https://support.messagesystems.com/docs/web-ref/log_formats.version_3.php
type Click ¶
type Click struct { EventCommon CampaignID string `json:"campaign_id"` CustomerID string `json:"customer_id"` DeliveryMethod string `json:"delv_method"` GeoIP *GeoIP `json:"geo_ip"` IPAddress string `json:"ip_address"` MessageID string `json:"message_id"` Metadata interface{} `json:"rcpt_meta"` Tags []string `json:"rcpt_tags"` Recipient string `json:"rcpt_to"` RecipientType string `json:"rcpt_type"` TargetLinkName string `json:"target_link_name"` TargetLinkURL string `json:"target_link_url"` TemplateID string `json:"template_id"` TemplateVersion string `json:"template_version"` Timestamp Timestamp `json:"timestamp"` TransmissionID string `json:"transmission_id"` UserAgent string `json:"user_agent"` }
type Creation ¶
type Creation struct { EventCommon Accepted string `json:"accepted_rcpts"` CampaignID string `json:"campaign_id"` CustomerID string `json:"customer_id"` InjectionMethod string `json:"inj_method"` NodeName string `json:"node_name"` Metadata interface{} `json:"rcpt_meta"` Tags []string `json:"rcpt_tags"` Submitted string `json:"submitted_rcpts"` TemplateID string `json:"template_id"` TemplateVersion string `json:"template_version"` Timestamp Timestamp `json:"timestamp"` TransmissionID string `json:"transmission_id"` UserID string `json:"user_id"` }
type Delay ¶
type Delay struct { EventCommon Binding string `json:"binding"` BindingGroup string `json:"binding_group"` BounceClass string `json:"bounce_class"` CampaignID string `json:"campaign_id"` CustomerID string `json:"customer_id"` DeliveryMethod string `json:"delv_method"` DeviceToken string `json:"device_token"` ErrorCode string `json:"error_code"` IPAddress string `json:"ip_address"` MessageID string `json:"message_id"` MessageFrom string `json:"msg_from"` MessageSize string `json:"msg_size"` Retries string `json:"num_retries"` QueueTime string `json:"queue_time"` Metadata interface{} `json:"rcpt_meta"` Tags []string `json:"rcpt_tags"` Recipient string `json:"rcpt_to"` RecipientType string `json:"rcpt_type"` RawReason string `json:"raw_reason"` Reason string `json:"reason"` RoutingDomain string `json:"routing_domain"` Subject string `json:"subject"` TemplateID string `json:"template_id"` TemplateVersion string `json:"template_version"` Timestamp Timestamp `json:"timestamp"` TransmissionID string `json:"transmission_id"` }
func (*Delay) ECLog ¶
ECLog emits a Delay in the same format that it would be logged to bouncelog.ec: https://support.messagesystems.com/docs/web-ref/log_formats.version_3.php
type Delivery ¶
type Delivery struct { EventCommon Binding string `json:"binding"` BindingGroup string `json:"binding_group"` CampaignID string `json:"campaign_id"` CustomerID string `json:"customer_id"` DeliveryMethod string `json:"delv_method"` DeviceToken string `json:"device_token"` IPAddress string `json:"ip_address"` MessageID string `json:"message_id"` MessageFrom string `json:"msg_from"` MessageSize string `json:"msg_size"` Retries string `json:"num_retries"` QueueTime string `json:"queue_time"` Metadata interface{} `json:"rcpt_meta"` Tags []string `json:"rcpt_tags"` Recipient string `json:"rcpt_to"` RecipientType string `json:"rcpt_type"` ReceiveProtocol string `json:"recv_method"` RoutingDomain string `json:"routing_domain"` TemplateID string `json:"template_id"` TemplateVersion string `json:"template_version"` Timestamp Timestamp `json:"timestamp"` TransmissionID string `json:"transmission_id"` }
func (*Delivery) ECLog ¶
ECLog emits a Delivery in the same format that it would be logged to mainlog.ec: https://support.messagesystems.com/docs/web-ref/log_formats.version_3.php
type Event ¶
type Event interface {
EventType() string
}
Event is a generic event.
func EventForName ¶
EventForName returns a struct matching the passed-in type.
func ParseRawJSONEvents ¶
func ParseRawJSONEvents(rawEvents []json.RawMessage) ([]Event, error)
type EventCommon ¶
type EventCommon struct {
Type string `json:"type"`
}
EventCommon contains fields common to all types of Event objects
func (EventCommon) EventType ¶
func (e EventCommon) EventType() string
type Events ¶
type Events []Event
Events is a list of generic events. Useful for decoding events from API webhooks.
func (*Events) UnmarshalJSON ¶
type GenerationFailure ¶
type GenerationFailure struct { EventCommon Binding string `json:"binding"` BindingGroup string `json:"binding_group"` CampaignID string `json:"campaign_id"` CustomerID string `json:"customer_id"` ErrorCode string `json:"error_code"` Metadata interface{} `json:"rcpt_meta"` SubstitutionData interface{} `json:"rcpt_subs"` Tags []string `json:"rcpt_tags"` Recipient string `json:"rcpt_to"` RawReason string `json:"raw_reason"` Reason string `json:"reason"` ReceiveProtocol string `json:"recv_method"` RoutingDomain string `json:"routing_domain"` TemplateID string `json:"template_id"` TemplateVersion string `json:"template_version"` Timestamp Timestamp `json:"timestamp"` TransmissionID string `json:"transmission_id"` }
func (*GenerationFailure) String ¶
func (g *GenerationFailure) String() string
String returns a brief summary of a GenerationFailure event
type GenerationRejection ¶
type GenerationRejection GenerationFailure
func (*GenerationRejection) String ¶
func (g *GenerationRejection) String() string
String returns a brief summary of a GenerationFailure event
type Injection ¶
type Injection struct { EventCommon Binding string `json:"binding"` BindingGroup string `json:"binding_group"` CampaignID string `json:"campaign_id"` CustomerID string `json:"customer_id"` MessageID string `json:"message_id"` MessageFrom string `json:"msg_from"` MessageSize string `json:"msg_size"` Metadata interface{} `json:"rcpt_meta"` Pathway string `json:"pathway"` PathwayGroup string `json:"pathway_group"` Tags []string `json:"rcpt_tags"` Recipient string `json:"rcpt_to"` RecipientType string `json:"rcpt_type"` ReceiveProtocol string `json:"recv_method"` RoutingDomain string `json:"routing_domain"` Subject string `json:"subject"` TemplateID string `json:"template_id"` TemplateVersion string `json:"template_version"` Timestamp Timestamp `json:"timestamp"` TransmissionID string `json:"transmission_id"` }
func (*Injection) ECLog ¶
ECLog emits an Injection in the same format that it would be logged to mainlog.ec: https://support.messagesystems.com/docs/web-ref/log_formats.version_3.php
type LatLong ¶
type LatLong float32
The API inconsistently returns float or string. We need a custom unmarshaller.
func (*LatLong) MarshalJSON ¶
func (*LatLong) UnmarshalJSON ¶
type LinkUnsubscribe ¶
type LinkUnsubscribe struct { EventCommon ListUnsubscribe UserAgent string `json:"user_agent"` }
func (*LinkUnsubscribe) String ¶
func (l *LinkUnsubscribe) String() string
String returns a brief summary of a ListUnsubscribe event
type ListUnsubscribe ¶
type ListUnsubscribe struct { EventCommon CampaignID string `json:"campaign_id"` CustomerID string `json:"customer_id"` MessageFrom string `json:"mailfrom"` MessageID string `json:"message_id"` Metadata interface{} `json:"rcpt_meta"` Tags []string `json:"rcpt_tags"` Recipient string `json:"rcpt_to"` RecipientType string `json:"rcpt_type"` TemplateID string `json:"template_id"` TemplateVersion string `json:"template_version"` Timestamp Timestamp `json:"timestamp"` TransmissionID string `json:"transmission_id"` }
func (*ListUnsubscribe) String ¶
func (l *ListUnsubscribe) String() string
String returns a brief summary of a ListUnsubscribe event
type Open ¶
type Open struct { EventCommon CampaignID string `json:"campaign_id"` CustomerID string `json:"customer_id"` DeliveryMethod string `json:"delv_method"` GeoIP *GeoIP `json:"geo_ip"` IPAddress string `json:"ip_address"` MessageID string `json:"message_id"` Metadata interface{} `json:"rcpt_meta"` Tags []string `json:"rcpt_tags"` Recipient string `json:"rcpt_to"` RecipientType string `json:"rcpt_type"` TemplateID string `json:"template_id"` TemplateVersion string `json:"template_version"` Timestamp Timestamp `json:"timestamp"` TransmissionID string `json:"transmission_id"` UserAgent string `json:"user_agent"` }
type OutOfBand ¶
type OutOfBand struct { EventCommon Binding string `json:"binding"` BindingGroup string `json:"binding_group"` BounceClass string `json:"bounce_class"` CampaignID string `json:"campaign_id"` CustomerID string `json:"customer_id"` DeliveryMethod string `json:"delv_method"` DeviceToken string `json:"device_token"` ErrorCode string `json:"error_code"` MessageID string `json:"message_id"` MessageFrom string `json:"msg_from"` Recipient string `json:"rcpt_to"` RawReason string `json:"raw_reason"` Reason string `json:"reason"` ReceiveProtocol string `json:"recv_method"` RoutingDomain string `json:"routing_domain"` TemplateID string `json:"template_id"` TemplateVersion string `json:"template_version"` Timestamp Timestamp `json:"timestamp"` }
func (*OutOfBand) ECLog ¶
ECLog emits an OutOfBand in the same format that it would be logged to bouncelog.ec: https://support.messagesystems.com/docs/web-ref/log_formats.version_3.php
type PolicyRejection ¶
type PolicyRejection struct { EventCommon CampaignID string `json:"campaign_id"` CustomerID string `json:"customer_id"` ErrorCode string `json:"error_code"` MessageID string `json:"message_id"` MessageFrom string `json:"msg_from"` Metadata interface{} `json:"rcpt_meta"` Pathway string `json:"pathway"` PathwayGroup string `json:"pathway_group"` Tags []string `json:"rcpt_tags"` RawReason string `json:"raw_reason"` Reason string `json:"reason"` Recipient string `json:"rcpt_to"` RecipientType string `json:"rcpt_type"` ReceiveProtocol string `json:"recv_method"` TemplateID string `json:"template_id"` TemplateVersion string `json:"template_version"` Timestamp Timestamp `json:"timestamp"` TransmissionID string `json:"transmission_id"` }
func (*PolicyRejection) String ¶
func (p *PolicyRejection) String() string
String returns a brief summary of a PolicyRejection event
type RelayContent ¶
type RelayDelivery ¶
type RelayDelivery struct { EventCommon Binding string `json:"binding"` BindingGroup string `json:"binding_group"` CustomerID string `json:"customer_id"` DeliveryMethod string `json:"delv_method"` MessageFrom string `json:"msg_from"` Pathway string `json:"pathway"` PathwayGroup string `json:"pathway_group"` QueueTime string `json:"queue_time"` ReceiveProtocol string `json:"recv_method"` RelayID string `json:"relay_id"` Retries string `json:"num_retries"` RoutingDomain string `json:"routing_domain"` Timestamp Timestamp `json:"timestamp"` }
func (*RelayDelivery) String ¶
func (d *RelayDelivery) String() string
String returns a brief summary of a RelayDelivery event
type RelayInjection ¶
type RelayInjection struct { EventCommon Binding string `json:"binding"` BindingGroup string `json:"binding_group"` CustomerID string `json:"customer_id"` MessageFrom string `json:"msg_from"` MessageSize string `json:"msg_size"` Pathway string `json:"pathway"` PathwayGroup string `json:"pathway_group"` Recipient string `json:"rcpt_to"` ReceiveProtocol string `json:"recv_method"` RelayID string `json:"relay_id"` RoutingDomain string `json:"routing_domain"` Timestamp Timestamp `json:"timestamp"` }
func (*RelayInjection) String ¶
func (i *RelayInjection) String() string
String returns a brief summary of a RelayInjection event
type RelayMessage ¶
type RelayMessage struct { EventCommon Content RelayContent `json:"content"` FriendlyFrom string `json:"friendly_from"` From string `json:"msg_from"` To string `json:"rcpt_to"` WebhookID string `json:"webhook_id"` }
func (*RelayMessage) String ¶
func (m *RelayMessage) String() string
type RelayPermfail ¶
type RelayPermfail RelayTempfail
func (*RelayPermfail) String ¶
func (p *RelayPermfail) String() string
String returns a brief summary of a RelayInjection event
type RelayRejection ¶
type RelayRejection struct { EventCommon CustomerID string `json:"customer_id"` ErrorCode string `json:"error_code"` MessageFrom string `json:"msg_from"` Pathway string `json:"pathway"` PathwayGroup string `json:"pathway_group"` RawReason string `json:"raw_reason"` Reason string `json:"reason"` Recipient string `json:"rcpt_to"` ReceiveProtocol string `json:"recv_method"` RelayID string `json:"relay_id"` RemoteAddress string `json:"remote_addr"` Timestamp Timestamp `json:"timestamp"` }
func (*RelayRejection) String ¶
func (r *RelayRejection) String() string
String returns a brief summary of a RelayInjection event
type RelayTempfail ¶
type RelayTempfail struct { EventCommon Binding string `json:"binding"` BindingGroup string `json:"binding_group"` CustomerID string `json:"customer_id"` DeliveryMethod string `json:"delv_method"` ErrorCode string `json:"error_code"` MessageFrom string `json:"msg_from"` Retries string `json:"num_retries"` QueueTime string `json:"queue_time"` Pathway string `json:"pathway"` PathwayGroup string `json:"pathway_group"` RawReason string `json:"raw_reason"` Reason string `json:"reason"` ReceiveProtocol string `json:"recv_method"` RelayID string `json:"relay_id"` RoutingDomain string `json:"routing_domain"` Timestamp Timestamp `json:"timestamp"` }
func (*RelayTempfail) String ¶
func (t *RelayTempfail) String() string
String returns a brief summary of a RelayTempfail event
type SMSStatus ¶
type SMSStatus struct { EventCommon CustomerID string `json:"customer_id"` DeliveryMethod string `json:"delv_method"` // TODO: `json:"dr_latency"` IPAddress string `json:"ip_address"` RawReason string `json:"raw_reason"` Reason string `json:"reason"` RoutingDomain string `json:"routing_domain"` Destination string `json:"sms_dst"` DestinationNPI string `json:"sms_dst_npi"` DestinationTON string `json:"sms_dst_ton"` RemoteIDs []string `json:"sms_remoteids"` Source string `json:"sms_src"` SourceNPI string `json:"sms_src_npi"` SourceTON string `json:"sms_src_ton"` Text string `json:"sms_text"` StatusType string `json:"stat_type"` StatusState string `json:"stat_state"` // TODO: SubAccountID string `json:"subaccount_id"` Timestamp Timestamp `json:"timestamp"` }
type SpamComplaint ¶
type SpamComplaint struct { EventCommon Binding string `json:"binding"` BindingGroup string `json:"binding_group"` CampaignID string `json:"campaign_id"` CustomerID string `json:"customer_id"` DeliveryMethod string `json:"delv_method"` FeedbackType string `json:"fbtype"` FriendlyFrom string `json:"friendly_from"` MessageID string `json:"message_id"` Metadata interface{} `json:"rcpt_meta"` Tags []string `json:"rcpt_tags"` Recipient string `json:"rcpt_to"` RecipientType string `json:"rcpt_type"` ReportedBy string `json:"report_by"` ReportedTo string `json:"report_to"` Subject string `json:"subject"` TemplateID string `json:"template_id"` TemplateVersion string `json:"template_version"` Timestamp Timestamp `json:"timestamp"` TransmissionID string `json:"transmission_id"` UserString string `json:"user_str"` }
func (*SpamComplaint) String ¶
func (p *SpamComplaint) String() string
String returns a brief summary of a SpamComplaint event