Documentation
¶
Index ¶
- Variables
- func DefaultEchoHandle(token string, w http.ResponseWriter, r *http.Request)
- func SHA1Sign(args ...string) string
- type ArticleMessage
- type EncryptMessage
- type GetTokenFunc
- type ImageMessage
- type MessageHandle
- type Messager
- type MusicMessage
- type Option
- type PlainMessage
- type Server
- type TextMessage
- type VideoMessage
- type VoiceMessage
- type WXBizMsgCrypto
- type WXBizMsgCryptor
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrEmptyBody = errors.New("empty body")
ErrEmptyBody ...
View Source
var ErrSignatureMismatch = errors.New("signature mismatch")
ErrSignatureMismatch signature mismatch
Functions ¶
func DefaultEchoHandle ¶
func DefaultEchoHandle(token string, w http.ResponseWriter, r *http.Request)
DefaultEchoHandle This is the default Echo Handle, which will be used when WeChat Public sends an authentication request
Types ¶
type ArticleMessage ¶
type ArticleMessage struct {
// contains filtered or unexported fields
}
ArticleMessage ...
type EncryptMessage ¶
type EncryptMessage struct {
// Encrypt ...
Encrypt string `xml:"Encrypt"`
// MsgSignature ...
MsgSignature string `xml:"MsgSignature"`
// TimeStamp ...
TimeStamp int64 `xml:"TimeStamp"`
// Nonce ...
Nonce string `xml:"Nonce"`
PlainMessage
}
EncryptMessage ...
func ValidateWebhook ¶
func ValidateWebhook(r *http.Request, token string) (msg *EncryptMessage, payload []byte, encrypted bool, err error)
ValidateWebhook ...
type ImageMessage ¶
type ImageMessage struct {
// contains filtered or unexported fields
}
ImageMessage ...
type MessageHandle ¶
type MessageHandle func(ctx context.Context, msg *PlainMessage) (Messager, error)
MessageHandle ...
type MusicMessage ¶
type MusicMessage struct {
// contains filtered or unexported fields
}
MusicMessage ...
type PlainMessage ¶
type PlainMessage struct {
// ToUserName 开发者微信号
ToUserName string `xml:"ToUserName"`
// FromUserName 发送方帐号(一个OpenID)
FromUserName string `xml:"FromUserName"`
// CreateTime 消息创建时间 (整型)
CreateTime int64 `xml:"CreateTime"`
// MsgType 消息类型,文本为text
MsgType string `xml:"MsgType"`
// MsgID 消息id,64位整型
MsgID int64 `xml:"MsgId"`
// Content 文本消息内容
Content string `xml:"Content"`
// Event 事件类型,subscribe
Event string `xml:"Event"`
}
PlainMessage ...
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server implements http.Handler. It validates incoming WeChat Public Platform webhooks and then dispatches them to the appropriate plugins.
type TextMessage ¶
type TextMessage struct {
Content string
// contains filtered or unexported fields
}
TextMessage ...
type VideoMessage ¶
type VideoMessage struct {
// MediaID 通过素材管理中的接口上传多媒体文件,得到的id。
MediaID string `xml:"MediaId"`
// Title 视频消息的标题
Title string `xml:"Title"`
// Description 视频消息的描述
Description string `xml:"Description"`
// contains filtered or unexported fields
}
VideoMessage ...
type VoiceMessage ¶
type VoiceMessage struct {
// contains filtered or unexported fields
}
VoiceMessage ...
type WXBizMsgCrypto ¶
type WXBizMsgCrypto struct {
// contains filtered or unexported fields
}
WXBizMsgCrypto ...
func NewWXBizMsgCrypto ¶
func NewWXBizMsgCrypto(encodingAESKey, appID, token string) (*WXBizMsgCrypto, error)
NewWXBizMsgCrypto ...
func (*WXBizMsgCrypto) DecryptMessage ¶
func (wc *WXBizMsgCrypto) DecryptMessage(payload []byte, v interface{}) error
DecryptMessage ...
func (*WXBizMsgCrypto) EncryptMessage ¶
func (wc *WXBizMsgCrypto) EncryptMessage(payload []byte, timestamp int64, nonce string) ([]byte, error)
EncryptMessage ...
Click to show internal directories.
Click to hide internal directories.