Documentation
¶
Overview ¶
Package context 开放平台相关context
Index ¶
- type AuthBaseInfo
- type AuthFuncInfo
- type AuthorizerBasicConfig
- type AuthorizerInfo
- type AuthrAccessToken
- type CategoriesInfo
- type ComponentAccessToken
- type Context
- func (ctx *Context) GetAuthrAccessToken(appid string) (string, error)
- func (ctx *Context) GetAuthrAccessTokenContext(stdCtx context.Context, appid string) (string, error)
- func (ctx *Context) GetAuthrInfo(appid string) (*AuthorizerInfo, *AuthBaseInfo, error)
- func (ctx *Context) GetAuthrInfoContext(stdCtx context.Context, appid string) (*AuthorizerInfo, *AuthBaseInfo, error)
- func (ctx *Context) GetBindComponentURL(redirectURI string, authType int, bizAppID string) (string, error)
- func (ctx *Context) GetBindComponentURLContext(stdCtx context.Context, redirectURI string, authType int, bizAppID string) (string, error)
- func (ctx *Context) GetBindComponentURLV2(redirectURI string, authType int, bizAppID string) (string, error)
- func (ctx *Context) GetBindComponentURLV2Context(stdCtx context.Context, redirectURI string, authType int, bizAppID string) (string, error)
- func (ctx *Context) GetComponentAccessToken() (string, error)
- func (ctx *Context) GetComponentAccessTokenContext(stdCtx context.Context) (string, error)
- func (ctx *Context) GetComponentLoginPage(redirectURI string, authType int, bizAppID string) (string, error)
- func (ctx *Context) GetComponentLoginPageContext(stdCtx context.Context, redirectURI string, authType int, bizAppID string) (string, error)
- func (ctx *Context) GetPreCode() (string, error)
- func (ctx *Context) GetPreCodeContext(stdCtx context.Context) (string, error)
- func (ctx *Context) QueryAuthCode(authCode string) (*AuthBaseInfo, error)
- func (ctx *Context) QueryAuthCodeContext(stdCtx context.Context, authCode string) (*AuthBaseInfo, error)
- func (ctx *Context) RefreshAuthrToken(appid, refreshToken string) (*AuthrAccessToken, error)
- func (ctx *Context) RefreshAuthrTokenContext(stdCtx context.Context, appid, refreshToken string) (*AuthrAccessToken, error)
- func (ctx *Context) SetComponentAccessToken(stdCtx context.Context, verifyTicket string) (*ComponentAccessToken, error)
- func (ctx *Context) SetComponentAccessTokenContext(stdCtx context.Context, verifyTicket string) (*ComponentAccessToken, error)
- type ID
- type MiniProgramInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthBaseInfo ¶
type AuthBaseInfo struct {
AuthrAccessToken
FuncInfo []AuthFuncInfo `json:"func_info"`
}
AuthBaseInfo 授权的基本信息
type AuthFuncInfo ¶
type AuthFuncInfo struct {
FuncscopeCategory ID `json:"funcscope_category"`
}
AuthFuncInfo 授权的接口内容
type AuthorizerBasicConfig ¶ added in v2.1.4
type AuthorizerBasicConfig struct {
IsPhoneConfigured bool `json:"isPhoneConfigured"`
IsEmailConfigured bool `json:"isEmailConfigured"`
}
AuthorizerBasicConfig 授权账号的基础配置结构体
type AuthorizerInfo ¶
type AuthorizerInfo struct {
NickName string `json:"nick_name"`
HeadImg string `json:"head_img"`
ServiceTypeInfo ID `json:"service_type_info"`
VerifyTypeInfo ID `json:"verify_type_info"`
UserName string `json:"user_name"`
PrincipalName string `json:"principal_name"`
BusinessInfo struct {
OpenStore string `json:"open_store"`
OpenScan string `json:"open_scan"`
OpenPay string `json:"open_pay"`
OpenCard string `json:"open_card"`
OpenShake string `json:"open_shake"`
}
Alias string `json:"alias"`
QrcodeURL string `json:"qrcode_url"`
MiniProgramInfo *MiniProgramInfo `json:"MiniProgramInfo"`
RegisterType int `json:"register_type"`
AccountStatus int `json:"account_status"`
BasicConfig *AuthorizerBasicConfig `json:"basic_config"`
}
AuthorizerInfo 授权方详细信息
type AuthrAccessToken ¶
type AuthrAccessToken struct {
Appid string `json:"authorizer_appid"`
AccessToken string `json:"authorizer_access_token"`
ExpiresIn int64 `json:"expires_in"`
RefreshToken string `json:"authorizer_refresh_token"`
}
AuthrAccessToken 授权方AccessToken
type CategoriesInfo ¶ added in v2.1.4
CategoriesInfo 授权账号小程序配置的类目信息
type ComponentAccessToken ¶
type ComponentAccessToken struct {
util.CommonError
AccessToken string `json:"component_access_token"`
ExpiresIn int64 `json:"expires_in"`
}
ComponentAccessToken 第三方平台
type Context ¶
Context struct
func (*Context) GetAuthrAccessToken ¶
GetAuthrAccessToken 获取授权方AccessToken
func (*Context) GetAuthrAccessTokenContext ¶ added in v2.1.5
func (ctx *Context) GetAuthrAccessTokenContext(stdCtx context.Context, appid string) (string, error)
GetAuthrAccessTokenContext 获取授权方AccessToken
func (*Context) GetAuthrInfo ¶
func (ctx *Context) GetAuthrInfo(appid string) (*AuthorizerInfo, *AuthBaseInfo, error)
GetAuthrInfo 获取授权方的帐号基本信息
func (*Context) GetAuthrInfoContext ¶ added in v2.1.5
func (ctx *Context) GetAuthrInfoContext(stdCtx context.Context, appid string) (*AuthorizerInfo, *AuthBaseInfo, error)
GetAuthrInfoContext 获取授权方的帐号基本信息
func (*Context) GetBindComponentURL ¶ added in v2.0.2
func (ctx *Context) GetBindComponentURL(redirectURI string, authType int, bizAppID string) (string, error)
GetBindComponentURL 获取第三方公众号授权链接(链接跳转,适用移动端)
func (*Context) GetBindComponentURLContext ¶ added in v2.1.5
func (ctx *Context) GetBindComponentURLContext(stdCtx context.Context, redirectURI string, authType int, bizAppID string) (string, error)
GetBindComponentURLContext 获取第三方公众号授权链接(链接跳转,适用移动端)
func (*Context) GetBindComponentURLV2 ¶ added in v2.1.9
func (ctx *Context) GetBindComponentURLV2(redirectURI string, authType int, bizAppID string) (string, error)
GetBindComponentURLV2 获取新版本第三方公众号授权链接(链接跳转,适用移动端)
func (*Context) GetBindComponentURLV2Context ¶ added in v2.1.9
func (ctx *Context) GetBindComponentURLV2Context(stdCtx context.Context, redirectURI string, authType int, bizAppID string) (string, error)
GetBindComponentURLV2Context 获取新版本第三方公众号授权链接(链接跳转,适用移动端)
func (*Context) GetComponentAccessToken ¶
GetComponentAccessToken 获取 ComponentAccessToken
func (*Context) GetComponentAccessTokenContext ¶ added in v2.1.5
GetComponentAccessTokenContext 获取 ComponentAccessToken
func (*Context) GetComponentLoginPage ¶ added in v2.0.2
func (ctx *Context) GetComponentLoginPage(redirectURI string, authType int, bizAppID string) (string, error)
GetComponentLoginPage 获取第三方公众号授权链接(扫码授权)
func (*Context) GetComponentLoginPageContext ¶ added in v2.1.5
func (ctx *Context) GetComponentLoginPageContext(stdCtx context.Context, redirectURI string, authType int, bizAppID string) (string, error)
GetComponentLoginPageContext 获取第三方公众号授权链接(扫码授权)
func (*Context) GetPreCodeContext ¶ added in v2.1.5
GetPreCodeContext 获取预授权码
func (*Context) QueryAuthCode ¶
func (ctx *Context) QueryAuthCode(authCode string) (*AuthBaseInfo, error)
QueryAuthCode 使用授权码换取公众号或小程序的接口调用凭据和授权信息
func (*Context) QueryAuthCodeContext ¶ added in v2.1.5
func (ctx *Context) QueryAuthCodeContext(stdCtx context.Context, authCode string) (*AuthBaseInfo, error)
QueryAuthCodeContext 使用授权码换取公众号或小程序的接口调用凭据和授权信息
func (*Context) RefreshAuthrToken ¶
func (ctx *Context) RefreshAuthrToken(appid, refreshToken string) (*AuthrAccessToken, error)
RefreshAuthrToken 获取(刷新)授权公众号或小程序的接口调用凭据(令牌)
func (*Context) RefreshAuthrTokenContext ¶ added in v2.1.5
func (ctx *Context) RefreshAuthrTokenContext(stdCtx context.Context, appid, refreshToken string) (*AuthrAccessToken, error)
RefreshAuthrTokenContext 获取(刷新)授权公众号或小程序的接口调用凭据(令牌)
func (*Context) SetComponentAccessToken ¶
func (ctx *Context) SetComponentAccessToken(stdCtx context.Context, verifyTicket string) (*ComponentAccessToken, error)
SetComponentAccessToken 通过component_verify_ticket 获取 ComponentAccessToken
func (*Context) SetComponentAccessTokenContext ¶ added in v2.1.5
func (ctx *Context) SetComponentAccessTokenContext(stdCtx context.Context, verifyTicket string) (*ComponentAccessToken, error)
SetComponentAccessTokenContext 通过component_verify_ticket 获取 ComponentAccessToken
type MiniProgramInfo ¶ added in v2.1.4
type MiniProgramInfo struct {
Network struct {
RequestDomain []string `json:"RequestDomain"`
WsRequestDomain []string `json:"WsRequestDomain"`
UploadDomain []string `json:"UploadDomain"`
DownloadDomain []string `json:"DownloadDomain"`
BizDomain []string `json:"BizDomain"`
UDPDomain []string `json:"UDPDomain"`
} `json:"network"`
Categories []CategoriesInfo `json:"categories"`
}
MiniProgramInfo 授权账号小程序配置 授权账号为小程序时存在