component

package
v0.0.0-...-c04114d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 1, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

微信错误返回

regular tasks api these api will be run on time

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UrlEncoded

func UrlEncoded(str string) (string, error)

Types

type ApiError

type ApiError struct {
	ErrCode int64  `json:"errcode"`
	ErrMsg  string `json:"errmsg"`
}

func (*ApiError) Error

func (a *ApiError) Error() string

type NormalApi

type NormalApi interface {
	GetPublicInfo(accessToken, authCode string) (*PublicInfo, error)
	GetAuthAccessToken(accessToken, appId, refreshToken string) (*PublicToken, error)
	GetAuthProfile(accessToken, appId string) (*PublicProfile, error)
	GetAuthOption(accessToken, appId, option string) (*PublicOption, error)
	SetAuthOption(accessToken, appId, optionName, optionValue string) error
}

type PublicInfo

type PublicInfo struct {
	AuthorizationInfo struct {
		AppId        string  `json:"authorizer_appid"`
		AccessToken  string  `json:"authorizer_access_token"`
		ExpiresIn    float64 `json:"expires_in"`
		RefreshToken string  `json:"authorizer_refresh_token"`
		FuncInfo     []struct {
			Funcscope struct {
				Id int64 `json:"id"`
			} `json:"funcscope_category"`
		} `json:"func_info"`
	} `json:"authorization_info"`
}

type PublicOption

type PublicOption struct {
	AppId       string `json:"authorizer_appid"`
	OptionName  string `json:"option_name"`
	OptionValue string `json:"option_value"`
}

type PublicProfile

type PublicProfile struct {
	AuthorizerInfo struct {
		NickName        string `json:"nick_name"`
		HeadImg         string `json:"head_img"`
		ServiceTypeInfo struct {
			Id int64 `json:"id"`
		}
		VerifyTypeInfo struct {
			Id int64 `json:"id"`
		}
		UserName string `json:"user_name"`
		Alias    string `json:"alias"`
	} `json:"authorizer_info"`
	QR                string `json:"qrcode_url"`
	AuthorizationInfo struct {
		AppId    string `json:"appid"`
		FuncInfo []struct {
			Funcscope struct {
				Id int64 `json:"id"`
			} `json:"funcscope_category"`
		} `json:"func_info"`
	} `json:"authorization_info"`
}

type PublicToken

type PublicToken struct {
	AccessToken  string  `json:"authorizer_access_token"`
	ExpiresIn    float64 `json:"expires_in"`
	RefreshToken string  `json:"authorizer_refresh_token"`
}

authorizer access token and refresh token

type RegularApi

type RegularApi interface {
	GetAccessToken(ticket string) (string, float64)
	GetPreAuthCode(accessToken string) (string, float64)
}

type WechatComponent

type WechatComponent interface {
	GetRegularApi() RegularApi
	GetNormalApi() NormalApi
	OAuthUrl(redirectUrl, preAuthCode string) string
	GetCipher() (lib.IOCipher, error)
}

微信第三方平台interface

func New

func New(appId, appSecret, cryptoKey, token string) WechatComponent

type WechatThird

type WechatThird struct {
	// contains filtered or unexported fields
}

微信第三方公众号平台 实现 ServeHTTP interface

func (*WechatThird) GetCipher

func (wt *WechatThird) GetCipher() (lib.IOCipher, error)

func (*WechatThird) GetNormalApi

func (wt *WechatThird) GetNormalApi() NormalApi

func (*WechatThird) GetRegularApi

func (wt *WechatThird) GetRegularApi() RegularApi

func (*WechatThird) OAuthUrl

func (wt *WechatThird) OAuthUrl(redirectUrl, preAuthCode string) string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL