corp

package
v0.0.0-...-4a54426 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 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, options ...Option) *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) 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 Option

type Option func(corp *Corp)

Option 企微配置项

func WithClient

func WithClient(c *http.Client) Option

WithClient 设置 HTTP Client

func WithMockClient

func WithMockClient(c wx.HTTPClient) Option

WithMockClient 设置 Mock Client

func WithNonce

func WithNonce(f func() string) Option

WithNonce 设置 Nonce(加密随机串)

func WithServerConfig

func WithServerConfig(token, aeskey string) Option

WithServerConfig 设置服务器配置 [参考](https://open.work.weixin.qq.com/api/doc/90000/90135/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