Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chat ¶
type Chat struct {
ID int `json:"id"`
DisplayName string `json:"displayName"`
LastActivity time.Time `json:"lastActivity"`
}
Chat represents an active conversation with another user
type Client ¶
type Client interface {
// Chats returns a list of chat threads
Chats() ([]Chat, error)
// Messages returns a list of messages for a given chat id
Messages(chatID int, filter MessageFilter) ([]Message, error)
// SendMessage sends the given string message to the specified chat id
SendMessage(chatID int, message string) error
// SendMedia sends a new empty message with arbitrary data as an attachment to
// a given chat id
//
// `name` is used for the file name that will used on disk which is visible if
// the sender or receiver choose to save the image
//
// Due to current limitations the name will be prefixed with a random id
SendMedia(chatID int, name string, data io.Reader) error
// Attachments returns an array of file paths of attachments on the
// specified message id
Attachments(messageID int) ([]string, error)
// Close destructs the client
Close()
}
Client interface represents a sigma client (either real or mock)
type Message ¶
type Message struct {
ID int `json:"id"`
Delivered bool `json:"delivered"`
FromMe bool `json:"fromMe"`
Text string `json:"text"`
Time time.Time `json:"time"`
}
Message represents a single message in a chat
type MessageFilter ¶
type MessageFilter struct {
AfterID int //(optional) get messages after the specified message id
BeforeID int // (optional) get messages before the specified message id
Limit int // the maximum number of messages to return
}
MessageFilter is used to help paginate message results
Source Files
¶
Click to show internal directories.
Click to hide internal directories.