Documentation ¶
Index ¶
- Constants
- func DecryptAES(req EncryptedRequest, opts DecryptAESOptions) (buf []byte, err error)
- func Handler(altKeys ...string) winter.HandlerFunc
- func Installer(opts ...Option) wext.Installer
- type CDATA
- type Context
- type DecryptAESOptions
- type EncryptAESOptions
- type EncryptedRequest
- type EncryptedRequestData
- type EncryptedResponse
- type HandlerFunc
- type Option
- func SkipValidation(s bool) Option
- func WithAppID(appID string) Option
- func WithAppSecret(appSecret string) Option
- func WithEncodingAESKey(aesKey string) Option
- func WithEventHandler(evt string, h HandlerFunc) Option
- func WithMessageHandler(typ string, h HandlerFunc) Option
- func WithRedisKey(altKeys ...string) Option
- func WithToken(token string) Option
- type Request
- type Response
- type ValidationRequest
Constants ¶
View Source
const ( TypeText = "text" TypeImage = "image" TypeVoice = "voice" TypeVideo = "video" TypeLocation = "location" TypeLink = "link" TypeEvent = "event" EventSubscribe = "subscribe" EventUnsubscribe = "unsubscribe" EventScan = "SCAN" EventLocation = "LOCATION" EventClick = "CLICK" EventView = "VIEW" )
Variables ¶
This section is empty.
Functions ¶
func DecryptAES ¶
func DecryptAES(req EncryptedRequest, opts DecryptAESOptions) (buf []byte, err error)
func Handler ¶
func Handler(altKeys ...string) winter.HandlerFunc
Types ¶
type Context ¶
type Context interface { context.Context // AppID returns the app_id AppID() string // Req returns the decoded request Req() Request // Res returns the response Res() *Response // Text send text response Text(s string) // Empty send empty response Empty() }
Context WeChat handling context
type DecryptAESOptions ¶
type EncryptAESOptions ¶
type EncryptedRequest ¶
type EncryptedRequestData ¶
type EncryptedResponse ¶
type EncryptedResponse struct { XMLName xml.Name `xml:"xml"` Encrypt CDATA `xml:"Encrypt"` MsgSignature CDATA `xml:"MsgSignature"` Timestamp string `xml:"TimeStamp"` Nonce CDATA `xml:"Nonce"` }
func EncryptAES ¶
func EncryptAES(buf []byte, opts EncryptAESOptions) (res EncryptedResponse, err error)
type HandlerFunc ¶
type HandlerFunc func(c Context)
type Option ¶
type Option = func(opts *options)
func WithEncodingAESKey ¶
WithEncodingAESKey set EncodingAESKey
func WithEventHandler ¶
func WithEventHandler(evt string, h HandlerFunc) Option
WithEventHandler set message handler
func WithMessageHandler ¶
func WithMessageHandler(typ string, h HandlerFunc) Option
WithMessageHandler set message handler
type Request ¶
type Request struct { XMLName xml.Name `xml:"xml"` ToUserName string `xml:"ToUserName"` FromUserName string `xml:"FromUserName"` CreateTime int64 `xml:"CreateTime"` MsgID int64 `xml:"MsgId"` MsgType string `xml:"MsgType"` MsgDataID string `xml:"MsgDataId"` Idx int64 `xml:"Idx"` // text Content string `xml:"Content"` // image PicURL string `xml:"PicUrl"` MediaID string `xml:"MediaId"` // voice //MediaID string `xml:"MediaId"` Format string `xml:"Format"` Recognition string `xml:"Recognition"` // video //MediaID string `xml:"MediaId"` ThumbMediaID string `xml:"ThumbMediaId"` // location LocationX float64 `xml:"Location_X"` LocationY float64 `xml:"Location_Y"` Scale int `xml:"Scale"` Label string `xml:"Label"` // link Title string `xml:"Title"` Description string `xml:"Description"` URL string `xml:"Url"` // Event Event string `xml:"Event"` EventKey string `xml:"EventKey"` Ticket string `xml:"Ticket"` Latitude float64 `xml:"Latitude"` Longitude float64 `xml:"Longitude"` Precision float64 `xml:"Precision"` }
Click to show internal directories.
Click to hide internal directories.