Documentation ¶
Index ¶
- Variables
- type ChannelEventID
- type ContactID
- type ContactURNID
- type DBChannel
- func (c *DBChannel) Address() string
- func (c *DBChannel) ChannelType() courier.ChannelType
- func (c *DBChannel) ConfigForKey(key string, defaultValue interface{}) interface{}
- func (c *DBChannel) Country() string
- func (c *DBChannel) ID() courier.ChannelID
- func (c *DBChannel) Name() string
- func (c *DBChannel) OrgConfigForKey(key string, defaultValue interface{}) interface{}
- func (c *DBChannel) OrgID() OrgID
- func (c *DBChannel) Schemes() []string
- func (c *DBChannel) StringConfigForKey(key string, defaultValue string) string
- func (c *DBChannel) UUID() courier.ChannelUUID
- type DBChannelEvent
- func (e *DBChannelEvent) AddLog(log *courier.ChannelLog)
- func (e *DBChannelEvent) ChannelID() courier.ChannelID
- func (e *DBChannelEvent) ChannelUUID() courier.ChannelUUID
- func (e *DBChannelEvent) ContactName() string
- func (e *DBChannelEvent) CreatedOn() time.Time
- func (e *DBChannelEvent) EventType() courier.ChannelEventType
- func (e *DBChannelEvent) Logs() []*courier.ChannelLog
- func (e *DBChannelEvent) OccurredOn() time.Time
- func (e *DBChannelEvent) ReceiveID() int64
- func (e *DBChannelEvent) URN() urns.URN
- func (e *DBChannelEvent) WithContactName(name string) courier.ChannelEvent
- func (e *DBChannelEvent) WithExtra(extra map[string]interface{}) courier.ChannelEvent
- func (e *DBChannelEvent) WithOccurredOn(time time.Time) courier.ChannelEvent
- type DBContact
- type DBContactURN
- type DBMsg
- func (m *DBMsg) Attachments() []string
- func (m *DBMsg) Channel() courier.Channel
- func (m *DBMsg) ContactName() string
- func (m *DBMsg) ExternalID() string
- func (m *DBMsg) HighPriority() bool
- func (m *DBMsg) ID() courier.MsgID
- func (m *DBMsg) ReceiveID() int64
- func (m *DBMsg) ReceivedOn() *time.Time
- func (m *DBMsg) SentOn() *time.Time
- func (m *DBMsg) Text() string
- func (m *DBMsg) URN() urns.URN
- func (m *DBMsg) UUID() courier.MsgUUID
- func (m *DBMsg) WithAttachment(url string) courier.Msg
- func (m *DBMsg) WithContactName(name string) courier.Msg
- func (m *DBMsg) WithExternalID(id string) courier.Msg
- func (m *DBMsg) WithID(id courier.MsgID) courier.Msg
- func (m *DBMsg) WithReceivedOn(date time.Time) courier.Msg
- func (m *DBMsg) WithUUID(uuid courier.MsgUUID) courier.Msg
- type DBMsgStatus
- func (s *DBMsgStatus) AddLog(log *courier.ChannelLog)
- func (s *DBMsgStatus) ChannelUUID() courier.ChannelUUID
- func (s *DBMsgStatus) ExternalID() string
- func (s *DBMsgStatus) ID() courier.MsgID
- func (s *DBMsgStatus) Logs() []*courier.ChannelLog
- func (s *DBMsgStatus) SetExternalID(id string)
- func (s *DBMsgStatus) SetStatus(status courier.MsgStatusValue)
- func (s *DBMsgStatus) Status() courier.MsgStatusValue
- type MsgDirection
- type MsgVisibility
- type OrgID
Constants ¶
This section is empty.
Variables ¶
var NilContactID = ContactID{null.NewInt(0, false)}
NilContactID represents our nil value for ContactID
var NilContactURNID = ContactURNID{null.NewInt(0, false)}
NilContactURNID is our nil value for ContactURNID
var NilOrgID = OrgID{null.NewInt(0, false)}
NilOrgID is our nil value for OrgID
Functions ¶
This section is empty.
Types ¶
type ChannelEventID ¶ added in v0.8.0
ChannelEventID is the type of our channel event ids
func (ChannelEventID) String ¶ added in v0.8.0
func (i ChannelEventID) String() string
String satisfies the Stringer interface
type ContactURNID ¶
ContactURNID represents a contact urn's id
type DBChannel ¶
type DBChannel struct { OrgID_ OrgID `db:"org_id"` ID_ courier.ChannelID `db:"id"` ChannelType_ courier.ChannelType `db:"channel_type"` Schemes_ pq.StringArray `db:"schemes"` UUID_ courier.ChannelUUID `db:"uuid"` Name_ sql.NullString `db:"name"` Address_ sql.NullString `db:"address"` Country_ sql.NullString `db:"country"` Config_ utils.NullMap `db:"config"` OrgConfig_ utils.NullMap `db:"org_config"` // contains filtered or unexported fields }
DBChannel is the RapidPro specific concrete type satisfying the courier.Channel interface
func (*DBChannel) ChannelType ¶
func (c *DBChannel) ChannelType() courier.ChannelType
ChannelType returns the type of this channel
func (*DBChannel) ConfigForKey ¶
ConfigForKey returns the config value for the passed in key, or defaultValue if it isn't found
func (*DBChannel) OrgConfigForKey ¶ added in v1.0.9
OrgConfigForKey returns the org config value for the passed in key, or defaultValue if it isn't found
func (*DBChannel) StringConfigForKey ¶ added in v0.2.0
StringConfigForKey returns the config value for the passed in key, or defaultValue if it isn't found
func (*DBChannel) UUID ¶
func (c *DBChannel) UUID() courier.ChannelUUID
UUID returns the UUID of this channel
type DBChannelEvent ¶ added in v0.8.0
type DBChannelEvent struct { ID_ ChannelEventID ` db:"id"` OrgID_ OrgID `json:"org_id" db:"org_id"` ChannelUUID_ courier.ChannelUUID `json:"channel_uuid" db:"channel_uuid"` ChannelID_ courier.ChannelID `json:"channel_id" db:"channel_id"` URN_ urns.URN `json:"urn" db:"urn"` EventType_ courier.ChannelEventType `json:"event_type" db:"event_type"` Extra_ *utils.NullMap `json:"extra" db:"extra"` OccurredOn_ time.Time `json:"occurred_on" db:"occurred_on"` CreatedOn_ time.Time `json:"created_on" db:"created_on"` ContactName_ string `json:"contact_name"` ContactID_ ContactID `json:"-" db:"contact_id"` ContactURNID_ ContactURNID `json:"-" db:"contact_urn_id"` // contains filtered or unexported fields }
DBChannelEvent represents an event on a channel
func (*DBChannelEvent) AddLog ¶ added in v0.8.0
func (e *DBChannelEvent) AddLog(log *courier.ChannelLog)
func (*DBChannelEvent) ChannelID ¶ added in v0.8.0
func (e *DBChannelEvent) ChannelID() courier.ChannelID
func (*DBChannelEvent) ChannelUUID ¶ added in v0.8.0
func (e *DBChannelEvent) ChannelUUID() courier.ChannelUUID
func (*DBChannelEvent) ContactName ¶ added in v0.8.0
func (e *DBChannelEvent) ContactName() string
func (*DBChannelEvent) CreatedOn ¶ added in v0.8.0
func (e *DBChannelEvent) CreatedOn() time.Time
func (*DBChannelEvent) EventType ¶ added in v0.8.0
func (e *DBChannelEvent) EventType() courier.ChannelEventType
func (*DBChannelEvent) Logs ¶ added in v0.8.0
func (e *DBChannelEvent) Logs() []*courier.ChannelLog
func (*DBChannelEvent) OccurredOn ¶ added in v0.8.0
func (e *DBChannelEvent) OccurredOn() time.Time
func (*DBChannelEvent) ReceiveID ¶ added in v0.8.0
func (e *DBChannelEvent) ReceiveID() int64
func (*DBChannelEvent) URN ¶ added in v0.8.0
func (e *DBChannelEvent) URN() urns.URN
func (*DBChannelEvent) WithContactName ¶ added in v0.8.0
func (e *DBChannelEvent) WithContactName(name string) courier.ChannelEvent
func (*DBChannelEvent) WithExtra ¶ added in v0.8.0
func (e *DBChannelEvent) WithExtra(extra map[string]interface{}) courier.ChannelEvent
func (*DBChannelEvent) WithOccurredOn ¶ added in v0.8.0
func (e *DBChannelEvent) WithOccurredOn(time time.Time) courier.ChannelEvent
type DBContact ¶
type DBContact struct { OrgID OrgID `db:"org_id"` ID ContactID `db:"id"` UUID string `db:"uuid"` Name null.String `db:"name"` URNID ContactURNID `db:"urn_id"` CreatedOn time.Time `db:"created_on"` ModifiedOn time.Time `db:"modified_on"` CreatedBy int `db:"created_by_id"` ModifiedBy int `db:"modified_by_id"` IsNew bool }
DBContact is our struct for a contact in the database
type DBContactURN ¶
type DBContactURN struct { OrgID OrgID `db:"org_id"` ID ContactURNID `db:"id"` Identity string `db:"identity"` Scheme string `db:"scheme"` Path string `db:"path"` Display null.String `db:"display"` Priority int `db:"priority"` ChannelID courier.ChannelID `db:"channel_id"` ContactID ContactID `db:"contact_id"` }
DBContactURN is our struct to map to database level URNs
type DBMsg ¶
type DBMsg struct { OrgID_ OrgID `json:"org_id" db:"org_id"` ID_ courier.MsgID `json:"id" db:"id"` UUID_ courier.MsgUUID `json:"uuid"` Direction_ MsgDirection `json:"direction" db:"direction"` Status_ courier.MsgStatusValue `json:"status" db:"status"` Visibility_ MsgVisibility `json:"visibility" db:"visibility"` HighPriority_ null.Bool `json:"high_priority" db:"high_priority"` URN_ urns.URN `json:"urn"` Text_ string `json:"text" db:"text"` Attachments_ pq.StringArray `json:"attachments" db:"attachments"` ExternalID_ null.String `json:"external_id" db:"external_id"` ChannelID_ courier.ChannelID `json:"channel_id" db:"channel_id"` ContactID_ ContactID `json:"contact_id" db:"contact_id"` ContactURNID_ ContactURNID `json:"contact_urn_id" db:"contact_urn_id"` MessageCount_ int `json:"msg_count" db:"msg_count"` ErrorCount_ int `json:"error_count" db:"error_count"` ChannelUUID_ courier.ChannelUUID `json:"channel_uuid"` ContactName_ string `json:"contact_name"` NextAttempt_ time.Time `json:"next_attempt" db:"next_attempt"` CreatedOn_ time.Time `json:"created_on" db:"created_on"` ModifiedOn_ time.Time `json:"modified_on" db:"modified_on"` QueuedOn_ time.Time `json:"queued_on" db:"queued_on"` SentOn_ time.Time `json:"sent_on" db:"sent_on"` Channel_ courier.Channel `json:"-"` WorkerToken_ queue.WorkerToken `json:"-"` AlreadyWritten_ bool `json:"-"` }
DBMsg is our base struct to represent msgs both in our JSON and db representations
func (*DBMsg) Attachments ¶
func (*DBMsg) ContactName ¶
func (*DBMsg) ExternalID ¶
func (*DBMsg) HighPriority ¶ added in v1.0.6
func (*DBMsg) ReceivedOn ¶ added in v0.2.0
func (*DBMsg) WithAttachment ¶ added in v0.2.0
WithAttachment can be used to append to the media urls for a message
func (*DBMsg) WithContactName ¶ added in v0.2.0
WithContactName can be used to set the contact name on a msg
func (*DBMsg) WithExternalID ¶ added in v0.2.0
WithExternalID can be used to set the external id on a msg in a chained call
func (*DBMsg) WithReceivedOn ¶ added in v0.2.0
WithReceivedOn can be used to set sent_on on a msg in a chained call
type DBMsgStatus ¶
type DBMsgStatus struct { ChannelUUID_ courier.ChannelUUID `json:"channel_uuid" db:"channel_uuid"` ID_ courier.MsgID `json:"msg_id,omitempty" db:"msg_id"` ExternalID_ string `json:"external_id,omitempty" db:"external_id"` Status_ courier.MsgStatusValue `json:"status" db:"status"` ModifiedOn_ time.Time `json:"modified_on" db:"modified_on"` // contains filtered or unexported fields }
DBMsgStatus represents a status update on a message
func (*DBMsgStatus) AddLog ¶ added in v0.2.0
func (s *DBMsgStatus) AddLog(log *courier.ChannelLog)
func (*DBMsgStatus) ChannelUUID ¶
func (s *DBMsgStatus) ChannelUUID() courier.ChannelUUID
func (*DBMsgStatus) ExternalID ¶
func (s *DBMsgStatus) ExternalID() string
func (*DBMsgStatus) ID ¶
func (s *DBMsgStatus) ID() courier.MsgID
func (*DBMsgStatus) Logs ¶ added in v0.2.0
func (s *DBMsgStatus) Logs() []*courier.ChannelLog
func (*DBMsgStatus) SetExternalID ¶ added in v0.2.0
func (s *DBMsgStatus) SetExternalID(id string)
func (*DBMsgStatus) SetStatus ¶ added in v0.2.0
func (s *DBMsgStatus) SetStatus(status courier.MsgStatusValue)
func (*DBMsgStatus) Status ¶
func (s *DBMsgStatus) Status() courier.MsgStatusValue
type MsgDirection ¶
type MsgDirection string
MsgDirection is the direction of a message
const ( MsgIncoming MsgDirection = "I" MsgOutgoing MsgDirection = "O" NilMsgDirection MsgDirection = "" )
Possible values for MsgDirection
type MsgVisibility ¶
type MsgVisibility string
MsgVisibility is the visibility of a message
const ( MsgVisible MsgVisibility = "V" MsgDeleted MsgVisibility = "D" MsgArchived MsgVisibility = "A" )
Possible values for MsgVisibility