_interface

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IAccessory

type IAccessory interface {
	GetPuppet() wechatyPuppet.IPuppetAbstract

	GetWechaty() IWechaty
}

IAccessory accessory interface

type IContact

type IContact interface {
	// Ready is For FrameWork ONLY!
	Ready(forceSync bool) (err error)
	IsReady() bool
	// Sync force reload data for Contact, sync data from lowlevel API again.
	Sync() error
	String() string
	ID() string
	Name() string
	// Say something params {(string | Contact | FileBox | UrlLink | MiniProgram)}
	Say(something interface{}) (msg IMessage, err error)
	// Friend true for friend of the bot, false for not friend of the bot
	Friend() bool
	Type() schemas.ContactType
	// Star check if the contact is star contact
	Star() bool
	Gender() schemas.ContactGender
	Province() string
	City() string
	// Avatar get avatar picture file stream
	Avatar() *filebox.FileBox
	// Self Check if contact is self
	Self() bool
	// Weixin get the weixin number from a contact
	// Sometimes cannot get weixin number due to weixin security mechanism, not recommend.
	Weixin() string
	// Alias get alias
	Alias() string
	// SetAlias set alias
	SetAlias(newAlias string)
}

type IContactFactory

type IContactFactory interface {
	Load(id string) IContact
	LoadSelf(id string) IContactSelf
	// Find query params is string or *schemas.ContactQueryFilter
	// when the parameter is a string type, the name search is used by default
	Find(query interface{}) IContact
	// FindAll query params is string or *schemas.ContactQueryFilter
	// when the parameter is a string type, the name search is used by default
	FindAll(query interface{}) []IContact
	// Tags get tags for all contact
	Tags() []ITag
}

type IContactSelf

type IContactSelf interface {
	IContact
	SetAvatar(box *filebox.FileBox) error
	// QRCode get bot qrcode
	QRCode() (string, error)
	SetName(name string) error
	// Signature change bot signature
	Signature(signature string) error
}

type IContactSelfFactory

type IContactSelfFactory interface {
	IContactFactory
}

type IFriendship

type IFriendship interface {
	Ready() (err error)
	IsReady() bool
	Contact() IContact
	String() string
	// Accept accept friend request
	Accept() error
	Type() schemas.FriendshipType
	// Hello get verify message from
	Hello() string
	// ToJSON get friendShipPayload Json
	ToJSON() (string, error)
}

type IFriendshipFactory

type IFriendshipFactory interface {
	Load(id string) IFriendship
	// Search search a Friend by phone or weixin.
	Search(query *schemas.FriendshipSearchCondition) (IContact, error)
	// Add send a Friend Request to a `contact` with message `hello`.
	// The best practice is to send friend request once per minute.
	// Remember not to do this too frequently, or your account may be blocked.
	Add(contact IContact, hello string) error
	// FromJSON create friendShip by friendshipJson
	FromJSON(payload string) (IFriendship, error)
	// FromPayload create friendShip by friendshipPayload
	FromPayload(payload *schemas.FriendshipPayload) (IFriendship, error)
}

type IImage

type IImage interface {
	Thumbnail() (*filebox.FileBox, error)
	HD() (*filebox.FileBox, error)
	Artwork() (*filebox.FileBox, error)
}

type IImageFactory

type IImageFactory interface {
	Create(id string) IImage
}

type IMessage

type IMessage interface {
	Ready() (err error)
	IsReady() bool
	String() string
	Room() IRoom
	// Type get the type from the message.
	Type() schemas.MessageType
	// Deprecated: please use Talker()
	From() IContact
	// Talker Get the talker of a message.
	Talker() IContact
	Text() string
	// Self check if a message is sent by self
	Self() bool
	Age() time.Duration
	// Date sent date
	Date() time.Time
	// Deprecated: please use Listener()
	To() IContact
	// Listener Get the destination of the message
	// listener() will return nil if a message is in a room
	// use Room() to get the room.
	Listener() IContact
	// ToRecalled Get the recalled message
	ToRecalled() (IMessage, error)
	// Say reply a Text or Media File message to the sender.
	Say(textOrContactOrFileOrUrlOrMini interface{}) (IMessage, error)
	// Recall recall a message
	Recall() (bool, error)
	// MentionList get message mentioned contactList.
	MentionList() []IContact
	MentionText() string
	MentionSelf() bool
	Forward(contactOrRoomId string) error
	// ToFileBox extract the Media File from the Message, and put it into the FileBox.
	ToFileBox() (*filebox.FileBox, error)
	// ToImage extract the Image File from the Message, so that we can use different image sizes.
	ToImage() (IImage, error)
	// ToContact Get Share Card of the Message
	// Extract the Contact Card from the Message, and encapsulate it into Contact class
	ToContact() (IContact, error)
}

type IMessageFactory

type IMessageFactory interface {
	Load(id string) IMessage
	// Find find message in cache
	Find(query interface{}) IMessage
	// FindAll Find message in cache
	FindAll(query *schemas.MessageQueryFilter) []IMessage
}

type IMiniProgram

type IMiniProgram interface {
	AppID() string
	Description() string
	PagePath() string
	ThumbUrl() string
	Title() string
	Username() string
	ThumbKey() string
}

type IRoom

type IRoom interface {
	// Ready is For FrameWork ONLY!
	Ready(forceSync bool) (err error)
	IsReady() bool
	String() string
	ID() string
	// MemberAll all contacts in a room
	// params nil or string or *schemas.RoomMemberQueryFilter
	MemberAll(query interface{}) ([]IContact, error)
	// Member Find all contacts in a room, if get many, return the first one.
	// query params string or *schemas.RoomMemberQueryFilter
	Member(query interface{}) (IContact, error)
	// Alias return contact's roomAlias in the room
	Alias(contact IContact) (string, error)
	// Sync Force reload data for Room, Sync data from puppet API again.
	Sync() error
	// Say something params {(string | Contact | FileBox | UrlLink | MiniProgram )}
	// mentionList @ contact list
	Say(something interface{}, mentionList ...IContact) (msg IMessage, err error)
	// Add contact in a room
	Add(contact IContact) error
	// Del delete a contact from the room
	// it works only when the bot is the owner of the room
	Del(contact IContact) error
	// Quit the room itself
	Quit() error
	// Topic get topic from the room
	Topic() string
	// Topic set topic from the room
	SetTopic(topic string) error
	// Announce get announce from the room
	Announce() (string, error)
	// Announce set announce from the room
	// It only works when bot is the owner of the room.
	SetAnnounce(text string) error
	// QrCode Get QR Code Value of the Room from the room, which can be used as scan and join the room.
	QrCode() (string, error)
	// Has check if the room has member `contact`
	Has(contact IContact) (bool, error)
	// Owner get room's owner from the room.
	Owner() IContact
	// Avatar get avatar from the room.
	Avatar() (*filebox.FileBox, error)
}

type IRoomFactory

type IRoomFactory interface {
	// Create a new room.
	Create(contactList []IContact, topic string) (IRoom, error)
	FindAll(query *schemas.RoomQueryFilter) []IRoom
	// Find query params is string or *schemas.RoomQueryFilter
	// when the parameter is a string type, the room name search is used by default
	Find(query interface{}) IRoom
	Load(id string) IRoom
}

type IRoomInvitation

type IRoomInvitation interface {
	String() string
	ToStringAsync() (string, error)
	Accept() error
	Inviter() (IContact, error)
	Topic() (string, error)
	MemberCount() (int, error)
	MemberList() ([]IContact, error)
	Date() (time.Time, error)
	Age() (time.Duration, error)
	ToJson() (string, error)
}

type IRoomInvitationFactory

type IRoomInvitationFactory interface {
	Load(id string) IRoomInvitation
	FromJSON(s string) (IRoomInvitation, error)
	FromPayload(payload *schemas.RoomInvitationPayload) IRoomInvitation
}

type ITag

type ITag interface {
	ID() string
	Add(to IContact) error
	Remove(from IContact) error
}

type ITagFactory

type ITagFactory interface {
	Load(id string) ITag
	Get(tag string) ITag
	Delete(tag ITag) error
}
type IUrlLink interface {
	String() string
	Url() string
	Title() string
	ThumbnailUrl() string
	Description() string
}

type IUrlLinkFactory

type IUrlLinkFactory interface {
	Create(url string) (IUrlLink, error)
}

type IWechaty

type IWechaty interface {
	Room() IRoomFactory
	Contact() IContactFactory
	Message() IMessageFactory
	Tag() ITagFactory
	Friendship() IFriendshipFactory
	Image() IImageFactory
	UserSelf() IContactSelf
}

IWechaty interface

Jump to

Keyboard shortcuts

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