Documentation ¶
Index ¶
- Constants
- Variables
- func GetWeChatClient(appId string) *http.Client
- type AdapterThirdParty
- type WeChatClient
- func (m *WeChatClient) Close()
- func (m *WeChatClient) GetAccessToken() (string, int, error)
- func (m *WeChatClient) GetClient() interface{}
- func (m *WeChatClient) GetConnectUrl(state, scope string, popUp bool, redirectPath string) (string, error)
- func (m *WeChatClient) GetJSApiTicket(accessToken string) (string, int, error)
- func (m *WeChatClient) GetSubscribeUserInfo(accessToken, openId string) (string, error)
- func (m *WeChatClient) GetUserAccessToken(code, scope string) (string, error)
- func (m *WeChatClient) GetUserInfo(userAccessToken, openId string) (string, error)
- func (m *WeChatClient) RefreshUserToken(refreshToken string, appId string) (string, error)
- func (m *WeChatClient) SendTemplateMessage(accessToken, openId, templateId, redirectUrl string, data []byte, ...) (string, error)
- func (m *WeChatClient) String() string
Constants ¶
View Source
const ( WECHAT_ACCESS_TOKEN_KEY = "WECHAT_ACCESS_TOKEN:%s" WECHAT_JSAPI_TICKET_KEY = "WECHAT_JSAPI_TICKET:%s" WECHAT_STATE_KEY = "WECHAT_STATE:%v" WECHAT_PLATFORM_KEY = "WECHAT_PLATFORM:%v" WECHAT_REDIRECT_KEY = "WECHAT_REDIRECT:%v" WECHAT_REDIRECT_EXP_KEY = "WECHAT_REDIRECT_EXP:%v" WECHAT_USER_ACCESS_TOKEN_KEY = "WECHAT_USER_ACCESS_TOKEN:%v" )
Variables ¶
View Source
var ( WeChatQRLogin = "snsapi_login" WeChatUserInfo = "snsapi_userinfo" WeChatBase = "snsapi_base" )
View Source
var ( WeChatAccessTokenAddr = "https://api.weixin.qq.com/cgi-bin/token" WeChatJSApiTicketAddr = "https://api.weixin.qq.com/cgi-bin/ticket/getticket" WeChatQRConnectAddr = "https://open.weixin.qq.com/connect/qrconnect" WeChatAppConnectAddr = "https://open.weixin.qq.com/connect/oauth2/authorize" WeChatUserAccessTokenAddr = "https://api.weixin.qq.com/sns/oauth2/access_token" WeChatRefreshUserTokenAddr = "https://api.weixin.qq.com/sns/oauth2/refresh_token" WeChatUserInfoAddr = "https://api.weixin.qq.com/sns/userinfo" WeChatSubscribeUserInfoAddr = "https://api.weixin.qq.com/cgi-bin/user/info" WeChatTemplateMessageAddr = "https://api.weixin.qq.com/cgi-bin/message/template/send" )
Functions ¶
func GetWeChatClient ¶ added in v1.4.12
Types ¶
type AdapterThirdParty ¶
type AdapterThirdParty interface { String() string GetConnectUrl(state, scope string, popUp bool, redirectPath string) (string, error) GetAccessToken() (string, int, error) GetJSApiTicket(accessToken string) (string, int, error) GetUserAccessToken(code, state string) (string, error) RefreshUserToken(refreshToken string, appId string) (string, error) GetUserInfo(userAccessToken, openId string) (string, error) GetSubscribeUserInfo(userAccessToken, openId string) (string, error) SendTemplateMessage(accessToken, openId, templateId, url string, data []byte, rootData []byte) (string, error) GetClient() interface{} }
type WeChatClient ¶ added in v1.4.12
type WeChatClient struct {
// contains filtered or unexported fields
}
func NewWeChatClient ¶ added in v1.4.12
func NewWeChatClient(client *http.Client, appId, appSecret, callbackAddr, appType string) *WeChatClient
func (*WeChatClient) GetAccessToken ¶ added in v1.4.12
func (m *WeChatClient) GetAccessToken() (string, int, error)
func (*WeChatClient) GetClient ¶ added in v1.4.12
func (m *WeChatClient) GetClient() interface{}
GetClient 暴露原生client
func (*WeChatClient) GetConnectUrl ¶ added in v1.4.12
func (*WeChatClient) GetJSApiTicket ¶ added in v1.4.12
func (m *WeChatClient) GetJSApiTicket(accessToken string) (string, int, error)
func (*WeChatClient) GetSubscribeUserInfo ¶ added in v1.4.20
func (m *WeChatClient) GetSubscribeUserInfo(accessToken, openId string) (string, error)
func (*WeChatClient) GetUserAccessToken ¶ added in v1.4.12
func (m *WeChatClient) GetUserAccessToken(code, scope string) (string, error)
func (*WeChatClient) GetUserInfo ¶ added in v1.4.12
func (m *WeChatClient) GetUserInfo(userAccessToken, openId string) (string, error)
func (*WeChatClient) RefreshUserToken ¶ added in v1.4.12
func (m *WeChatClient) RefreshUserToken(refreshToken string, appId string) (string, error)
func (*WeChatClient) SendTemplateMessage ¶ added in v1.4.12
func (*WeChatClient) String ¶ added in v1.4.12
func (m *WeChatClient) String() string
Click to show internal directories.
Click to hide internal directories.