generated from pkg/go-template
29 lines
834 B
Go
29 lines
834 B
Go
package lark
|
|
|
|
import (
|
|
cfg "git.icechen.cn/monorepo/backend/app/zeus/service/lark/internal/config"
|
|
"github.com/larksuite/oapi-sdk-go/core"
|
|
"github.com/larksuite/oapi-sdk-go/core/config"
|
|
authen "github.com/larksuite/oapi-sdk-go/service/authen/v1"
|
|
im "github.com/larksuite/oapi-sdk-go/service/im/v1"
|
|
)
|
|
|
|
type Lark struct {
|
|
conf *config.Config
|
|
userService *authen.Service
|
|
imService *im.Service
|
|
}
|
|
|
|
var lark Lark
|
|
|
|
func Client() Lark {
|
|
if lark.conf == nil || lark.userService == nil {
|
|
appSettings := core.NewInternalAppSettings(
|
|
core.SetAppCredentials(cfg.Config.LarkAppID, cfg.Config.LarkAppSecret))
|
|
lark.conf = core.NewConfig(core.DomainFeiShu, appSettings, core.SetLoggerLevel(core.LoggerLevelError))
|
|
lark.userService = authen.NewService(lark.conf)
|
|
lark.imService = im.NewService(lark.conf)
|
|
}
|
|
return lark
|
|
}
|