suite

package
v0.0.0-...-fb94b6f Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2015 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	*api.API
	// contains filtered or unexported fields
}

API 封装基于套件的接口调用

func (*API) FetchToken

func (a *API) FetchToken() (token string, expiresIn int64, err error)

FetchToken 方法用于向 API 服务器获取授权该套件的企业号的令牌信息

type Agent

type Agent struct {
	ID                   int64  `json:"agentid"`
	Name                 string `json:"name,omitempty"`
	RoundLogoURI         string `json:"round_logo_url,omitempty"`
	SquareLogoURI        string `json:"square_logo_url,omitempty"`
	Description          string `json:"description,omitempty"`
	RedirectDomain       string `json:"redirect_domain,omitempty"`
	RedirectLocationFlag int64  `json:"report_location_flag,omitempty"`
	IsReportUser         int64  `json:"isreportuser,omitempty"`
	IsReportEnter        int64  `json:"isreportenter,omitempty"`
}

Agent 用于表示应用基本信息

type AgentEditInfo

type AgentEditInfo struct {
	Agent
	LogoMediaID string `json:"logo_mediaid,omitempty"`
}

AgentEditInfo 代表设置授权方企业号某个应用时的应用信息

type AuthInfo

type AuthInfo struct {
	Agent      []*authorizedAgent      `json:"agent"`
	Department []*authorizedDepartment `json:"department"`
}

AuthInfo 表示授权基本信息

type CorpAgent

type CorpAgent struct {
	Agent
	AllowUsers  *allowUsers  `json:"allow_userinfos"`
	AllowPartys *allowPartys `json:"allow_partys"`
	AllowTags   *allowTags   `json:"allow_tags"`
	Close       int64        `json:"close"`
}

CorpAgent 用于表示授权方企业号某个应用的基本信息

type CorpAuthInfo

type CorpAuthInfo struct {
	AuthCorpInfo *Corporation `json:"auth_corp_info"`
	AuthInfo     *AuthInfo    `json:"auth_info"`
	AuthUserInfo *operator    `json:"auth_user_info"`
}

CorpAuthInfo 代表企业号的授权信息

type Corporation

type Corporation struct {
	ID            string `json:"corpid"`
	Name          string `json:"corp_name"`
	Type          string `json:"corp_type"`
	RoundLogoURI  string `json:"corp_round_logo_url"`
	SquareLogoURI string `json:"corp_square_logo_url"`
	UserMax       int    `json:"corp_user_max"`
	AgentMax      int    `json:"corp_agent_max"`
	QRCode        string `json:"corp_wxqrcode"`
}

Corporation 用于表示授权方企业信息

type PermanentCodeInfo

type PermanentCodeInfo struct {
	AccessToken   string       `json:"access_token"`
	ExpiresIn     int64        `json:"expires_in"`
	PermanentCode string       `json:"permanent_code"`
	AuthCorpInfo  *Corporation `json:"auth_corp_info"`
	AuthInfo      *AuthInfo    `json:"auth_info"`
}

PermanentCodeInfo 代表获取企业号永久授权码时的响应信息

type RecvSuiteAuth

type RecvSuiteAuth struct {
	SuiteId    string
	InfoType   string
	TimeStamp  float64
	AuthCorpId string
}

RecvSuiteAuth 用于记录应用套件授权变更和授权撤销的被动响应结果

type RecvSuiteTicket

type RecvSuiteTicket struct {
	SuiteId     string
	InfoType    string
	TimeStamp   float64
	SuiteTicket string
}

RecvSuiteTicket 用于记录应用套件 ticket 的被动响应结果

type Suite

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

Suite 结构体包含了应用套件的相关操作

func New

func New(suiteID, suiteSecret, suiteToken, suiteEncodingAESKey string) *Suite

New 方法用于创建 Suite 实例

func (*Suite) FetchToken

func (s *Suite) FetchToken() (token string, expiresIn int64, err error)

FetchToken 方法用于向 API 服务器获取套件的令牌信息

func (*Suite) GetAuthURI

func (s *Suite) GetAuthURI(appIDs []int, redirectURI, state string) (string, error)

GetAuthURI 方法用于获取应用套件的授权地址

func (*Suite) GetCorpAuthInfo

func (s *Suite) GetCorpAuthInfo(corpID, permanentCode string) (CorpAuthInfo, error)

GetCorpAuthInfo 方法用于获取已授权当前套件的企业号的授权信息

func (*Suite) GetCropAgent

func (s *Suite) GetCropAgent(corpID, permanentCode, agentID string) (CorpAgent, error)

GetCropAgent 方法用于获取已授权当前套件的企业号的某个应用信息

func (*Suite) GetPermanentCode

func (s *Suite) GetPermanentCode(authCode string) (PermanentCodeInfo, error)

GetPermanentCode 方法用于获取企业的永久授权码

func (*Suite) NewAPI

func (s *Suite) NewAPI(corpID, permanentCode string) *API

NewAPI 方法用于创建基于该套件的 API 实例

func (*Suite) Parse

func (s *Suite) Parse(body []byte, signature, timestamp, nonce string) (interface{}, error)

Parse 方法用于解析应用套件的消息回调

func (*Suite) Response

func (s *Suite) Response(message []byte) ([]byte, error)

Response 方法用于生成应用套件的被动响应消息

func (*Suite) Retriable

func (s *Suite) Retriable(reqURL string, body []byte) (bool, string, error)

Retriable 方法实现了套件在发起请求遇到 token 错误时,先刷新 token 然后再次发起请求的逻辑

func (*Suite) SetTicket

func (s *Suite) SetTicket(suiteTicket string)

SetTicket 方法用于设置套件的 ticket 信息

func (*Suite) UpdateCorpAgent

func (s *Suite) UpdateCorpAgent(corpID, permanentCode string, agent AgentEditInfo) error

UpdateCorpAgent 方法用于设置已授权当前套件的企业号的某个应用信息

Jump to

Keyboard shortcuts

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