Documentation ¶
Index ¶
- Constants
- type Client
- func (c *Client) AccessToken() *wechatAccessToken
- func (c *Client) CreateWXAQrcode(ctx context.Context, path string) ([]byte, error)
- func (c *Client) GetAccessToken(ctx context.Context) (*wechatAccessToken, error)
- func (c *Client) GetWXACodeUnlimit(ctx context.Context, page, scene string) ([]byte, error)
- func (c *Client) JsCodeToSession(ctx context.Context, code string) (*WechatSession, error)
- func (c *Client) MustNewRequest(ctx context.Context, method, url string, reqBody interface{}) *Request
- func (c *Client) NewRequest(ctx context.Context, method, url string, reqBody interface{}) (*Request, error)
- type ReqBodyAnalysisGetDailyVisitTrend
- type ReqBodyAnalysisGetMonthlyVisitTrend
- type ReqBodyAnalysisGetUserPortrait
- type ReqBodyAnalysisGetVisitDistribution
- type ReqBodyAnalysisGetVisitPage
- type ReqBodyAnalysisGetWeeklyVisitTrend
- type ReqBodyCreateWXAQrcode
- type ReqBodyGetWXACodeUnlimit
- type Request
- type WechatError
- type WechatSession
- type WechatUserInfo
Constants ¶
const ( UrlApi = "https://api.weixin.qq.com" UrlAnalysisGetDailyVisitTrend = UrlApi + "/datacube/getweanalysisappiddailyvisittrend?access_token={ACCESS_TOKEN}" UrlAnalysisGetWeeklyVisitTrend = UrlApi + "/datacube/getweanalysisappidweeklyvisittrend?access_token={ACCESS_TOKEN}" UrlAnalysisGetMonthlyVisitTrend = UrlApi + "/datacube/getweanalysisappidmonthlyvisittrend?access_token={ACCESS_TOKEN}" UrlAnalysisGetUserPortrait = UrlApi + "/datacube/getweanalysisappiduserportrait?access_token={ACCESS_TOKEN}" UrlAnalysisGetVisitDistribution = UrlApi + "/datacube/getweanalysisappidvisitdistribution?access_token={ACCESS_TOKEN}" UrlAnalysisGetVisitPage = UrlApi + "/datacube/getweanalysisappidvisitpage?access_token={ACCESS_TOKEN}" UrlCreateWXAQrcode = UrlApi + "/cgi-bin/wxaapp/createwxaqrcode?access_token={ACCESS_TOKEN}" UrlGetWXACodeUnlimit = UrlApi + "/wxa/getwxacodeunlimit?access_token={ACCESS_TOKEN}" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { AppId string AppSecret string Debug bool // contains filtered or unexported fields }
func (*Client) AccessToken ¶ added in v1.2.0
func (c *Client) AccessToken() *wechatAccessToken
AccessToken returns current access token.
func (*Client) CreateWXAQrcode ¶ added in v1.1.0
CreateWXAQrcode generates new Wechat mini program QR code (given path) and returns the JPEG image. Please note that Wechat allows total of only 100,000 QR codes created by this API for every account. https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/qr-code/wxacode.createQRCode.html
func (*Client) GetAccessToken ¶ added in v1.1.0
GetAccessToken gets access token and caches it to client.AccessToken.
func (*Client) GetWXACodeUnlimit ¶
GetWXACodeUnlimit generates new Wechat mini program QR code (given page and scene) and returns the PNG image. If page is empty, index page will be used. https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/qr-code/wxacode.getUnlimited.html
func (*Client) JsCodeToSession ¶
JsCodeToSession gets user's OpenId, UnionId and session key by the code from wx.login().
func (*Client) MustNewRequest ¶ added in v1.2.0
func (c *Client) MustNewRequest(ctx context.Context, method, url string, reqBody interface{}) *Request
MustNewRequest is like NewRequest but panics if operation fails.
func (*Client) NewRequest ¶ added in v1.2.0
func (c *Client) NewRequest(ctx context.Context, method, url string, reqBody interface{}) (*Request, error)
NewRequest create a new request given context, method, url and request body. {ACCESS_TOKEN} in the URL will be replaced with the current access token. Request body can be io.Reader or data structures that can be JSON-marshaled.
type ReqBodyAnalysisGetDailyVisitTrend ¶ added in v1.2.0
type ReqBodyAnalysisGetMonthlyVisitTrend ¶ added in v1.2.2
type ReqBodyAnalysisGetMonthlyVisitTrend = ReqBodyAnalysisGetDailyVisitTrend
type ReqBodyAnalysisGetUserPortrait ¶ added in v1.2.3
type ReqBodyAnalysisGetUserPortrait = ReqBodyAnalysisGetDailyVisitTrend
type ReqBodyAnalysisGetVisitDistribution ¶ added in v1.2.3
type ReqBodyAnalysisGetVisitDistribution = ReqBodyAnalysisGetDailyVisitTrend
type ReqBodyAnalysisGetVisitPage ¶ added in v1.2.3
type ReqBodyAnalysisGetVisitPage = ReqBodyAnalysisGetDailyVisitTrend
type ReqBodyAnalysisGetWeeklyVisitTrend ¶ added in v1.2.2
type ReqBodyAnalysisGetWeeklyVisitTrend = ReqBodyAnalysisGetDailyVisitTrend
type ReqBodyCreateWXAQrcode ¶ added in v1.2.0
type ReqBodyGetWXACodeUnlimit ¶ added in v1.2.0
type Request ¶ added in v1.2.0
type WechatError ¶
func (WechatError) Error ¶
func (e WechatError) Error() string
type WechatSession ¶ added in v1.2.0
type WechatUserInfo ¶ added in v1.2.0
type WechatUserInfo struct { PhoneNumber string `json:"phoneNumber"` PurePhoneNumber string `json:"purePhoneNumber"` CountryCode string `json:"countryCode"` }
func Decrypt ¶
func Decrypt(sessionKey, encryptedData, iv string) (*WechatUserInfo, error)
Decrypt decrypts encrypted data given session key and IV.