apiserver

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2016 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package apiserver provides an HTTP handler for sending and receiving SMS via an SMSC.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeliveryReceipt

type DeliveryReceipt struct {
	Src  string `json:"src"`
	Dst  string `json:"dst"`
	Text string `json:"text"`
}

DeliveryReceipt contains the arguments of RPC call to SM.Deliver. We only call it, not handle.

type Handler

type Handler struct {
	http.Handler

	// Prefix of all endpoints served by the handler.
	// Defaults to "/" if not set.
	Prefix string

	// VersionTag that follows the prefix.
	// Defaults to "v1" if not set.
	VersionTag string

	// SMPP Transceiver for sending and receiving SMS.
	// Register will update its Handler and Bind it.
	Tx *smpp.Transceiver
	// contains filtered or unexported fields
}

Handler is an HTTP handler that provides the endpoints of this service. It registers itself onto an existing ServeMux via Register.

func (*Handler) Register

func (h *Handler) Register(mux *http.ServeMux) <-chan smpp.ConnStatus

Register add the endpoints of this service to the given ServeMux, and binds Tx. Returns the ConnStatus channel from Tx.Bind.

Must be called once, before the server is started.

type QueryMessage

type QueryMessage struct {
	Src       string `json:"src"`
	MessageID string `json:"message_id"`
}

QueryMessage contains the arguments of RPC call to SM.Query.

type QueryMessageResp

type QueryMessageResp struct {
	MsgState  string `json:"message_state"`
	FinalDate string `json:"final_date"`
	ErrCode   uint8  `json:"error_code"`
}

QueryMessageResp contains RPC response from SM.Query.

type SM

type SM struct {
	// contains filtered or unexported fields
}

SM export its public methods to JSON RPC.

func NewSM

func NewSM(tx *smpp.Transceiver, rs *rpc.Server) *SM

NewSM creates and initializes a new SM, registering its own methods onto the given rpc server.

func (*SM) Query

func (rpc *SM) Query(args *QueryMessage, resp *QueryMessageResp) error

Query queries the status of a short message via RPC.

func (*SM) Submit

func (rpc *SM) Submit(args *ShortMessage, resp *ShortMessageResp) error

Submit sends a short message via RPC.

type ShortMessage

type ShortMessage struct {
	Src      string `json:"src"`
	Dst      string `json:"dst"`
	Text     string `json:"text"`
	Enc      string `json:"enc"`
	Register string `json:"register"`
}

ShortMessage contains the arguments of RPC call to SM.Submit.

type ShortMessageResp

type ShortMessageResp struct {
	MessageID string `json:"message_id"`
}

ShortMessageResp contains of RPC response from SM.Submit.

Jump to

Keyboard shortcuts

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