[飞书] A fast feishu development sdk written in Golang
A fast feishu development sdk written in Golang
go get github.com/fastwego/feishu
// 内部应用 tenant_access_token 管理器
Atm = &feishu.DefaultAccessTokenManager{
Id: FeishuConfig["AppId"],
Cache: file.New(os.TempDir()),
GetRefreshRequestFunc: func() *http.Request {
payload := `{
"app_id":"` + FeishuConfig["AppId"] + `",
"app_secret":"` + FeishuConfig["AppSecret"] + `"
}`
req, _ := http.NewRequest(http.MethodPost, feishu.ServerUrl+"/open-apis/auth/v3/tenant_access_token/internal/", strings.NewReader(payload))
return req
},
}
// 创建 飞书 客户端
FeishuClient = feishu.NewClient()
// 调用 api 接口
tenantAccessToken, _ := Atm.GetAccessToken()
params := url.Values{}
params.Add("page_size", "10")
request, _ := http.NewRequest(http.MethodGet, feishu.ServerUrl+"/open-apis/meeting_room/building/list?"+params.Encode(), nil)
resp, err := FeishuClient.Do(request, tenantAccessToken)
完整演示项目:
https://github.com/fastwego/feishu-demo
FastWeGo 是一套丰富的 Go 服务开发框架,支持飞书、微信等服务,拥有庞大的开发者用户群体
你遇到的所有问题几乎都可以在社区找到解决方案
欢迎提交 pull request / issue / 文档,一起让飞书开发更快更好!
Faster we go together!