Documentation
¶
Overview ¶
Package ippanel is an official library for working with ippanel sms api. brief documentation for ippanel sms api provided at http://docs.ippanel.com
Index ¶
- Constants
- Variables
- func ParseErrors(res *BaseResponse) error
- type BaseResponse
- type Error
- type FieldErrs
- type InboxMessage
- type Ippanel
- func (sms *Ippanel) CreatePattern(pattern string, description string, variables map[string]string, ...) (string, error)
- func (sms *Ippanel) FetchInbox(pp ListParams) ([]InboxMessage, *PaginationInfo, error)
- func (sms *Ippanel) FetchStatuses(MessageId int64, pp ListParams) ([]MessageRecipient, *PaginationInfo, error)
- func (sms *Ippanel) GetCredit() (float64, error)
- func (sms *Ippanel) GetMessage(MessageId int64) (*Message, error)
- func (sms *Ippanel) Send(sender string, recipients []string, message string, summary string) (int64, error)
- func (sms *Ippanel) SendPattern(patternCode string, originator string, recipient string, ...) (int64, error)
- type ListParams
- type Message
- type MessageConfirmState
- type MessageRecipient
- type PaginationInfo
- type Pattern
- type PatternResType
- type PatternStatus
- type PatternVariable
- type ResponseCode
Constants ¶
View Source
const ( // ClientVersion is used in User-Agent request header to provide server with API level. ClientVersion = "2.0.0" // Endpoint points you to Ippanel REST API. Endpoint = "https://api2.ippanel.com/api/v1" )
Variables ¶
View Source
var ( ErrUnexpectedResponse = errors.New("The Ippanel API is currently unavailable") )
Functions ¶
Types ¶
type BaseResponse ¶
type BaseResponse struct { Status string `json:"status"` Code ResponseCode `json:"code"` Data json.RawMessage `json:"data"` Meta *PaginationInfo `json:"meta"` ErrorMessage string `json:"error_message"` }
BaseResponse base response model
type Error ¶
type Error struct { Code ResponseCode Message interface{} }
Error general service error
type InboxMessage ¶
type InboxMessage struct { To string `json:"to"` Message string `json:"message"` From string `json:"from"` CreatedAt time.Time `json:"created_at"` Type string `json:"type"` }
InboxMessage inbox message
type Ippanel ¶
Ippanel ...
func (*Ippanel) CreatePattern ¶
func (sms *Ippanel) CreatePattern(pattern string, description string, variables map[string]string, delimiter string, isShare bool) (string, error)
CreatePattern create new pattern
func (*Ippanel) FetchInbox ¶
func (sms *Ippanel) FetchInbox(pp ListParams) ([]InboxMessage, *PaginationInfo, error)
FetchInbox fetch inbox messages list
func (*Ippanel) FetchStatuses ¶
func (sms *Ippanel) FetchStatuses(MessageId int64, pp ListParams) ([]MessageRecipient, *PaginationInfo, error)
FetchStatuses get message recipients statuses
func (*Ippanel) GetMessage ¶
GetMessage get a message by message_id
type ListParams ¶
ListParams ...
type Message ¶
type Message struct { MessageId int64 `json:"message_id"` Number string `json:"number"` Message string `json:"message"` State string `json:"state"` Type string `json:"type"` ConfirmState MessageConfirmState `json:"valid"` CreatedAt time.Time `json:"time"` SentAt time.Time `json:"time_sent"` RecipientCount int64 `json:"recipient_count"` ValidRecipientsCount int64 `json:"exit_count"` Part int64 `json:"part"` Cost float64 `json:"cost"` ReturnCost float64 `json:"return_cost"` Summary string `json:"summary"` }
Message message model
type MessageConfirmState ¶
type MessageConfirmState string
MessageConfirmState message confirm state
const ( // MessageConfirmeStatePending pending MessageConfirmeStatePending MessageConfirmState = "notconfirm" // MessageConfirmeStateConfirmed confirmed MessageConfirmeStateConfirmed MessageConfirmState = "approve" // MessageConfirmeStateRejected rejected MessageConfirmeStateRejected MessageConfirmState = "reject" )
type MessageRecipient ¶
MessageRecipient message recipient status
type PaginationInfo ¶
type PaginationInfo struct { Total int64 `json:"total"` Limit int64 `json:"limit"` Page int64 `json:"page"` Pages int64 `json:"pages"` Prev *string `json:"prev"` Next *string `json:"next"` }
PaginationInfo ...
type Pattern ¶
type Pattern struct { Code string `json:"code"` Status PatternStatus `json:"status"` Message string `json:"message"` }
Pattern pattern
type PatternResType ¶
type PatternResType struct {
Code string `json:"code"`
}
type PatternStatus ¶
type PatternStatus string
PatternStatus ...
const ( // PatternStatusActive active PatternStatusActive PatternStatus = "active" // PatternStatusInactive inactive PatternStatusInactive PatternStatus = "inactive" // PatternStatusPending pending PatternStatusPending PatternStatus = "pending" )
type PatternVariable ¶
type ResponseCode ¶
type ResponseCode int
ResponseCode api response code error type
const ( ErrForbidden ResponseCode = 403 ErrNotFound ResponseCode = 404 ErrUnprocessableEntity ResponseCode = 422 ErrInternalServer ResponseCode = 500 )
Click to show internal directories.
Click to hide internal directories.