package hook

import "fmt"

// 获取好友和群信息
func (h *Hook) GetFriendAndChatRoomList(typeStr string) (result GetFriendAndChatRoomListReap, err error) {
	resp, err := h.Client.R().SetBody(&GetFriendAndChatRoomListReq{
		Type: typeStr,
	}).SetSuccessResult(&result).Post("http://" + h.ServerIp + ":" + h.WxPort + "/GetFriendAndChatRoomList")
	if err != nil {
		return
	}
	if !resp.IsSuccessState() {
		err = fmt.Errorf("GetFriendAndChatRoomList failed with status code %d", resp.StatusCode)
		return
	}
	return
}