Documentation
¶
Index ¶
- Constants
- Variables
- type Article
- type ArticleItem
- type ArticleResponseMessage
- type CDATAString
- type Context
- type Handler
- type ImageMessage
- type ImageResponseMessage
- type LinkMessage
- type LocationEventMessage
- type LocationMessage
- type MediaId
- type MenuClickEventMessage
- type MenuViewEventMessage
- type Middleware
- type MsgType
- type Music
- type MusicResponseMessage
- type PicListItem
- type PicMd5Sum
- type Request
- type Response
- type Route
- type Router
- type ScanCodeInfo
- type ScanEventMessage
- type ScanSubscribeEventMessage
- type SendLocationInfo
- type SendPicsInfo
- type ShortVideoMessage
- type SubscribeEventMessage
- type TextMessage
- type TextResponseMessage
- type UnsubscribeEventMessage
- type Video
- type VideoMessage
- type VideoResponseMessage
- type VoiceMessage
- type VoiceResponseMessage
- type Wechat
- func (w *Wechat) Decrypt(msgSignature, timestamp, nonce string, data []byte) (d []byte, err error)
- func (w *Wechat) DefaultHandler() Handler
- func (w *Wechat) Encrypt(d []byte) (b []byte, err error)
- func (w *Wechat) Image(h Handler)
- func (w *Wechat) Link(h Handler)
- func (w *Wechat) Location(h Handler)
- func (w *Wechat) LocationEvent(h Handler)
- func (w *Wechat) LocationSelectEven(h Handler)
- func (w *Wechat) MenuClickEvent(h Handler)
- func (w *Wechat) MenuViewEvent(h Handler)
- func (w *Wechat) PicPhotoOrAlbumEvent(h Handler)
- func (w *Wechat) PicSysphotoEvent(h Handler)
- func (w *Wechat) PicWeixinEvent(h Handler)
- func (w *Wechat) ScanEvent(h Handler)
- func (w *Wechat) ScanSubscribeEvent(h Handler)
- func (w *Wechat) ScancodePushEvent(h Handler)
- func (w *Wechat) ScancodeWaitmsgEvent(h Handler)
- func (w *Wechat) Server(rw http.ResponseWriter, r *http.Request)
- func (w *Wechat) SetDefaultHandler(h Handler)
- func (w *Wechat) SetEncodingAesKey(encodingAESKey string) (err error)
- func (w *Wechat) ShortVideo(h Handler)
- func (w *Wechat) SubscribeEvent(h Handler)
- func (w *Wechat) TemplateSendJobFinishEvent(h Handler)
- func (w *Wechat) Text(h Handler)
- func (w *Wechat) Trader() *trader.Trader
- func (w *Wechat) UnsubscribeEvent(h Handler)
- func (w *Wechat) Use(m ...Middleware)
- func (w *Wechat) Voice(h Handler)
- type WechatErrorHandler
- type WechatType
Constants ¶
View Source
const ( SubscriptionsType ServiceType )
Variables ¶
View Source
var ArticleCountOverError = errors.New("article count over 10")
Functions ¶
This section is empty.
Types ¶
type Article ¶
type Article struct {
Title CDATAString
Description CDATAString
PicUrl CDATAString
Url CDATAString
}
type ArticleItem ¶
type ArticleItem struct {
Item Article `xml:"item"`
}
func NewArticleItem ¶
func NewArticleItem(title, description, picUrl, url string) ArticleItem
type ArticleResponseMessage ¶
type ArticleResponseMessage struct {
XMLName xml.Name `xml:"xml"`
ToUserName string
FromUserName string
CreateTime int64
MsgType string
ArticleCount int
Articles []ArticleItem
}
func NewArticleResponseMessage ¶
func NewArticleResponseMessage(to, from string, articles ...ArticleItem) (a ArticleResponseMessage, err error)
type CDATAString ¶
type CDATAString struct {
CDATA string `xml:",cdata"`
}
type ImageMessage ¶
type ImageResponseMessage ¶
type ImageResponseMessage struct {
XMLName xml.Name `xml:"xml"`
ToUserName string
FromUserName string
CreateTime int64
MsgType string
Image MediaId
}
func NewImageResponseMessage ¶
func NewImageResponseMessage(to, from, mediaId string) ImageResponseMessage
type LinkMessage ¶
type LocationEventMessage ¶
type LocationMessage ¶
type MediaId ¶
type MediaId struct {
MediaId CDATAString
}
type MenuClickEventMessage ¶
type MenuViewEventMessage ¶
type Middleware ¶
type MsgType ¶
type MsgType int
const ( UnknownType MsgType = iota TextType ImageType VoiceType VideoType ShortVideoType LocationType LinkType EventType SubscribeEventType UnsubscribeEventType ScanEventType ScanSubscribeEventType LocationEventType MenuViewEventType MenuClickEventType ScancodePushEventType ScancodeWaitmsgEventType PicSysphotoEventType PicPhotoOrAlbumEventType PicWeixinEventType LocationSelectEvenType TemplateSendJobFinishEventType )
type Music ¶
type Music struct {
Title CDATAString
Description CDATAString
MusicUrl CDATAString
HQMusicUrl CDATAString
ThumbMediaId string
}
type MusicResponseMessage ¶
type MusicResponseMessage struct {
XMLName xml.Name `xml:"xml"`
ToUserName string
FromUserName string
CreateTime int64
MsgType string
Music Music
}
func NewMusicResponseMessage ¶
func NewMusicResponseMessage(to, from string, music Music) MusicResponseMessage
type PicListItem ¶
type PicListItem struct {
Item PicMd5Sum `xml:"item"`
}
type Request ¶
type Request interface {
ToUserName() string
FromUserName() string
CreateTime() int
MsgType() MsgType
Content() string
MsgId() int64
PicUrl() string
MediaId() string
Format() string
Recognition() string
ThumbMediaId() string
LocationX() float64
LocationY() float64
Scale() int
Label() string
Title() string
Description() string
Url() string
Event() string
EventKey() string
Ticket() string
Latitude() float32
Longitude() float32
Precision() float32
MenuId() int64
ScanCodeInfo() ScanCodeInfo
SendPicsInfo() SendPicsInfo
SendLocationInfo() SendLocationInfo
Status() string
}
type ScanCodeInfo ¶
type ScanEventMessage ¶
type SendLocationInfo ¶
type SendPicsInfo ¶
type SendPicsInfo struct {
Count int
PicList []PicListItem
}
type ShortVideoMessage ¶
type SubscribeEventMessage ¶
type SubscribeEventMessage interface {
Event() string
// contains filtered or unexported methods
}
type TextMessage ¶
type TextResponseMessage ¶
type TextResponseMessage struct {
XMLName xml.Name `xml:"xml"`
ToUserName string
FromUserName string
CreateTime int64
MsgType string
Content CDATAString
}
func NewTextResponseMessage ¶
func NewTextResponseMessage(to, from, content string) TextResponseMessage
type UnsubscribeEventMessage ¶
type UnsubscribeEventMessage interface {
Event() string
// contains filtered or unexported methods
}
type Video ¶
type Video struct {
MediaId CDATAString
Title CDATAString
Description CDATAString
}
type VideoMessage ¶
type VideoResponseMessage ¶
type VideoResponseMessage struct {
XMLName xml.Name `xml:"xml"`
ToUserName string
FromUserName string
CreateTime int64
MsgType string
Video Video
}
func NewVideoResponseMessage ¶
func NewVideoResponseMessage(to, from string, video Video) VideoResponseMessage
type VoiceMessage ¶
type VoiceResponseMessage ¶
type VoiceResponseMessage struct {
XMLName xml.Name `xml:"xml"`
ToUserName string
FromUserName string
CreateTime int64
MsgType string
Voice MediaId
}
func NewVoiceResponseMessage ¶
func NewVoiceResponseMessage(to, from, mediaId string) VoiceResponseMessage
type Wechat ¶
type Wechat struct {
AppID string
AppSecret string
Token string
EncodingAESKey string
WechatType WechatType
WechatErrorHandler WechatErrorHandler
// contains filtered or unexported fields
}
func (*Wechat) DefaultHandler ¶
func (*Wechat) LocationEvent ¶
func (*Wechat) LocationSelectEven ¶
func (*Wechat) MenuClickEvent ¶
func (*Wechat) MenuViewEvent ¶
func (*Wechat) PicPhotoOrAlbumEvent ¶
func (*Wechat) PicSysphotoEvent ¶
func (*Wechat) PicWeixinEvent ¶
func (*Wechat) ScanSubscribeEvent ¶
func (*Wechat) ScancodePushEvent ¶
func (*Wechat) ScancodeWaitmsgEvent ¶
func (*Wechat) SetDefaultHandler ¶
func (*Wechat) SetEncodingAesKey ¶
func (*Wechat) ShortVideo ¶
func (*Wechat) SubscribeEvent ¶
func (*Wechat) TemplateSendJobFinishEvent ¶
func (*Wechat) UnsubscribeEvent ¶
func (*Wechat) Use ¶
func (w *Wechat) Use(m ...Middleware)
type WechatErrorHandler ¶
type WechatType ¶
type WechatType int
Click to show internal directories.
Click to hide internal directories.