messages

package
v0.0.0-...-9b4e82f Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2019 License: MIT Imports: 5 Imported by: 4

Documentation

Index

Constants

View Source
const BuyItemAction = "buy"
View Source
const ChatAction = "chat"
View Source
const ConnectAction = "connect"
View Source
const DeleteAction = "delete"
View Source
const ItemAction = "item"
View Source
const LevelUpAction = "level_up"
View Source
const NotificationAck = "ack"
View Source
const NotificationAction = "notification"
View Source
const ObjectAction = "object"
View Source
const ProspectTradeAction = "prospect"
View Source
const QueryAction = "query"
View Source
const ResponseAction = "response"
View Source
const SetAction = "set"
View Source
const TradeAction = "trade"
View Source
const TransferAction = "transfer"
View Source
const UpdateAction = "update"
View Source
const UseItemAction = "use"
View Source
const ViewItemAction = "view"

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountResponseMessage

type AccountResponseMessage struct {
	Success      bool                   `json:"success"`
	Config       map[string]interface{} `json:"config"`
	SessionToken string                 `json:"token,omitempty"`
	Uuid         string                 `json:"uuid,omitempty"`
	Err          string                 `json:"err,omitempty"`
	Init         map[string]interface{} `json:"init,omitempty"`
}

type BaseMessage

type BaseMessage struct {
	Action    string      `json:"action"`
	Msg       interface{} `json:"msg"`
	RequestID string      `json:"request_id,omitempty"`
}

func BuildChatMessage

func BuildChatMessage(message *ChatMessage) *BaseMessage

func BuildDeleteMessage

func BuildDeleteMessage(o id.Identifiable) *BaseMessage

func BuildDeleteResponseMsg

func BuildDeleteResponseMsg(requestId string, err error) *BaseMessage

func BuildItemBuyFailedMessage

func BuildItemBuyFailedMessage(itemConfig, requestId string, err error) *BaseMessage

func BuildItemBuySuccessMessage

func BuildItemBuySuccessMessage(itemConfig, requestId, itemUuid string) *BaseMessage

func BuildItemUseFailedMessage

func BuildItemUseFailedMessage(itemUuid, requestId string, err error) *BaseMessage

func BuildItemUseMessage

func BuildItemUseMessage(itemUUid, requestId string, result interface{}) *BaseMessage

func BuildItemViewFailedMessage

func BuildItemViewFailedMessage(itemUuid, requestId string, err error) *BaseMessage

func BuildItemViewMessage

func BuildItemViewMessage(itemUUid, requestId string, result interface{}) *BaseMessage

func BuildLevelUpResponse

func BuildLevelUpResponse(requestId string, err error) *BaseMessage

func BuildNotificationMessage

func BuildNotificationMessage(n interface{}) *BaseMessage

func BuildResponseMsg

func BuildResponseMsg(response interface{}, requestID string) *BaseMessage

func BuildUpdateMessage

func BuildUpdateMessage(obj interface{}) *BaseMessage

func FailedConnect

func FailedConnect(err error) *BaseMessage

func NewErrorMessage

func NewErrorMessage(err string) *BaseMessage

func NewObjectMessage

func NewObjectMessage(identifiable id.Identifiable) *BaseMessage

func SuccessConnect

func SuccessConnect(userGuid, token string, config map[string]interface{}) *BaseMessage

func (*BaseMessage) IsChat

func (baseMessage *BaseMessage) IsChat() bool

func (*BaseMessage) IsConnect

func (baseMessage *BaseMessage) IsConnect() bool

func (*BaseMessage) IsNotification

func (baseMessage *BaseMessage) IsNotification() bool

func (*BaseMessage) IsNotificationAck

func (baseMessage *BaseMessage) IsNotificationAck() bool

func (*BaseMessage) IsQuery

func (baseMessage *BaseMessage) IsQuery() bool

func (*BaseMessage) IsTrade

func (baseMessage *BaseMessage) IsTrade() bool

func (*BaseMessage) IsTransfer

func (baseMessage *BaseMessage) IsTransfer() bool

func (*BaseMessage) IsUpdate

func (baseMessage *BaseMessage) IsUpdate() bool

func (*BaseMessage) UnmarshalJSON

func (baseMessage *BaseMessage) UnmarshalJSON(data []byte) error

* custom unmarshal for json data since the action depends on what the lower level msg is

type BatchMessage

type BatchMessage []BaseMessage

type ChatMessage

type ChatMessage struct {
	Message   string    `json:"message_body"`
	Author    string    `json:"author"`
	Timestamp time.Time `json:"timestamp"`
}

type ConnectMessage

type ConnectMessage struct {
	SessionToken string `json:"token"`
}

type DeleteMessage

type DeleteMessage struct {
	Uuid string `json:"uuid"`
	Type string `json:"type"`
}

type DeleteResponse

type DeleteResponse struct {
	Success bool   `json:"success"`
	Err     string `json:"err"`
}

type ItemBuyMessage

type ItemBuyMessage struct {
	ItemUid    string `json:"uuid"`
	ItemConfig string `json:"item_config"`
	Success    bool   `json:"success"`
	Err        string `json:"err,omitempty"`
}

type ItemMessage

type ItemMessage struct {
	Action string      `json:"action"`
	O      interface{} `json:"o"`
}

func (*ItemMessage) UnmarshalJSON

func (itemMessage *ItemMessage) UnmarshalJSON(data []byte) error

* custom unmarshal for json data since the action depends on what the lower level msg is

type ItemUseMessage

type ItemUseMessage struct {
	ItemUuid      string      `json:"uuid"`
	UseParameters interface{} `json:"params,omitempty"`
	Result        interface{} `json:"result,omitempty"`
	Success       bool        `json:"success"`
	Err           string      `json:"err,omitempty"`
}

type ItemViewMessage

type ItemViewMessage struct {
	ItemUuid string      `json:"uuid"`
	Result   interface{} `json:"result,omitempty"`
	Success  bool        `json:"success"`
	Err      string      `json:"err"`
}

type LevelUpMessage

type LevelUpMessage struct {
}

type LevelUpResponse

type LevelUpResponse struct {
	Success bool   `json:"success"`
	Err     string `json:"err,omitempty"`
}

type Message

type Message interface {
	// contains filtered or unexported methods
}

type NotificationAckMessage

type NotificationAckMessage struct {
	Uuid string `json:"uuid"`
}

type NotificationMessage

type NotificationMessage struct {
	Notification interface{} `json:"notification"`
	Type         string      `json:"type"`
	Timestamp    time.Time   `json:"timestamp"`
	Seen         bool        `json:"seen"`
	Uuid         string      `json:"uuid"`
}

type ObjectMessage

type ObjectMessage struct {
	Type  string          `json:"type"`
	Id    string          `json:"uuid"`
	Value id.Identifiable `json:"object"`
}

type QueryMessage

type QueryMessage struct {
	QueryUUID     string         `json:"uuid"`
	QueryField    string         `json:"field"`
	NumberPoints  int            `json:"num_points"`
	Length        utils.Duration `json:"length"`
	ForceUpdate   bool           `json:"force_update"`
	CacheDuration utils.Duration `json:"cache_duration"`
}

type QueryResponse

type QueryResponse struct {
	Success bool            `json:"success"`
	Error   string          `json:"error"`
	Message *QueryMessage   `json:"message"`
	Points  [][]interface{} `json:"points"`
}

type SetMessage

type SetMessage struct {
	Set   string      `json:"set"`
	Value interface{} `json:"value"`
}

type SetResponse

type SetResponse struct {
	Success bool   `json:"success"`
	Err     string `json:"error,omitempty"`
}

func BuildFailedSet

func BuildFailedSet(err error) *SetResponse

func BuildSuccessSet

func BuildSuccessSet() *SetResponse

type TradeMessage

type TradeMessage struct {
	StockId    string `json:"stock_id"`
	ExchangeID string `json:"-"`
	Amount     int64  `json:"amount"`
}

type TradeResponse

type TradeResponse struct {
	Trade    *TradeMessage `json:"trade"`
	Response interface{}   `json:"response"`
}

type TransferMessage

type TransferMessage struct {
	Amount    int64  `json:"amount"`
	Recipient string `json:"recipient"`
}

type TransferResponse

type TransferResponse struct {
	Transfer *TransferMessage `json:"transfer"`
	Response interface{}      `json:"response"`
}

type UpdateMessage

type UpdateMessage struct {
}

Jump to

Keyboard shortcuts

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