-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmain.go
More file actions
34 lines (29 loc) · 807 Bytes
/
Copy pathmain.go
File metadata and controls
34 lines (29 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main
import (
"context"
"fmt"
"log"
"github.com/shuaidd/wecom-core"
"github.com/shuaidd/wecom-core/config"
"github.com/shuaidd/wecom-core/pkg/logger"
)
func main() {
// 创建企业微信客户端
client, err := wecom.New(
config.WithCorpID("wwd8b4a0d94c30bcb7"),
// config.WithCorpSecret("c024lT7BImnNiBawyKheY5NhbtuzH0vxS2y3e_fAR-s"),
config.WithDebug(true),
config.WithLogger(logger.NewStdLogger()),
)
if err != nil {
log.Fatalf("Failed to create wecom client: %v", err)
}
ctx := wecom.WithTraceID(context.Background(), "sss")
// 读取成员信息
user, err := client.Contact.GetUser(ctx, "ddshuai")
if err != nil {
log.Fatalf("Failed to get user: %v", err)
}
fmt.Printf("成员信息: UserID=%s, Name=%s, Mobile=%s\n",
user.UserID, user.Name, user.Mobile)
}