Beispiel #1
0
// NewAPI 方法用于创建基于该套件的 API 实例
func (s *Suite) NewAPI(corpID, permanentCode string) *API {
	baseAPI := api.New(corpID, "", s.token, s.encodingAESKey)

	suiteAPI := &API{
		baseAPI,
		permanentCode,
		s,
	}

	suiteAPI.Client = base.NewClient(suiteAPI)
	suiteAPI.Tokener = base.NewTokener(suiteAPI)

	return suiteAPI
}
Beispiel #2
0
// New 方法创建 API 实例
func New(corpID, corpSecret, token, encodingAESKey string) *API {
	msgCrypter, _ := crypter.NewMessageCrypter(token, encodingAESKey, corpID)

	api := &API{
		corpSecret: corpSecret,
		CorpID:     corpID,
		MsgCrypter: msgCrypter,
	}

	api.Client = base.NewClient(api)
	api.Tokener = base.NewTokener(api)

	return api
}
Beispiel #3
0
// New 方法用于创建 Suite 实例
func New(suiteID, suiteSecret, suiteToken, suiteEncodingAESKey string) *Suite {
	msgCrypter, _ := crypter.NewMessageCrypter(suiteToken, suiteEncodingAESKey, suiteID)

	suite := &Suite{
		id:             suiteID,
		secret:         suiteSecret,
		token:          suiteToken,
		encodingAESKey: suiteEncodingAESKey,
		msgCrypter:     msgCrypter,
	}

	suite.client = base.NewClient(suite)
	suite.tokener = base.NewTokener(suite)

	return suite
}