Documentation
¶
Index ¶
- Constants
- Variables
- type Call
- type CallLogOutcome
- type CallLogType
- type CallMedia
- type CallStatus
- type CallType
- type Callbacks
- type ConnStatus
- type Connection
- func (conn *Connection) Connect(ctx context.Context) error
- func (conn *Connection) Disconnect()
- func (conn *Connection) IsConnected() bool
- func (conn *Connection) IsLoggedIn() bool
- func (conn *Connection) SendEdit(message Message) error
- func (conn *Connection) SendMessage(message Message, sendOnCallback bool) (Message, error)
- func (conn *Connection) SendPlayed(messageIDs []string, when time.Time, chatJID string, senderJID string) error
- func (conn *Connection) SendRead(messageIDs []string, when time.Time, chatJID string, senderJID string, ...) error
- func (conn *Connection) SyncAllContacts() error
- type Contact
- type Group
- type GroupParticipant
- type GroupParticipantRank
- type Logger
- type Message
- type MessageStatus
- type User
Constants ¶
View Source
const ( CallStatusOffer CallStatus = "offer" CallStatusAccept CallStatus = "accept" CallStatusPreAccept CallStatus = "pre-accept" CallStatusTransport CallStatus = "transport" CallStatusTerminate CallStatus = "terminate" CallStatusReject CallStatus = "reject" CallMediaAudio CallMedia = "audio" CallMediaVideo CallMedia = "video" CallTypeGroup CallType = "group" )
View Source
const ( MessageStatusSent MessageStatus = "sent" MessageStatusDelivered MessageStatus = "delivered" MessageStatusRead MessageStatus = "read" MessageStatusServerError MessageStatus = "server-error" CallLogOutcomeConnected CallLogOutcome = "connected" CallLogOutcomeMissed CallLogOutcome = "missed" CallLogOutcomeFailed CallLogOutcome = "failed" CallLogOutcomeRejected CallLogOutcome = "rejected" CallLogOutcomeAccepted CallLogOutcome = "accepted" CallLogOutcomeOngoing CallLogOutcome = "ongoing" CallLogOutcomeSilenced CallLogOutcome = "silenced" CallLogTypeRegular CallLogType = "regular" CallLogTypeScheduled CallLogType = "scheduled" CallLogTypeVoiceChat CallLogType = "voice-chat" )
Variables ¶
View Source
var ErrAlreadyConnected = errors.New("already connected")
Functions ¶
This section is empty.
Types ¶
type Call ¶
type Call struct {
Timestamp time.Time
CallID string `json:",omitempty"`
From string `json:",omitempty"`
CallCreator string `json:",omitempty"`
Status CallStatus `json:",omitempty"` // use CallStatus* constants
Media *CallMedia `json:",omitempty"` // use CallMedia* constants, not always set
Type *CallType `json:",omitempty"` // use CallType* constants, not always set
TerminateReaason *string `json:",omitempty"`
}
type CallLogOutcome ¶
type CallLogOutcome string
type CallLogType ¶
type CallLogType string
type CallStatus ¶
type CallStatus string
type ConnStatus ¶
type ConnStatus string
const ( ConnStatusConnected ConnStatus = "connected" ConnStatusDisconnected ConnStatus = "disconnected" ConnStatusQRCodeScan ConnStatus = "qr code scan" ConnStatusLoggedOut ConnStatus = "logged out" ConnStatusError ConnStatus = "error" )
type Connection ¶
type Connection struct {
Number string
DBPath string
MediaPath string
Log Logger
Callbacks Callbacks
// contains filtered or unexported fields
}
func (*Connection) Disconnect ¶
func (conn *Connection) Disconnect()
func (*Connection) IsConnected ¶
func (conn *Connection) IsConnected() bool
func (*Connection) IsLoggedIn ¶
func (conn *Connection) IsLoggedIn() bool
func (*Connection) SendEdit ¶
func (conn *Connection) SendEdit(message Message) error
func (*Connection) SendMessage ¶
func (conn *Connection) SendMessage(message Message, sendOnCallback bool) (Message, error)
func (*Connection) SendPlayed ¶
func (*Connection) SendRead ¶
func (conn *Connection) SendRead(messageIDs []string, when time.Time, chatJID string, senderJID string, receiptTypeExtra ...types.ReceiptType) error
func (*Connection) SyncAllContacts ¶
func (conn *Connection) SyncAllContacts() error
type Contact ¶
type Contact struct {
Timestamp *time.Time `json:",omitempty"` // not always set
JID string `json:",omitempty"`
PushName *string `json:",omitempty"` // not always set
ContactName *string `json:",omitempty"` // not always set
DisplayName *string `json:",omitempty"` // not always set
Username *string `json:",omitempty"` // not always set
ProfilePhoto *string `json:",omitempty"` // not always set
Pinned *bool `json:",omitempty"` // not always set
Muted *bool `json:",omitempty"` // not always set
MuteEndTimestamp *int64 `json:",omitempty"` // not always set
StatusMuted *bool `json:",omitempty"` // not always set
Archived *bool `json:",omitempty"` // not always set
Available *bool `json:",omitempty"` // not always set
LastSeen *time.Time `json:",omitempty"` // not always set
Typing *string `json:",omitempty"` // the JID who is typing, not always set
Recording *string `json:",omitempty"` // the JID who is recording, not always set
IsGroup *bool `json:",omitempty"` // not always set
Group
}
type Group ¶
type Group struct {
GroupName *string `json:",omitempty"` // not always set
GroupTopic *string `json:",omitempty"` // not always set
GroupInfoLockedToAdmins *bool `json:",omitempty"` // not always set
GroupOnlyAdminCanMessage *bool `json:",omitempty"` // not always set
GroupOnlyAdminsCanAddMembers *bool `json:",omitempty"` // not always set
GroupIsParent *bool `json:",omitempty"` // not always set
GroupLinkedParentJID *string `json:",omitempty"` // not always set
GroupIsDefaultSubGroup *bool `json:",omitempty"` // not always set
GroupJoinApprovalRequired *bool `json:",omitempty"` // not always set
GroupCreated *time.Time `json:",omitempty"` // not always set
GroupReplaceParticipants []GroupParticipant `json:",omitempty"` // replace all existing participants with these, not always set
GroupAddParticipants []GroupParticipant `json:",omitempty"` // add to existing participants, not always set
GroupRemovedParticipants []GroupParticipant `json:",omitempty"` // remove from existing participants, not always set
GroupInviteLink *string `json:",omitempty"` // not always set
}
type GroupParticipant ¶
type GroupParticipant struct {
UserJID string
Rank GroupParticipantRank
}
type GroupParticipantRank ¶
type GroupParticipantRank string
const ( GroupParticipantRankRegular GroupParticipantRank = "regular" GroupParticipantRankAdmin GroupParticipantRank = "admin" GroupParticipantRankSuperAdmin GroupParticipantRank = "superadmin" )
type Message ¶
type Message struct {
Timestamp *time.Time `json:",omitempty"`
MessageID string `json:",omitempty"`
ChatJID string `json:",omitempty"`
SenderJID *string `json:",omitempty"`
IsFromMe *bool `json:",omitempty"`
Type *string `json:",omitempty"` // not always set
Status *MessageStatus `json:",omitempty"` // use MessageStatus* constants, not always set
Starred *bool `json:",omitempty"` // not always set
Deleted *bool `json:",omitempty"` // not always set
Edited *bool `json:",omitempty"` // not always set
ContentBody *string `json:",omitempty"` // not always set
InfoQuotedMessageID *string `json:",omitempty"` // not always set
InfoParticipant *string `json:",omitempty"` // not always set
InfoRemoteJID *string `json:",omitempty"` // not always set
Attachments []string `json:",omitempty"` // not always set
ContactVcard *string `json:",omitempty"` // not always set
ContactDisplayName *string `json:",omitempty"` // not always set
LocationLat *float64 `json:",omitempty"` // not always set
LocationLon *float64 `json:",omitempty"` // not always set
LocationName *string `json:",omitempty"` // not always set
LocationAddress *string `json:",omitempty"` // not always set
LocationURL *string `json:",omitempty"` // not always set
LocationIsLive *bool `json:",omitempty"` // not always set
LocationAccuracyInMeters *uint32 `json:",omitempty"` // not always set
LocationComment *string `json:",omitempty"` // not always set
CallLogOutcome *CallLogOutcome `json:",omitempty"` // use CallLogOutcome* constants, not always set
CallLogDurationSeconds *int64 `json:",omitempty"` // not always set
CallLogType *CallLogType `json:",omitempty"` // use CallLogType* constants, not always set
CallLogParticipantJIDs []string `json:",omitempty"` // they have their own call outcomes that are not recorded, not always set
Raw any `json:",omitempty"`
}
type MessageStatus ¶
type MessageStatus string
Click to show internal directories.
Click to hide internal directories.