rapidpro

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2017 License: AGPL-3.0 Imports: 24 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NilChannelID = ChannelID{sql.NullInt64{Int64: 0, Valid: false}}

NilChannelID is our nil value for ChannelIDs

View Source
var NilContactID = ContactID{sql.NullInt64{Int64: 0, Valid: false}}

NilContactID represents our nil value for ContactID

View Source
var NilContactURNID = ContactURNID{sql.NullInt64{Int64: 0, Valid: false}}

NilContactURNID is our nil value for ContactURNID

View Source
var NilOrgID = OrgID{sql.NullInt64{Int64: 0, Valid: false}}

NilOrgID is our nil value for OrgID

Functions

This section is empty.

Types

type ChannelID

type ChannelID struct {
	sql.NullInt64
}

ChannelID is our SQL type for a channel's id

type ContactID

type ContactID struct {
	sql.NullInt64
}

ContactID is our representation of our database contact id

type ContactURNID

type ContactURNID struct {
	sql.NullInt64
}

ContactURNID represents a contact urn's id

type DBChannel

type DBChannel struct {
	OrgID_       OrgID               `db:"org_id"`
	ID_          ChannelID           `db:"id"`
	ChannelType_ courier.ChannelType `db:"channel_type"`
	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) Address

func (c *DBChannel) Address() string

Address returns the address of this channel

func (*DBChannel) ChannelType

func (c *DBChannel) ChannelType() courier.ChannelType

ChannelType returns the type of this channel

func (*DBChannel) ConfigForKey

func (c *DBChannel) ConfigForKey(key string, defaultValue interface{}) interface{}

ConfigForKey returns the config value for the passed in key, or defaultValue if it isn't found

func (*DBChannel) Country

func (c *DBChannel) Country() string

Country returns the country code for this channel if any

func (*DBChannel) ID

func (c *DBChannel) ID() ChannelID

ID returns the id of this channel

func (*DBChannel) OrgID

func (c *DBChannel) OrgID() OrgID

OrgID returns the id of the org this channel is for

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"`
	URN       courier.URN  `db:"urn"`
	Scheme    string       `db:"scheme"`
	Path      string       `db:"path"`
	Priority  int          `db:"priority"`
	ChannelID 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.MsgStatus `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 []string          `json:"attachments"`
	ExternalID  string            `json:"external_id"  db:"external_id"`

	ChannelID    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"`
}

DBMsg is our base struct to represent msgs both in our JSON and db representations

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.MsgStatus   `json:"status"                   db:"status"`
	ModifiedOn  time.Time           `json:"modified_on"              db:"modified_on"`
}

DBMsgStatus represents a status update on a message

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

type OrgID

type OrgID struct {
	sql.NullInt64
}

OrgID is our type for database Org ids

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL