Documentation ¶
Index ¶
Constants ¶
View Source
const ( StagePlatform = "platform" StageQueue = "queue" StageQueueResponse = "queue.response" StageCarrier = "carrier" StageCarrierReceipt = "carrier.receipt" )
View Source
const NotFoundProvider = "_not_found_"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type JSON ¶
type JSON json.RawMessage
JSON is a json.RawMessage, which is a []byte underneath. Value() validates the json format in the source, and returns an error if the json is not valid. Scan does no validation. JSON additionally implements `Unmarshal`, which unmarshals the json within to an interface{}
See https://github.com/jmoiron/sqlx/blob/master/types/types.go
func (JSON) MarshalJSON ¶
MarshalJSON returns the *j as the JSON encoding of j.
func (*JSON) UnmarshalJSON ¶
UnmarshalJSON sets *j to a copy of data
type Message ¶
type Message struct { ID string `json:"id"` // Message ID To string `json:"to" db:"toNumber"` // The destination phone number (E.164 format) From string `json:"from" db:"fromName"` // Sender ID (phone number or alphanumeric) Body string `json:"body"` // The text of the message Async bool `json:"async"` // Enable a background sending mode that is optimized for bulk sending Route *string `json:"route"` Provider *string `json:"provider"` ProviderMessageID *string `json:"provider_message_id" db:"providerMessageId"` Steps JSON `json:"steps"` Status StatusCode `json:"status"` CreatedTime time.Time `json:"created_time" db:"createdTime"` UpdatedTime *time.Time `json:"updated_time" db:"updatedTime"` }
func NewMessage ¶
func (*Message) AddStep ¶
func (m *Message) AddStep(step MessageStep)
func (*Message) GetSteps ¶
func (m *Message) GetSteps() []MessageStep
func (*Message) HandleStep ¶
func (m *Message) HandleStep(wrap MessageStepWrap)
func (*Message) SetSteps ¶
func (m *Message) SetSteps(steps []MessageStep)
type MessageJob ¶
func NewMessageJob ¶
func NewMessageJob(to, from, body string, async bool) *MessageJob
type MessageReceipt ¶
type MessageReceipt struct { MessageStep ProviderMessageID string Provider string }
func NewMessageReceipt ¶
func NewMessageReceipt(providerMessageID, provider string, status StatusCode, receipt interface{}) *MessageReceipt
type MessageResponse ¶
type MessageResponse struct { MessageStep ProviderMessageID *string }
func NewMessageResponse ¶
func NewMessageResponse(status StatusCode, response interface{}, providerMessageID *string) *MessageResponse
type MessageStep ¶
type MessageStep struct { Stage string `json:"stage"` Data interface{} `json:"data"` Status StatusCode `json:"status"` CreatedTime time.Time `json:"created_time" db:"createdTime"` }
func NewMessageStepSending ¶
func NewMessageStepSending() *MessageStep
func (MessageStep) GetStep ¶
func (ms MessageStep) GetStep() MessageStep
type MessageStepWrap ¶
type MessageStepWrap interface {
GetStep() MessageStep
}
type Provider ¶
type Provider interface { Name() string Send(message Message) *MessageResponse Callback(register func(webhook *Webhook), receipts chan<- MessageReceipt) }
type ProviderError ¶
type ProviderError struct {
Error string `json:"error"`
}
type Route ¶
type Route struct { ID int64 `json:"-"` Name string `json:"name"` Pattern string `json:"pattern"` Provider string `json:"provider"` From string `json:"from" db:"fromName"` IsActive bool `json:"is_active" db:"isActive"` // contains filtered or unexported fields }
func (*Route) GetProvider ¶
func (*Route) SetPattern ¶
func (*Route) SetProvider ¶
type Stats ¶
type StatusCode ¶
type StatusCode int
const ( StatusInit StatusCode = iota // Default status, This should not be exported to client StatusAccepted // Received your API request to send a message StatusQueued // The message is queued to be sent out StatusSending // The message is in the process of dispatching to the upstream carrier StatusFailed // The message could not be sent to the upstream carrier StatusSent // The message was successfully accepted by the upstream carrie StatusUnknown // Received an undocumented status code from the upstream carrier StatusUndelivered // Received that the message was not delivered from the upstream carrier StatusDelivered // Received confirmation of message delivery from the upstream carrier )
Status
func (StatusCode) MarshalJSON ¶
func (c StatusCode) MarshalJSON() ([]byte, error)
func (*StatusCode) Scan ¶
func (c *StatusCode) Scan(src interface{}) error
func (StatusCode) String ¶
func (c StatusCode) String() string
func (*StatusCode) UnmarshalJSON ¶
func (c *StatusCode) UnmarshalJSON(data []byte) error
Click to show internal directories.
Click to hide internal directories.