1 Star 0 Fork 0

zhd / wechat

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
work.go 2.49 KB
一键复制 编辑 原始数据 按行查看 历史
zhd 提交于 2023-11-02 11:05 . 修改模块名
package work
import (
"gitee.com/zhd--zhd_admin/wechat/v2/credential"
"gitee.com/zhd--zhd_admin/wechat/v2/work/addresslist"
"gitee.com/zhd--zhd_admin/wechat/v2/work/appchat"
"gitee.com/zhd--zhd_admin/wechat/v2/work/checkin"
"gitee.com/zhd--zhd_admin/wechat/v2/work/config"
"gitee.com/zhd--zhd_admin/wechat/v2/work/context"
"gitee.com/zhd--zhd_admin/wechat/v2/work/externalcontact"
"gitee.com/zhd--zhd_admin/wechat/v2/work/invoice"
"gitee.com/zhd--zhd_admin/wechat/v2/work/kf"
"gitee.com/zhd--zhd_admin/wechat/v2/work/material"
"gitee.com/zhd--zhd_admin/wechat/v2/work/message"
"gitee.com/zhd--zhd_admin/wechat/v2/work/msgaudit"
"gitee.com/zhd--zhd_admin/wechat/v2/work/oauth"
"gitee.com/zhd--zhd_admin/wechat/v2/work/robot"
)
// Work 企业微信
type Work struct {
ctx *context.Context
}
// NewWork init work
func NewWork(cfg *config.Config) *Work {
defaultAkHandle := credential.NewWorkAccessToken(cfg.CorpID, cfg.CorpSecret, credential.CacheKeyWorkPrefix, cfg.Cache)
ctx := &context.Context{
Config: cfg,
AccessTokenHandle: defaultAkHandle,
}
return &Work{ctx: ctx}
}
// GetContext get Context
func (wk *Work) GetContext() *context.Context {
return wk.ctx
}
// GetOauth get oauth
func (wk *Work) GetOauth() *oauth.Oauth {
return oauth.NewOauth(wk.ctx)
}
// GetMsgAudit get msgAudit
func (wk *Work) GetMsgAudit() (*msgaudit.Client, error) {
return msgaudit.NewClient(wk.ctx.Config)
}
// GetKF get kf
func (wk *Work) GetKF() (*kf.Client, error) {
return kf.NewClient(wk.ctx.Config)
}
// GetExternalContact get external_contact
func (wk *Work) GetExternalContact() *externalcontact.Client {
return externalcontact.NewClient(wk.ctx)
}
// GetAddressList get address_list
func (wk *Work) GetAddressList() *addresslist.Client {
return addresslist.NewClient(wk.ctx)
}
// GetMaterial get material
func (wk *Work) GetMaterial() *material.Client {
return material.NewClient(wk.ctx)
}
// GetRobot get robot
func (wk *Work) GetRobot() *robot.Client {
return robot.NewClient(wk.ctx)
}
// GetMessage 获取发送应用消息接口实例
func (wk *Work) GetMessage() *message.Client {
return message.NewClient(wk.ctx)
}
// GetAppChat 获取应用发送消息到群聊会话接口实例
func (wk *Work) GetAppChat() *appchat.Client {
return appchat.NewClient(wk.ctx)
}
// GetInvoice get invoice
func (wk *Work) GetInvoice() *invoice.Client {
return invoice.NewClient(wk.ctx)
}
// GetCheckin 获取打卡接口实例
func (wk *Work) GetCheckin() *checkin.Client {
return checkin.NewClient(wk.ctx)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/zhd--zhd_admin/wechat.git
git@gitee.com:zhd--zhd_admin/wechat.git
zhd--zhd_admin
wechat
wechat
v2.1.8

搜索帮助

344bd9b3 5694891 D2dac590 5694891