Documentation
¶
Index ¶
- Constants
- func NewBusinessError(err error) error
- func NewError(code int, err error) error
- func VerifyMessage(message Message) error
- type Error
- type Message
- func (m *Message) AddTopicId(id int, more ...int) *Message
- func (m *Message) AddUId(id string, more ...string) *Message
- func (m Message) Send() (SendResult, error)
- func (m *Message) SetContent(content string) *Message
- func (m *Message) SetContentType(ct contentType) *Message
- func (m *Message) SetUrl(url string) *Message
- type QueryResult
- type SendResult
Constants ¶
View Source
const ContentHtml = contentType(2)
View Source
const ContentMarkdown = contentType(3)
View Source
const ContentText = contentType(1)
View Source
const UrlBase = "http://wxpusher.zjiecode.com"
View Source
const UrlMessageStatus = UrlBase + "/api/send/query/${messageId}"
View Source
const UrlSendMessage = UrlBase + "/api/send/message"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Message ¶
type Message struct {
AppToken string `json:"appToken"`
Content string `json:"content"`
ContentType contentType `json:"contentType"`
TopicIds []int `json:"topicIds"`
UIds []string `json:"uids"`
Url string `json:"url"`
}
Message 消息结构体
func NewMessage ¶
func (Message) Send ¶
func (m Message) Send() (SendResult, error)
func (*Message) SetContent ¶
func (*Message) SetContentType ¶
type QueryResult ¶
type QueryResult struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data int `json:"data"`
Success bool `json:"success"`
}
func QueryMessageStatus ¶
func QueryMessageStatus(messageId int) (QueryResult, error)
QueryMessageStatus 查询消息发送状态
func (*QueryResult) Error ¶
func (result *QueryResult) Error() error
type SendResult ¶
type SendResult struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data []struct {
Uid string `json:"uid"`
TopicId string `json:"topicId"`
MessageId int `json:"messageId"`
Code int `json:"code"`
Status string `json:"status"`
} `json:"data"`
Success bool `json:"success"`
}
SendResult
Click to show internal directories.
Click to hide internal directories.