-
Notifications
You must be signed in to change notification settings - Fork 164
/
appchat.go
62 lines (56 loc) · 1.58 KB
/
appchat.go
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package workwx
// CreateAppchat 创建群聊会话
func (c *WorkwxApp) CreateAppchat(chatInfo *ChatInfo) (chatID string, err error) {
resp, err := c.execAppchatCreate(reqAppchatCreate{
ChatInfo: chatInfo,
})
if err != nil {
return "", err
}
return resp.ChatID, nil
}
// UpdateAppchat 修改群聊会话
func (c *WorkwxApp) UpdateAppchat(chatInfo ChatInfo, addMemberUserIDs, delMemberUserIDs []string) (err error) {
_, err = c.execAppchatUpdate(reqAppchatUpdate{
ChatInfo: chatInfo,
AddMemberUserIDs: addMemberUserIDs,
DelMemberUserIDs: delMemberUserIDs,
})
if err != nil {
return err
}
return nil
}
// GetAppchat 获取群聊会话
func (c *WorkwxApp) GetAppchat(chatID string) (*ChatInfo, error) {
resp, err := c.execAppchatGet(reqAppchatGet{
ChatID: chatID,
})
if err != nil {
return nil, err
}
// TODO: return bare T instead of &T?
obj := resp.ChatInfo
return obj, nil
}
// GetAppChatList 获取客户群列表 企业微信接口调整 此API同GetGroupChatList 兼容处理
func (c *WorkwxApp) GetAppChatList(req ReqChatList) (*RespAppchatList, error) {
resp, err := c.execGroupChatListGet(reqGroupChatList{
ReqChatList: req,
})
if err != nil {
return nil, err
}
return resp.RespGroupChatList, nil
}
// GetAppChatInfo 获取客户群详细信息 企业微信接口调整 此API同GetGroupChatInfo 兼容处理
func (c *WorkwxApp) GetAppChatInfo(chatID string) (*RespAppChatInfo, error) {
resp, err := c.execGroupChatInfoGet(reqGroupChatInfo{
ChatID: chatID,
NeedName: ChatNeedName,
})
if err != nil {
return nil, err
}
return resp.GroupChat, nil
}