corp

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAPIDomainIP

func GetAPIDomainIP(result *ResultIP) wx.Action

func GetCallbackIP

func GetCallbackIP(result *ResultIP) wx.Action

func GetOAuthUser

func GetOAuthUser(code string, result *ResultOAuthUser) wx.Action

GetOAuthUser 获取访问用户身份

func UserAuthSucc

func UserAuthSucc(userID string) wx.Action

UserAuthSucc 二次验证

Types

type AccessToken

type AccessToken struct {
	Token     string `json:"access_token"`
	ExpiresIn int64  `json:"expires_in"`
}

AccessToken 企业微信AccessToken

type AuthScope

type AuthScope string

AuthScope 应用授权作用域

const (
	ScopeSnsapiBase AuthScope = "snsapi_base" // 企业自建应用固定填写:snsapi_base
)

企业微信支持的应用授权作用域

type Corp

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

func New

func New(corpid string) *Corp

func (*Corp) AccessToken

func (corp *Corp) AccessToken(ctx context.Context, secret string, options ...wx.HTTPOption) (*AccessToken, error)

func (*Corp) CorpID

func (corp *Corp) CorpID() string

func (*Corp) DecryptEventMessage

func (corp *Corp) DecryptEventMessage(encrypt string) (wx.WXML, error)

DecryptEventMessage 事件消息解密

func (*Corp) Do

func (corp *Corp) Do(ctx context.Context, accessToken string, action wx.Action, options ...wx.HTTPOption) error

Do exec action

func (*Corp) OAuth2URL

func (corp *Corp) OAuth2URL(scope AuthScope, redirectURL, state string) string

OAuth2URL 生成网页授权URL(请使用 URLEncode 对 redirectURL 进行处理) [参考](https://open.work.weixin.qq.com/api/doc/90000/90135/91020)

func (*Corp) QRCodeAuthURL

func (corp *Corp) QRCodeAuthURL(agentID, redirectURL, state string) string

QRCodeAuthURL 生成扫码授权URL(请使用 URLEncode 对 redirectURL 进行处理) [参考](https://open.work.weixin.qq.com/api/doc/90000/90135/90988)

func (*Corp) SetClient

func (corp *Corp) SetClient(options ...wx.ClientOption)

SetClient sets options for wechat client

func (*Corp) SetServerConfig

func (corp *Corp) SetServerConfig(token, encodingAESKey string)

SetServerConfig 设置服务器配置 [参考](https://open.work.weixin.qq.com/api/doc/90000/90135/90930)

func (*Corp) VerifyEventSign

func (corp *Corp) VerifyEventSign(signature string, items ...string) bool

VerifyEventSign 验证事件消息签名 验证消息来自微信服务器,使用:msg_signature、timestamp、nonce、echostr(若验证成功,解密echostr后返回msg字段内容) 验证事件消息签名,使用:msg_signature、timestamp、nonce、msg_encrypt [参考](https://developer.work.weixin.qq.com/document/path/90930)

type ResultIP

type ResultIP struct {
	IPList []string `json:"ip_list"`
}

type ResultOAuthUser

type ResultOAuthUser struct {
	UserID         string `json:"UserId"`
	OpenID         string `json:"OpenId"`
	DeviceID       string `json:"DeviceId"`
	ExternalUserID string `json:"external_userid"`
}

Jump to

Keyboard shortcuts

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