Add leads handlers, WhatsApp integration, and test files

This commit is contained in:
2026-05-02 17:40:38 +00:00
parent 8833e38b80
commit 57e6e5a6fd
24 changed files with 2305 additions and 115 deletions

View 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{})
}