Documentation ¶
Index ¶
- Constants
- type BaseRequest
- type BaseResponse
- type Caller
- type Configure
- type Contact
- type CountedContent
- type Event
- type EventContactData
- type EventMsgData
- type EventTimerData
- type EventTimingtData
- type Msg
- type Response
- type UUIDProcessor
- type WeChat
- func (wechat *WeChat) AddTimer(du time.Duration)
- func (wechat *WeChat) AddTiming(hm string)
- func (wechat *WeChat) AllContacts() []*Contact
- func (wechat *WeChat) ContactByUserName(un string) *Contact
- func (wechat *WeChat) CookieDataTicket() string
- func (wechat *WeChat) DownloadMedia(url string, localPath string) (string, error)
- func (wechat *WeChat) Execute(path string, body io.Reader, call Caller) error
- func (wechat *WeChat) ExecuteRequest(req *http.Request, call Caller) error
- func (wechat *WeChat) ForceUpdateGroup(groupUserName string)
- func (wechat *WeChat) GetContactHeadImg(c *Contact) ([]byte, error)
- func (wechat *WeChat) Go()
- func (wechat *WeChat) Handle(path string, handler func(Event))
- func (wechat *WeChat) Hook(f func(Event))
- func (wechat *WeChat) MembersOfGroup(groupUserName string) ([]*Contact, error)
- func (wechat *WeChat) PassTicketKV() string
- func (wechat *WeChat) ResetHandlers()
- func (wechat *WeChat) SearchContact(nickName string, city string, sex int, contactType int) ([]*Contact, error)
- func (wechat *WeChat) SendFile(path, to string) error
- func (wechat *WeChat) SendMsg(message Msg) error
- func (wechat *WeChat) SendTextMsg(msg, to string) error
- func (wechat *WeChat) SkeyKV() string
- func (wechat *WeChat) Stop()
- func (wechat *WeChat) SyncContact() error
- func (wechat *WeChat) UpdateGroupIfNeeded(groupID string)
- func (wechat *WeChat) UploadMedia(buf []byte, kind types.Type, info os.FileInfo, to string) (string, error)
Constants ¶
const ( // Offical 公众号 ... Offical = 0 // Friend 好友 ... Friend = 1 // Group 群组 ... Group = 2 // Member 群组成员 ... Member = 3 // FriendAndMember 即是好友也是群成员 ... FriendAndMember = 4 )
const ( // Delete 删除联系人 Delete = 0 // Modify 有人修改了自己的信息 Modify = 1 )
const ( // 男 Male = iota // 女 Female // 未知 Unknow // 任何 Any )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseRequest ¶
type BaseRequest struct { XMLName xml.Name `xml:"error" json:"-"` Ret int `xml:"ret" json:"-"` Message string `xml:"message" json:"-"` Wxsid string `xml:"wxsid" json:"Sid"` Skey string `xml:"skey"` DeviceID string `xml:"-"` Wxuin int64 `xml:"wxuin" json:"Uin"` PassTicket string `xml:"pass_ticket" json:"-"` }
BaseRequest is a base for all wx api request.
type BaseResponse ¶
BaseResponse for all api resp.
type Configure ¶
type Configure struct { Processor UUIDProcessor Debug bool CachePath string UniqueGroupMember bool // contains filtered or unexported fields }
Configure ...
func DefaultConfigure ¶
func DefaultConfigure() *Configure
DefaultConfigure create default configuration
type Contact ¶
type Contact struct { UserName string NickName string HeadImgURL string `json:"HeadImgUrl"` HeadHash string RemarkName string DisplayName string StarFriend float64 Sex float64 Signature string VerifyFlag float64 ContactFlag float64 HeadImgFlag float64 Province string City string Alias string EncryChatRoomID string `json:"EncryChatRoomId"` Type int MemberList []*Contact }
Contact is wx Account struct
type CountedContent ¶
CountedContent is a Wrappered for data struct from wx server
type EventContactData ¶
EventContactData 通讯录中删人 或者有人修改资料的时候
type EventMsgData ¶
type EventMsgData struct { IsGroupMsg bool IsMediaMsg bool IsSendedByMySelf bool MsgType int64 AtMe bool MediaURL string Content string FromUserName string SenderUserName string ToUserName string OriginalMsg map[string]interface{} }
EventMsgData 新消息
type EventTimerData ¶
EventTimerData ...
type Msg ¶
type Msg interface { Path() string To() string Content() map[string]interface{} Description() string }
Msg implement this interface, can added addition send by wechat
type UUIDProcessor ¶
UUIDProcessor scan this uuid
type WeChat ¶
type WeChat struct { Client *http.Client BaseURL string BaseRequest *BaseRequest MySelf Contact IsLogin bool // contains filtered or unexported fields }
WeChat container a default http client and base request.
func (*WeChat) ContactByUserName ¶
ContactByUserName ...
func (*WeChat) CookieDataTicket ¶
CookieDataTicket ...
func (*WeChat) DownloadMedia ¶
DownloadMedia use to download a voice or immage msg
func (*WeChat) ExecuteRequest ¶
ExecuteRequest is designed for perform http request
func (*WeChat) ForceUpdateGroup ¶
ForceUpdateGroup update group information
func (*WeChat) GetContactHeadImg ¶
GetContactHeadImg ...
func (*WeChat) MembersOfGroup ¶
MembersOfGroup ..返回群中所有的成员
func (*WeChat) PassTicketKV ¶
PassTicketKV return a string like `pass_ticket=1234s`
func (*WeChat) ResetHandlers ¶
func (wechat *WeChat) ResetHandlers()
ResetHandlers remove all regeisted handler
func (*WeChat) SearchContact ¶
func (wechat *WeChat) SearchContact(nickName string, city string, sex int, contactType int) ([]*Contact, error)
ContactsByNickName search contact with nick name
func (*WeChat) SendFile ¶
SendFile is desined to send contain attachment Message to group or contact. path must exit in local file system.
func (*WeChat) SendTextMsg ¶
SendTextMsg send text message
func (*WeChat) SyncContact ¶
SyncContact with Wechat server.
func (*WeChat) UpdateGroupIfNeeded ¶
UpdateGroupIfNeeded ...