Documentation ¶
Index ¶
- Constants
- Variables
- func NewFileBoxFromMessageFileStream(client pbwechaty.Puppet_MessageFileStreamClient) (*filebox.FileBox, error)
- func ToMessageSendFileWriter(client pbwechaty.Puppet_MessageSendFileStreamClient, conversationID string, ...) (io.Writer, error)
- type DownloadFile
- type MessageFile
- type MessageSendFile
- type Options
- type PuppetService
- func (p *PuppetService) ContactAlias(contactID string) (string, error)
- func (p *PuppetService) ContactAvatar(contactID string) (*filebox.FileBox, error)
- func (p *PuppetService) ContactList() ([]string, error)
- func (p *PuppetService) ContactQRCode(contactID string) (string, error)
- func (p *PuppetService) ContactRawPayload(contactID string) (*schemas.ContactPayload, error)
- func (p *PuppetService) ContactSelfQRCode() (string, error)
- func (p *PuppetService) Ding(data string)
- func (p *PuppetService) DirtyPayload(payloadType schemas.PayloadType, id string) error
- func (p *PuppetService) FriendshipAccept(friendshipID string) (err error)
- func (p *PuppetService) FriendshipAdd(contactID, hello string) (err error)
- func (p *PuppetService) FriendshipRawPayload(id string) (*schemas.FriendshipPayload, error)
- func (p *PuppetService) FriendshipSearchPhone(phone string) (string, error)
- func (p *PuppetService) FriendshipSearchWeixin(weixin string) (string, error)
- func (p *PuppetService) Logout() error
- func (p *PuppetService) MessageContact(messageID string) (string, error)
- func (p *PuppetService) MessageFile(id string) (*filebox.FileBox, error)
- func (p *PuppetService) MessageForward(conversationID string, messageID string) (string, error)
- func (p *PuppetService) MessageImage(messageID string, imageType schemas.ImageType) (*filebox.FileBox, error)
- func (p *PuppetService) MessageLocation(messageID string) (*schemas.LocationPayload, error)
- func (p *PuppetService) MessageRawMiniProgramPayload(messageID string) (*schemas.MiniProgramPayload, error)
- func (p *PuppetService) MessageRawPayload(id string) (*schemas.MessagePayload, error)
- func (p *PuppetService) MessageRecall(messageID string) (bool, error)
- func (p *PuppetService) MessageSendContact(conversationID string, contactID string) (string, error)
- func (p *PuppetService) MessageSendFile(conversationID string, fileBox *filebox.FileBox) (string, error)
- func (p *PuppetService) MessageSendLocation(conversationID string, payload *schemas.LocationPayload) (string, error)
- func (p *PuppetService) MessageSendMiniProgram(conversationID string, miniProgramPayload *schemas.MiniProgramPayload) (string, error)
- func (p *PuppetService) MessageSendText(conversationID string, text string, mentionIDList ...string) (string, error)
- func (p *PuppetService) MessageSendURL(conversationID string, urlLinkPayload *schemas.UrlLinkPayload) (string, error)
- func (p *PuppetService) MessageURL(messageID string) (*schemas.UrlLinkPayload, error)
- func (p *PuppetService) RoomAdd(roomID, contactID string) error
- func (p *PuppetService) RoomAnnounce(roomID string) (string, error)
- func (p *PuppetService) RoomAvatar(roomID string) (*filebox.FileBox, error)
- func (p *PuppetService) RoomCreate(contactIDList []string, topic string) (string, error)
- func (p *PuppetService) RoomDel(roomID, contactID string) error
- func (p *PuppetService) RoomInvitationAccept(roomInvitationID string) error
- func (p *PuppetService) RoomInvitationRawPayload(id string) (*schemas.RoomInvitationPayload, error)
- func (p *PuppetService) RoomList() ([]string, error)
- func (p *PuppetService) RoomMemberList(roomID string) ([]string, error)
- func (p *PuppetService) RoomMemberRawPayload(roomID string, contactID string) (*schemas.RoomMemberPayload, error)
- func (p *PuppetService) RoomQRCode(roomID string) (string, error)
- func (p *PuppetService) RoomQuit(roomID string) error
- func (p *PuppetService) RoomRawPayload(id string) (*schemas.RoomPayload, error)
- func (p *PuppetService) RoomTopic(roomID string) (string, error)
- func (p *PuppetService) SetContactAlias(contactID string, alias string) error
- func (p *PuppetService) SetContactAvatar(contactID string, fileBox *filebox.FileBox) error
- func (p *PuppetService) SetContactSelfName(name string) error
- func (p *PuppetService) SetContactSelfSignature(signature string) error
- func (p *PuppetService) SetRoomAnnounce(roomID, text string) error
- func (p *PuppetService) SetRoomTopic(roomID string, topic string) error
- func (p *PuppetService) Start() (err error)
- func (p *PuppetService) Stop()
- func (p *PuppetService) TagContactAdd(id, contactID string) (err error)
- func (p *PuppetService) TagContactDelete(id string) (err error)
- func (p *PuppetService) TagContactList(contactID string) ([]string, error)
- func (p *PuppetService) TagContactRemove(id, contactID string) (err error)
- type ServiceEndPoint
- type TLSConfig
Constants ¶
const TLSCaCert = `` /* 2060-byte string literal not displayed */
TLSCaCert Wechaty Certificate Authority Repo:
https://github.com/wechaty/dotenv/tree/main/ca
The SSL_ROOT_CERT is a root certificate generated by and for wechaty community.
Because it's the default root cert for the puppet service,
so all the Polyglot Wechaty SDK should set this cert to be trusted by default.
Update:
- Huan(202108): init, expired in 3650 days (after 2031/07)
const TLSInsecureServerCertCommonName = "insecure"
TLSInsecureServerCertCommonName Common Name:
- Server Name Indication (SNI)
- Case insensitive
Wechaty Token format: `${SNI}/${UUIDv4}`
Variables ¶
var ( // ErrNoEndpoint err no endpoint ErrNoEndpoint = errors.New("no endpoint") // ErrURLLinkPayloadNotFound ... ErrURLLinkPayloadNotFound = errors.New("UrlLinkPayloadNotFound") )
var ErrNoName = errors.New("no name")
ErrNoName err no name
var ( // ErrNotToken token not found error // Deprecated ErrNotToken = errors.New("wechaty-puppet-service: token not found. See: <https://github.com/wechaty/wechaty-puppet-service#1-wechaty_puppet_service_token>") )
var ErrTokenNotFound = errors.New("wechaty-puppet-service: WECHATY_PUPPET_SERVICE_TOKEN not found")
ErrTokenNotFound err token not found
Functions ¶
func NewFileBoxFromMessageFileStream ¶
func NewFileBoxFromMessageFileStream(client pbwechaty.Puppet_MessageFileStreamClient) (*filebox.FileBox, error)
NewFileBoxFromMessageFileStream ...
func ToMessageSendFileWriter ¶
func ToMessageSendFileWriter(client pbwechaty.Puppet_MessageSendFileStreamClient, conversationID string, fileBox *filebox.FileBox) (io.Writer, error)
ToMessageSendFileWriter 把 grpc 流包装到 io.Writer 接口
Types ¶
type DownloadFile ¶
type DownloadFile struct {
// contains filtered or unexported fields
}
DownloadFile 把 grpc download 流包装到 io.Reader 接口
func NewDownloadFile ¶
func NewDownloadFile(client pbwechaty.Puppet_DownloadClient) *DownloadFile
NewDownloadFile 把 grpc download 流包装到 io.Reader 接口
type MessageFile ¶
type MessageFile struct {
// contains filtered or unexported fields
}
MessageFile 把 grpc 流包装到 io.Reader 接口
func NewMessageFile ¶
func NewMessageFile(client pbwechaty.Puppet_MessageFileStreamClient) *MessageFile
NewMessageFile ...
type MessageSendFile ¶
type MessageSendFile struct {
// contains filtered or unexported fields
}
MessageSendFile 把 grpc 流包装到 io.Writer 接口
type Options ¶
type Options struct { wechatypuppet.Option GrpcReconnectInterval time.Duration Authority string TLS TLSConfig }
Options puppet-service options
type PuppetService ¶
type PuppetService struct { *wechatyPuppet.Puppet // contains filtered or unexported fields }
PuppetService struct
func NewNewPuppetService ¶
func NewNewPuppetService(opts Options) (*PuppetService, error)
NewNewPuppetService create puppet service
func NewPuppetService ¶
func NewPuppetService(o wechatyPuppet.Option) (*PuppetService, error)
NewPuppetService new PuppetService struct Deprecated: please use NewNewPuppetService
func (*PuppetService) ContactAlias ¶
func (p *PuppetService) ContactAlias(contactID string) (string, error)
ContactAlias ...
func (*PuppetService) ContactAvatar ¶
func (p *PuppetService) ContactAvatar(contactID string) (*filebox.FileBox, error)
ContactAvatar ...
func (*PuppetService) ContactList ¶
func (p *PuppetService) ContactList() ([]string, error)
ContactList ...
func (*PuppetService) ContactQRCode ¶
func (p *PuppetService) ContactQRCode(contactID string) (string, error)
ContactQRCode ...
func (*PuppetService) ContactRawPayload ¶
func (p *PuppetService) ContactRawPayload(contactID string) (*schemas.ContactPayload, error)
ContactRawPayload ...
func (*PuppetService) ContactSelfQRCode ¶
func (p *PuppetService) ContactSelfQRCode() (string, error)
ContactSelfQRCode ...
func (*PuppetService) DirtyPayload ¶
func (p *PuppetService) DirtyPayload(payloadType schemas.PayloadType, id string) error
DirtyPayload ...
func (*PuppetService) FriendshipAccept ¶
func (p *PuppetService) FriendshipAccept(friendshipID string) (err error)
FriendshipAccept ...
func (*PuppetService) FriendshipAdd ¶
func (p *PuppetService) FriendshipAdd(contactID, hello string) (err error)
FriendshipAdd ...
func (*PuppetService) FriendshipRawPayload ¶
func (p *PuppetService) FriendshipRawPayload(id string) (*schemas.FriendshipPayload, error)
FriendshipRawPayload ...
func (*PuppetService) FriendshipSearchPhone ¶
func (p *PuppetService) FriendshipSearchPhone(phone string) (string, error)
FriendshipSearchPhone ...
func (*PuppetService) FriendshipSearchWeixin ¶
func (p *PuppetService) FriendshipSearchWeixin(weixin string) (string, error)
FriendshipSearchWeixin ...
func (*PuppetService) MessageContact ¶
func (p *PuppetService) MessageContact(messageID string) (string, error)
MessageContact ...
func (*PuppetService) MessageFile ¶
func (p *PuppetService) MessageFile(id string) (*filebox.FileBox, error)
MessageFile ...
func (*PuppetService) MessageForward ¶
func (p *PuppetService) MessageForward(conversationID string, messageID string) (string, error)
MessageForward message forward
func (*PuppetService) MessageImage ¶
func (p *PuppetService) MessageImage(messageID string, imageType schemas.ImageType) (*filebox.FileBox, error)
MessageImage ...
func (*PuppetService) MessageLocation ¶
func (p *PuppetService) MessageLocation(messageID string) (*schemas.LocationPayload, error)
MessageLocation get location payload
func (*PuppetService) MessageRawMiniProgramPayload ¶
func (p *PuppetService) MessageRawMiniProgramPayload(messageID string) (*schemas.MiniProgramPayload, error)
MessageRawMiniProgramPayload ...
func (*PuppetService) MessageRawPayload ¶
func (p *PuppetService) MessageRawPayload(id string) (*schemas.MessagePayload, error)
MessageRawPayload ...
func (*PuppetService) MessageRecall ¶
func (p *PuppetService) MessageRecall(messageID string) (bool, error)
MessageRecall ...
func (*PuppetService) MessageSendContact ¶
func (p *PuppetService) MessageSendContact(conversationID string, contactID string) (string, error)
MessageSendContact ...
func (*PuppetService) MessageSendFile ¶
func (p *PuppetService) MessageSendFile(conversationID string, fileBox *filebox.FileBox) (string, error)
MessageSendFile ...
func (*PuppetService) MessageSendLocation ¶
func (p *PuppetService) MessageSendLocation(conversationID string, payload *schemas.LocationPayload) (string, error)
MessageSendLocation send location
func (*PuppetService) MessageSendMiniProgram ¶
func (p *PuppetService) MessageSendMiniProgram(conversationID string, miniProgramPayload *schemas.MiniProgramPayload) (string, error)
MessageSendMiniProgram ...
func (*PuppetService) MessageSendText ¶
func (p *PuppetService) MessageSendText(conversationID string, text string, mentionIDList ...string) (string, error)
MessageSendText ...
func (*PuppetService) MessageSendURL ¶
func (p *PuppetService) MessageSendURL(conversationID string, urlLinkPayload *schemas.UrlLinkPayload) (string, error)
MessageSendURL ...
func (*PuppetService) MessageURL ¶
func (p *PuppetService) MessageURL(messageID string) (*schemas.UrlLinkPayload, error)
MessageURL ...
func (*PuppetService) RoomAdd ¶
func (p *PuppetService) RoomAdd(roomID, contactID string) error
RoomAdd ...
func (*PuppetService) RoomAnnounce ¶
func (p *PuppetService) RoomAnnounce(roomID string) (string, error)
RoomAnnounce ...
func (*PuppetService) RoomAvatar ¶
func (p *PuppetService) RoomAvatar(roomID string) (*filebox.FileBox, error)
RoomAvatar ...
func (*PuppetService) RoomCreate ¶
func (p *PuppetService) RoomCreate(contactIDList []string, topic string) (string, error)
RoomCreate ...
func (*PuppetService) RoomDel ¶
func (p *PuppetService) RoomDel(roomID, contactID string) error
RoomDel ...
func (*PuppetService) RoomInvitationAccept ¶
func (p *PuppetService) RoomInvitationAccept(roomInvitationID string) error
RoomInvitationAccept ...
func (*PuppetService) RoomInvitationRawPayload ¶
func (p *PuppetService) RoomInvitationRawPayload(id string) (*schemas.RoomInvitationPayload, error)
RoomInvitationRawPayload ...
func (*PuppetService) RoomMemberList ¶
func (p *PuppetService) RoomMemberList(roomID string) ([]string, error)
RoomMemberList ...
func (*PuppetService) RoomMemberRawPayload ¶
func (p *PuppetService) RoomMemberRawPayload(roomID string, contactID string) (*schemas.RoomMemberPayload, error)
RoomMemberRawPayload ...
func (*PuppetService) RoomQRCode ¶
func (p *PuppetService) RoomQRCode(roomID string) (string, error)
RoomQRCode ...
func (*PuppetService) RoomRawPayload ¶
func (p *PuppetService) RoomRawPayload(id string) (*schemas.RoomPayload, error)
RoomRawPayload ...
func (*PuppetService) RoomTopic ¶
func (p *PuppetService) RoomTopic(roomID string) (string, error)
RoomTopic ...
func (*PuppetService) SetContactAlias ¶
func (p *PuppetService) SetContactAlias(contactID string, alias string) error
SetContactAlias ...
func (*PuppetService) SetContactAvatar ¶
func (p *PuppetService) SetContactAvatar(contactID string, fileBox *filebox.FileBox) error
SetContactAvatar ...
func (*PuppetService) SetContactSelfName ¶
func (p *PuppetService) SetContactSelfName(name string) error
SetContactSelfName ...
func (*PuppetService) SetContactSelfSignature ¶
func (p *PuppetService) SetContactSelfSignature(signature string) error
SetContactSelfSignature ...
func (*PuppetService) SetRoomAnnounce ¶
func (p *PuppetService) SetRoomAnnounce(roomID, text string) error
SetRoomAnnounce ...
func (*PuppetService) SetRoomTopic ¶
func (p *PuppetService) SetRoomTopic(roomID string, topic string) error
SetRoomTopic ...
func (*PuppetService) TagContactAdd ¶
func (p *PuppetService) TagContactAdd(id, contactID string) (err error)
TagContactAdd ...
func (*PuppetService) TagContactDelete ¶
func (p *PuppetService) TagContactDelete(id string) (err error)
TagContactDelete ...
func (*PuppetService) TagContactList ¶
func (p *PuppetService) TagContactList(contactID string) ([]string, error)
TagContactList ...
func (*PuppetService) TagContactRemove ¶
func (p *PuppetService) TagContactRemove(id, contactID string) (err error)
TagContactRemove ...
type ServiceEndPoint ¶
ServiceEndPoint api.chatie.io endpoint api response Deprecated
func (*ServiceEndPoint) IsValid ¶
func (p *ServiceEndPoint) IsValid() bool
IsValid EndPoint is valid