Documentation
¶
Index ¶
- Constants
- Variables
- func ValidApproval(mode string) bool
- type Account
- type AuthCode
- type Bearer
- type Chat
- type ChatCursor
- type ChatQuery
- type ContactCard
- type Details
- type ExpiredBatch
- type Grant
- type GrantChange
- type Location
- type Media
- type MediaFailure
- type MediaFile
- type MediaRef
- type Message
- type MessageBound
- type MessageQuery
- type NewAccount
- type NewGrant
- type OAuthClient
- type PhoneInUseError
- type Poll
- type Reaction
- type ReusedError
- type SearchPosition
- type SearchQuery
- type Store
- func (s *Store) Account(ctx context.Context, id int64) (Account, error)
- func (s *Store) AccountByName(ctx context.Context, name string) (Account, error)
- func (s *Store) ActiveGrant(ctx context.Context, id int64) (Grant, error)
- func (s *Store) ChangeGrant(ctx context.Context, c GrantChange) (Grant, error)
- func (s *Store) Chat(ctx context.Context, accountID int64, jid string) (Chat, error)
- func (s *Store) Close() error
- func (s *Store) CountMessages(ctx context.Context, accountID int64) (int64, error)
- func (s *Store) CreateAccount(ctx context.Context, n NewAccount) (Account, error)
- func (s *Store) CreateAuthCode(ctx context.Context, c AuthCode) error
- func (s *Store) CreateGrant(ctx context.Context, n NewGrant) (Grant, error)
- func (s *Store) CreateOAuthClient(ctx context.Context, c OAuthClient) error
- func (s *Store) DeleteAccount(ctx context.Context, id int64) error
- func (s *Store) DeleteMessagesBefore(ctx context.Context, accountID int64, before time.Time, ...) (ExpiredBatch, error)
- func (s *Store) DeleteUnfinishedPairings(ctx context.Context) error
- func (s *Store) DueMedia(ctx context.Context, now time.Time, limit int) ([]MediaFile, error)
- func (s *Store) EditMessage(ctx context.Context, accountID int64, chatJID, id, senderJID, text string, ...) error
- func (s *Store) ForgetUnusedOAuthClients(ctx context.Context, registeredBefore, now time.Time) error
- func (s *Store) Grant(ctx context.Context, id int64) (Grant, error)
- func (s *Store) GrantAccounts(ctx context.Context, g Grant) ([]Account, error)
- func (s *Store) GrantByName(ctx context.Context, name string) (Grant, error)
- func (s *Store) GrantForBearer(ctx context.Context, hash string, now time.Time) (Bearer, error)
- func (s *Store) HasMessages(ctx context.Context, accountID int64, chatJID string, q MessageQuery) (bool, error)
- func (s *Store) InsertToken(ctx context.Context, t Token) error
- func (s *Store) ListAccounts(ctx context.Context) ([]Account, error)
- func (s *Store) ListChats(ctx context.Context, accountID int64, q ChatQuery) ([]Chat, error)
- func (s *Store) ListGrants(ctx context.Context) ([]Grant, error)
- func (s *Store) MarkChatReadUntil(ctx context.Context, accountID int64, jid string, readAt time.Time) error
- func (s *Store) MediaFile(ctx context.Context, ref MediaRef) (MediaFile, error)
- func (s *Store) MediaFileByPath(ctx context.Context, path string) (MediaFile, error)
- func (s *Store) MergeIdentity(ctx context.Context, accountID int64, lid, phone string) error
- func (s *Store) Message(ctx context.Context, accountID int64, chatJID, id string) (Message, error)
- func (s *Store) Messages(ctx context.Context, accountID int64, chatJID string, q MessageQuery) ([]Message, error)
- func (s *Store) OAuthClient(ctx context.Context, id string) (OAuthClient, error)
- func (s *Store) OldestMessage(ctx context.Context, accountID int64, chatJID string) (Message, error)
- func (s *Store) React(ctx context.Context, accountID int64, r Reaction) error
- func (s *Store) RedeemAuthCode(ctx context.Context, hash string, now time.Time, ...) (Grant, error)
- func (s *Store) RetryFailedMediaNow(ctx context.Context, accountID int64, now time.Time) error
- func (s *Store) RevokeGrant(ctx context.Context, name string, at time.Time) (Grant, error)
- func (s *Store) RevokeGrantOfToken(ctx context.Context, hash string, at time.Time, allowed func(Grant) bool) (Grant, error)
- func (s *Store) RevokeMessage(ctx context.Context, accountID int64, chatJID, id, senderJID string, ...) error
- func (s *Store) RotateRefreshToken(ctx context.Context, hash string, now time.Time, ...) (Grant, error)
- func (s *Store) SaveChat(ctx context.Context, accountID int64, chat Chat) error
- func (s *Store) SaveHistoryMessage(ctx context.Context, accountID int64, chat Chat, msg Message) error
- func (s *Store) SaveMessage(ctx context.Context, accountID int64, chat Chat, msg Message) error
- func (s *Store) SearchMessages(ctx context.Context, accountID int64, q SearchQuery) ([]Message, error)
- func (s *Store) SetAccountDescription(ctx context.Context, name, description string) (Account, error)
- func (s *Store) SetAccountLoggedOut(ctx context.Context, id int64) error
- func (s *Store) SetAccountPaired(ctx context.Context, id int64, jid, phone string) error
- func (s *Store) SetAccountProfileName(ctx context.Context, id int64, name string) error
- func (s *Store) SetAccountRetention(ctx context.Context, name string, months int) (Account, error)
- func (s *Store) SetAccountState(ctx context.Context, id int64, state string) error
- func (s *Store) SetChatName(ctx context.Context, accountID int64, jid, name string) error
- func (s *Store) SetMediaDownloaded(ctx context.Context, ref MediaRef, path string) (bool, error)
- func (s *Store) SetMediaFailed(ctx context.Context, ref MediaRef, failure MediaFailure) error
- func (s *Store) SetUnreadCount(ctx context.Context, accountID int64, jid string, count int) error
- func (s *Store) SpendApproval(ctx context.Context, nonce string, expires, now time.Time) (bool, error)
- type Token
- type UnknownAccountError
Constants ¶
View Source
const ( AccountPairing = "pairing" AccountConnected = "connected" AccountDisconnected = "disconnected" AccountLoggedOut = "logged_out" )
View Source
const ( ChatDirect = "direct" ChatGroup = "group" )
View Source
const ( GrantStatic = "static" GrantOAuth = "oauth" )
View Source
const ( ApprovalElicitation = "elicitation" ApprovalApp = "app" )
View Source
const ( MediaPending = "pending" MediaDownloaded = "downloaded" MediaFailed = "failed" )
View Source
const ( MessageImage = "image" MessageVideo = "video" MessageAudio = "audio" MessageDocument = "document" MessageSticker = "sticker" MessageLocation = "location" MessageContact = "contact" MessagePoll = "poll" )
View Source
const ( TokenStatic = "static" TokenAccess = "access" TokenRefresh = "refresh" )
View Source
const MessageText = "text"
View Source
const RetentionBatch = 1000
Variables ¶
Functions ¶
func ValidApproval ¶
Types ¶
type ChatCursor ¶
type ChatQuery ¶
type ChatQuery struct {
UnreadOnly bool
Match func(Chat) bool
After *ChatCursor
Limit int
}
type ContactCard ¶
type Details ¶
type Details struct {
Poll *Poll `json:"poll,omitempty"`
Location *Location `json:"location,omitempty"`
Contacts []ContactCard `json:"contacts,omitempty"`
}
type ExpiredBatch ¶
type Grant ¶
type GrantChange ¶
type MediaFailure ¶
type MessageBound ¶
type MessageQuery ¶
type MessageQuery struct {
Before *MessageBound
After *MessageBound
Limit int
}
type NewAccount ¶
type OAuthClient ¶
type PhoneInUseError ¶
func (*PhoneInUseError) Error ¶
func (e *PhoneInUseError) Error() string
type ReusedError ¶
type ReusedError struct {
Grant Grant
}
func (*ReusedError) Error ¶
func (e *ReusedError) Error() string
type SearchQuery ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) AccountByName ¶
func (*Store) ActiveGrant ¶
func (*Store) ChangeGrant ¶
func (*Store) CountMessages ¶
func (*Store) CreateAccount ¶
func (*Store) CreateAuthCode ¶
func (*Store) CreateGrant ¶
func (*Store) CreateOAuthClient ¶
func (s *Store) CreateOAuthClient(ctx context.Context, c OAuthClient) error
func (*Store) DeleteMessagesBefore ¶
func (*Store) DeleteUnfinishedPairings ¶
func (*Store) EditMessage ¶
func (*Store) ForgetUnusedOAuthClients ¶
func (*Store) GrantAccounts ¶
func (*Store) GrantByName ¶
func (*Store) GrantForBearer ¶
func (*Store) HasMessages ¶
func (*Store) MarkChatReadUntil ¶
func (*Store) MediaFileByPath ¶
func (*Store) MergeIdentity ¶
func (*Store) OAuthClient ¶
func (*Store) OldestMessage ¶
func (*Store) RedeemAuthCode ¶
func (*Store) RetryFailedMediaNow ¶
func (*Store) RevokeGrant ¶
func (*Store) RevokeGrantOfToken ¶
func (*Store) RevokeMessage ¶
func (*Store) RotateRefreshToken ¶
func (*Store) SaveHistoryMessage ¶
func (*Store) SaveMessage ¶
func (*Store) SearchMessages ¶
func (*Store) SetAccountDescription ¶
func (*Store) SetAccountLoggedOut ¶
func (*Store) SetAccountPaired ¶
func (*Store) SetAccountProfileName ¶
func (*Store) SetAccountRetention ¶
func (*Store) SetAccountState ¶
func (*Store) SetChatName ¶
func (*Store) SetMediaDownloaded ¶
func (*Store) SetMediaFailed ¶
func (*Store) SetUnreadCount ¶
type UnknownAccountError ¶
type UnknownAccountError struct {
Name string
}
func (*UnknownAccountError) Error ¶
func (e *UnknownAccountError) Error() string
func (*UnknownAccountError) Is ¶
func (e *UnknownAccountError) Is(target error) bool
Click to show internal directories.
Click to hide internal directories.