winapi

package
v0.0.0-...-c3cba88 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AsyncRespPushType     = 0
	SyncMsgPushType       = 1
	LoginMsgPushType      = 2
	LogoutMsgPushType     = 3
	MsgHookPushType       = 4
	RoomChangeMsgPushType = 5
)
View Source
const (
	WaitScanLoginState  = 0
	ScannedLoginState   = 1
	ConfirmedLoginState = 2
)
View Source
const (
	ScanLoginStep = 0
	LoggedStep    = 1
)

Variables

View Source
var ErrIsLogin = fmt.Errorf("client is already logined")

Functions

This section is empty.

Types

type CommonResp

type CommonResp struct {
	Description string `json:"description"`
	ErrorCode   int    `json:"error_code"`
	Robot       *Robot `json:"robot"`
	Type        int    `json:"type"`
}

func (*CommonResp) Error

func (c *CommonResp) Error() error

func (*CommonResp) IsSuccess

func (c *CommonResp) IsSuccess() bool

type EventMsg

type EventMsg struct {
	Data     json.RawMessage `json:"data"`
	PushTime int             `json:"pushTime"`
	PushType int             `json:"pushType"`
	Robot    *Robot          `json:"robot"`

	Raw []byte `json:"-"`
}

func (*EventMsg) Parse

func (c *EventMsg) Parse() (interface{}, error)

type GetContactUserNameResp

type GetContactUserNameResp struct {
	Data struct {
		Data   []*User `json:"data"`
		Desc   string  `json:"desc"`
		Status int     `json:"status"`
	} `json:"data"`
	CommonResp
}

type GetLoginQrCodeData

type GetLoginQrCodeData struct {
	Desc   string `json:"desc"`
	Qrcode []int  `json:"qrcode"`
	Status int    `json:"status"`
	Uuid   string `json:"uuid"`
}

type GetLoginQrCodeResp

type GetLoginQrCodeResp struct {
	Data GetLoginQrCodeData `json:"data"`
	CommonResp
}

func (*GetLoginQrCodeResp) IsLogin

func (g *GetLoginQrCodeResp) IsLogin() bool

type GetRoomMemberResp

type GetRoomMemberResp struct {
	Data struct {
		Data   *GetRoomMemberRespData `json:"data"`
		Desc   string                 `json:"desc"`
		Status int                    `json:"status"`
	} `json:"data"`
	CommonResp
}

type GetRoomMemberRespData

type GetRoomMemberRespData struct {
	ChatroomAdminUserNames   []string      `json:"chatroomAdminUserNames"`
	ChatroomMemberInfoVerion int           `json:"chatroomMemberInfoVerion"`
	ChatroomUserName         string        `json:"chatroomUserName"`
	Count                    int           `json:"count"`
	Members                  []*RoomMember `json:"members"`
	OwnerUserName            string        `json:"ownerUserName"`
}

type GetUserResp

type GetUserResp struct {
	Data struct {
		Data   *GetUserRespData `json:"data"`
		Desc   string           `json:"desc"`
		Status int              `json:"status"`
	} `json:"data"`
	CommonResp
}

type GetUserRespData

type GetUserRespData struct {
	Count    int     `json:"count"`
	Profiles []*User `json:"profiles"`
}

type LoginEventData

type LoginEventData struct {
	Alias           string `json:"alias"`
	BigHeadImgUrl   string `json:"bigHeadImgUrl"`
	City            string `json:"city"`
	Nation          string `json:"nation"`
	NickName        string `json:"nickName"`
	Phone           string `json:"phone"`
	Province        string `json:"province"`
	Sex             int    `json:"sex"`
	Signature       string `json:"signature"`
	SmallHeadImgUrl string `json:"smallHeadImgUrl"`
	Step            int    `json:"step"`
	State           int    `json:"state"`
	Uuid            string `json:"uuid"`
	Uin             int    `json:"uin"`
	UserName        string `json:"userName"`
}

type LogoutEventData

type LogoutEventData struct {
	Time     int    `json:"time"`
	UserName string `json:"userName"`
}

type MsgEventData

type MsgEventData struct {
	ChatroomMemberInfo struct {
		Alias                         string `json:"alias"`
		BelongChatroomNickName        string `json:"belongChatroomNickName"`
		BelongChatroomSmallHeadImgUrl string `json:"belongChatroomSmallHeadImgUrl"`
		BelongChatroomUserName        string `json:"belongChatroomUserName"`
		ChatroomDisplayName           string `json:"chatroomDisplayName"`
		ChatroomUserFlag              int    `json:"chatroomUserFlag"`
		IsChatroomAdmin               bool   `json:"isChatroomAdmin"`
		IsChatroomOwner               bool   `json:"isChatroomOwner"`
		NickName                      string `json:"nickName"`
		Remark                        string `json:"remark"`
		SmallHeadImgUrl               string `json:"smallHeadImgUrl"`
		Type                          string `json:"type"`
		UserName                      string `json:"userName"`
		VerifyFlag                    string `json:"verifyFlag"`
	} `json:"chatroomMemberInfo"`
	Content        string `json:"content"`
	Createtime     int    `json:"createtime"`
	From           string `json:"from"`
	IsChatroomMsg  int    `json:"isChatroomMsg"`
	IsSender       int    `json:"isSender"`
	MsgSvrID       int64  `json:"msgSvrID"`
	Reserved1      string `json:"reserved1"`
	SyncFromMobile bool   `json:"syncFromMobile"`
	TalkerInfo     struct {
		Alias           string `json:"alias"`
		NickName        string `json:"nickName"`
		Remark          string `json:"remark"`
		SmallHeadImgUrl string `json:"smallHeadImgUrl"`
		Type            string `json:"type"`
		UserName        string `json:"userName"`
		VerifyFlag      string `json:"verifyFlag"`
	} `json:"talkerInfo"`
	To   string  `json:"to"`
	Type MsgType `json:"type"`
}

type MsgHandlerProtocolType

type MsgHandlerProtocolType int
const (
	TcpProtocolType       MsgHandlerProtocolType = 1
	HttpProtocolType      MsgHandlerProtocolType = 2
	WebsocketProtocolType MsgHandlerProtocolType = 3
)

type MsgType

type MsgType int
const (
	MsgTypeText               MsgType = 1
	MsgTypeImage              MsgType = 3
	MsgTypeAudio              MsgType = 34
	MsgTypeFriendVerification MsgType = 37
	MsgTypeFriendRecommend    MsgType = 42
	MsgTypeEmoticon           MsgType = 47
	MsgTypeLocation           MsgType = 48
	MsgTypeXML                MsgType = 49
	MsgTypeTelephone          MsgType = 50
	MsgTypeMobileOperate      MsgType = 51
	MsgTypeSystem             MsgType = 10000
	MsgTypeRecall             MsgType = 10002
)

type Robot

type Robot struct {
	Alias           string `json:"alias"`
	IsLogin         bool   `json:"isLogin"`
	NickName        string `json:"nickName"`
	Pid             int    `json:"pid"`
	Port            int    `json:"port"`
	SmallHeadImgUrl string `json:"smallHeadImgUrl"`
	UserName        string `json:"userName"`
}

type RoomMember

type RoomMember struct {
	BigHeadImgUrl   string `json:"bigHeadImgUrl"`
	InviterUserName string `json:"inviterUserName"`
	IsAdmin         bool   `json:"isAdmin"`
	MemberTraceBack string `json:"memberTraceBack"`
	NickName        string `json:"nickName"`
	Permission      int    `json:"permission"`
	SmallHeadImgUrl string `json:"smallHeadImgUrl"`
	UserName        string `json:"userName"`
}

type SearchResp

type SearchResp struct {
	Data struct {
		Data   map[string]*User `json:"data"`
		Desc   string           `json:"desc"`
		Status int              `json:"status"`
	} `json:"data"`
	CommonResp
}

type SendTextResp

type SendTextResp struct {
	Data struct {
		Desc     string `json:"desc"`
		MsgSvrID int64  `json:"msgSvrID"`
		Status   int    `json:"status"`
	} `json:"data"`
	CommonResp
}

type User

type User struct {
	Alias           string `json:"alias"`
	BigHeadImgUrl   string `json:"bigHeadImgUrl"`
	CertFlag        int    `json:"certFlag"`
	City            string `json:"city"`
	ErrorCode       int    `json:"errorCode"`
	Fullpy          string `json:"fullpy"`
	Nation          string `json:"nation"`
	NickName        string `json:"nickName"`
	Province        string `json:"province"`
	Remark          string `json:"remark"`
	Reserved1       int    `json:"reserved1"`
	Sex             int    `json:"sex"`
	Simplepy        string `json:"simplepy"`
	SmallHeadImgUrl string `json:"smallHeadImgUrl"`
	UserFlag        int    `json:"userFlag"`
	UserName        string `json:"userName"`

	ChatroomAccessType int `json:"chatroomAccessType"`
	ChatroomMaxCount   int `json:"chatroomMaxCount"`
	ChatroomNotify     int `json:"chatroomNotify"`

	IsFriend   bool     `json:"-"`
	MemberNum  int      `json:"-"`
	OwnerID    string   `json:"-"`
	MemberList []*User  `json:"-"`
	AdminIDs   []string `json:"-"`
}

func (*User) CloneContact

func (u *User) CloneContact() *User

type WinApi

type WinApi struct {
	// contains filtered or unexported fields
}

func NewWinApi

func NewWinApi(server string) *WinApi

func (*WinApi) AddMsgHandler

func (w *WinApi) AddMsgHandler(protocolType MsgHandlerProtocolType, url string) error

func (*WinApi) BatchGetUser

func (w *WinApi) BatchGetUser(userIDs []string) (*GetUserResp, error)

func (*WinApi) GetLoginQrCode

func (w *WinApi) GetLoginQrCode() (*GetLoginQrCodeResp, error)

func (*WinApi) GetRoomMember

func (w *WinApi) GetRoomMember(roomID string) (*GetRoomMemberResp, error)

func (*WinApi) GetSavedFriendUserNames

func (w *WinApi) GetSavedFriendUserNames() ([]string, error)

GetSavedFriendUserNames 获取通讯录好友

func (*WinApi) GetSavedFriendUsers

func (w *WinApi) GetSavedFriendUsers() ([]*User, error)

func (*WinApi) GetSavedRoomUserNames

func (w *WinApi) GetSavedRoomUserNames() ([]string, error)

GetSavedRoomUserNames 获取通讯录群聊

func (*WinApi) GetSavedRoomUsers

func (w *WinApi) GetSavedRoomUsers() ([]*User, error)

func (*WinApi) GetUser

func (w *WinApi) GetUser(userIDs []string) (*GetUserResp, error)

func (*WinApi) SearchUser

func (w *WinApi) SearchUser(userIDs []string) (*SearchResp, error)

SearchUser 好友、群、群成员

func (*WinApi) SendText

func (w *WinApi) SendText(userName string, text string, atUserList []string) (*SendTextResp, error)

func (*WinApi) SendURL

func (w *WinApi) SendURL(userName string, content string) (*SendTextResp, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL