Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrUnsupportedMessageType = errors.New("got unsupported message type")
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a whatsapp connection wrapper.
func NewClient ¶
func NewClient(wc *whatsapp.Conn) *Client
NewClient returns new instance of Client.
func (*Client) GetContacts ¶
func (c *Client) GetContacts() map[string]domain.WhatsappContact
GetContacts method returns a list of whatsapp contacts.
type EventsProvider ¶
type EventsProvider struct {
// contains filtered or unexported fields
}
EventsProvider represents whatsapp events provider.
func NewEventsProvider ¶
func NewEventsProvider(log *zap.Logger, opts *Opts) *EventsProvider
NewEventsProvider creates new instance of EventsProvider.
func (*EventsProvider) HandleError ¶
func (wh *EventsProvider) HandleError(err error)
HandleError method is called when error occurs.
func (*EventsProvider) HandleTextMessage ¶
func (wh *EventsProvider) HandleTextMessage(message whatsapp.TextMessage)
HandleTextMessage method is called when new text message is received.
func (*EventsProvider) ShouldCallSynchronously ¶
func (wh *EventsProvider) ShouldCallSynchronously() bool
ShouldCallSynchronously method indicates how whatsapp events should be handled.
type Opts ¶
type Opts struct { // ChatID is identifier of telegram chat. ChatID int64 // OutgoingEvents is a channel to send events to. OutgoingEvents chan domain.Event // WhatsappClient represents a client to work with whatsapp API. WhatsappClient domain.WhatsappClient }
Opts represents options to create new instance of EventsProvider.
Click to show internal directories.
Click to hide internal directories.