Documentation ¶
Index ¶
- Variables
- 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) OrgID() OrgID
- func (c *DBChannel) Schemes() []string
- func (c *DBChannel) StringConfigForKey(key string, defaultValue string) string
- func (c *DBChannel) UUID() courier.ChannelUUID
- 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) ID() courier.MsgID
- func (m *DBMsg) ReceivedOn() *time.Time
- func (m *DBMsg) SentOn() *time.Time
- func (m *DBMsg) Text() string
- func (m *DBMsg) URN() courier.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 MsgPriority
- 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 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"` Address_ sql.NullString `db:"address"` Country_ sql.NullString `db:"country"` Config_ utils.NullMap `db:"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) 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 DBContact ¶
type DBContact struct { OrgID OrgID `db:"org_id"` ID ContactID `db:"id"` UUID string `db:"uuid"` Name 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"` }
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"` Priority_ MsgPriority `json:"priority" db:"priority"` URN_ courier.URN `json:"urn"` Text_ string `json:"text" db:"text"` Attachments_ pq.StringArray `json:"attachments" db:"attachments"` ExternalID_ 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 WorkerToken_ queue.WorkerToken AlreadyWritten_ bool }
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) 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 MsgPriority ¶
type MsgPriority int
MsgPriority is the priority of our message
const ( BulkPriority MsgPriority = 100 DefaultPriority MsgPriority = 500 HighPriority MsgPriority = 1000 )
Possible values for MsgPriority
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