Add leads handlers, WhatsApp integration, and test files
This commit is contained in:
40
apps/go-crm/internal/whatsapp/connector.go
Normal file
40
apps/go-crm/internal/whatsapp/connector.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package whatsapp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
)
|
||||
|
||||
type ConnectionState string
|
||||
|
||||
const (
|
||||
StateDisconnected ConnectionState = "disconnected"
|
||||
StateConnecting ConnectionState = "connecting"
|
||||
StateWaitingQR ConnectionState = "waiting_qr"
|
||||
StateConnected ConnectionState = "connected"
|
||||
StateFailed ConnectionState = "failed"
|
||||
)
|
||||
|
||||
type QRFrame struct {
|
||||
QR string
|
||||
State ConnectionState
|
||||
Error string
|
||||
}
|
||||
|
||||
type Contact struct {
|
||||
Phone string
|
||||
Name string
|
||||
FromMe bool
|
||||
Time time.Time
|
||||
}
|
||||
|
||||
type ContactHandler interface {
|
||||
OnContact(ctx context.Context, clientID int64, contact Contact) error
|
||||
}
|
||||
|
||||
type Connector interface {
|
||||
Connect(ctx context.Context, clientID int64) (<-chan QRFrame, error)
|
||||
Disconnect(ctx context.Context, clientID int64) error
|
||||
IsConnected(ctx context.Context, clientID int64) (bool, error)
|
||||
SetClientDB(db interface{})
|
||||
}
|
||||
Reference in New Issue
Block a user