tokens

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 26, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (

	//CacheKeyQywxPrefix 企业微信cache key前缀
	CacheKeyQywxPrefix = "qywx_"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessToken

type AccessToken struct {
	AccessToken string
	ExpiresIn   int64
}

AccessToken 企业微信access token

type AccessTokenReq

type AccessTokenReq struct {
	CorpID  string `json:"corpid"`
	AgentID string `json:"agentid"` // 如果agentid不存在,使用commons中的常量
	Secret  string `json:"corpsecret"`
}

AccessTokenReq 获取access token的请求

type AccessTokenResp

type AccessTokenResp struct {
	commons.CommonError

	AccessToken string `json:"access_token"`
	ExpiresIn   int64  `json:"expires_in"`
}

AccessTokenResp access token的响应

type AccessTokenStore

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

AccessTokenStore accessToken仓库,管理accessToken

func NewAccessTokenStore

func NewAccessTokenStore(caches caches.Caches) *AccessTokenStore

NewAccessTokenStore 创建一个新的accesstoken仓库

func (*AccessTokenStore) GetToken

func (store *AccessTokenStore) GetToken(agentID string, req AccessTokenReq) (string, error)

GetToken 获取token,根据appID 获取token,这里将设置和获取合并到一起,方便上层调用。

Jump to

Keyboard shortcuts

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