Documentation
¶
Index ¶
- Constants
- Variables
- func ValidApproval(mode string) bool
- type Account
- type AttemptFailure
- type AttemptOutcome
- type AuthCode
- type Bearer
- type Chat
- type ChatCursor
- type ChatQuery
- type ContactCard
- type Delivery
- type DeliverySummary
- type Details
- type Event
- 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 NewWebhook
- type OAuthClient
- type PhoneInUseError
- type Placement
- type Poll
- type Queue
- 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) ChangeWebhook(ctx context.Context, c WebhookChange) (Webhook, error)
- func (s *Store) Chat(ctx context.Context, accountID int64, jid string) (Chat, error)
- func (s *Store) ClaimDelivery(ctx context.Context, id int64, leaseUntil time.Time) (Delivery, 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) CreateWebhook(ctx context.Context, n NewWebhook) (Webhook, error)
- func (s *Store) DeleteAccount(ctx context.Context, id int64) error
- func (s *Store) DeleteDeliveriesSettledBefore(ctx context.Context, before time.Time) (int, error)
- func (s *Store) DeleteEventsBefore(ctx context.Context, before time.Time) (int, 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) DeleteWebhook(ctx context.Context, name string) (Webhook, error)
- func (s *Store) DeliveryEvents(ctx context.Context, d Delivery) ([]Event, error)
- func (s *Store) DueDeliveries(ctx context.Context, now time.Time, limit int) ([]Delivery, 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) EnableWebhook(ctx context.Context, name string) (Webhook, error)
- func (s *Store) EventsAfter(ctx context.Context, seq int64, limit int) ([]Event, 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) ListWebhooks(ctx context.Context) ([]Webhook, 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) NextDeliveryDue(ctx context.Context) (time.Time, bool, 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) QueueEvents(ctx context.Context, q Queue) error
- func (s *Store) React(ctx context.Context, accountID int64, r Reaction) error
- func (s *Store) RecordAttempt(ctx context.Context, id int64, a AttemptOutcome) error
- func (s *Store) RedeemAuthCode(ctx context.Context, hash string, now time.Time, ...) (Grant, error)
- func (s *Store) RedeliverFailed(ctx context.Context, webhookID int64, failedSince, dueAt time.Time) (int, 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) RotateWebhookSecret(ctx context.Context, name, secret string, previousSecretUntil time.Time) (Webhook, 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, at time.Time) 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, at time.Time) 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)
- func (s *Store) SummarizeDeliveries(ctx context.Context, webhookID int64) (DeliverySummary, error)
- func (s *Store) Webhook(ctx context.Context, id int64) (Webhook, error)
- func (s *Store) WebhookAccounts(ctx context.Context, w Webhook) ([]Account, error)
- func (s *Store) WebhookByName(ctx context.Context, name string) (Webhook, error)
- func (s *Store) WebhookChats(ctx context.Context, w Webhook) ([]WebhookChat, error)
- type Token
- type UnknownAccountError
- type Webhook
- type WebhookChange
- type WebhookChat
Constants ¶
View Source
const ( AccountPairing = "pairing" AccountConnected = "connected" AccountDisconnected = "disconnected" AccountLoggedOut = "logged_out" )
View Source
const ( ChatDirect = "direct" ChatGroup = "group" )
View Source
const ( DeliveryOpen = "open" DeliveryRetrying = "retrying" DeliveryDelivered = "delivered" DeliveryFailed = "failed" )
View Source
const ( EventMessageReceived = "message.received" EventAccountState = "account.state" )
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 AttemptFailure ¶ added in v0.2.0
func (AttemptFailure) Known ¶ added in v0.2.0
func (f AttemptFailure) Known() bool
type AttemptOutcome ¶ added in v0.2.0
type ChatCursor ¶
type ChatQuery ¶
type ChatQuery struct {
UnreadOnly bool
Match func(Chat) bool
After *ChatCursor
Limit int
}
type ContactCard ¶
type DeliverySummary ¶ added in v0.2.0
type DeliverySummary struct {
Pending int
Failed int
LastSuccess time.Time
LastFailure AttemptFailure
}
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 NewWebhook ¶ added in v0.2.0
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) ChangeWebhook ¶ added in v0.2.0
func (*Store) ClaimDelivery ¶ added in v0.2.0
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) CreateWebhook ¶ added in v0.2.0
func (*Store) DeleteDeliveriesSettledBefore ¶ added in v0.2.0
func (*Store) DeleteEventsBefore ¶ added in v0.2.0
func (*Store) DeleteMessagesBefore ¶
func (*Store) DeleteUnfinishedPairings ¶
func (*Store) DeleteWebhook ¶ added in v0.2.0
func (*Store) DeliveryEvents ¶ added in v0.2.0
func (*Store) DueDeliveries ¶ added in v0.2.0
func (*Store) EditMessage ¶
func (*Store) EnableWebhook ¶ added in v0.2.0
func (*Store) EventsAfter ¶ added in v0.2.0
func (*Store) ForgetUnusedOAuthClients ¶
func (*Store) GrantAccounts ¶
func (*Store) GrantByName ¶
func (*Store) GrantForBearer ¶
func (*Store) HasMessages ¶
func (*Store) ListWebhooks ¶ added in v0.2.0
func (*Store) MarkChatReadUntil ¶
func (*Store) MediaFileByPath ¶
func (*Store) MergeIdentity ¶
func (*Store) NextDeliveryDue ¶ added in v0.2.0
func (*Store) OAuthClient ¶
func (*Store) OldestMessage ¶
func (*Store) QueueEvents ¶ added in v0.2.0
func (*Store) RecordAttempt ¶ added in v0.2.0
func (*Store) RedeemAuthCode ¶
func (*Store) RedeliverFailed ¶ added in v0.2.0
func (*Store) RetryFailedMediaNow ¶
func (*Store) RevokeGrant ¶
func (*Store) RevokeGrantOfToken ¶
func (*Store) RevokeMessage ¶
func (*Store) RotateRefreshToken ¶
func (*Store) RotateWebhookSecret ¶ added in v0.2.0
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 ¶
func (*Store) SpendApproval ¶
func (*Store) SummarizeDeliveries ¶ added in v0.2.0
func (*Store) WebhookAccounts ¶ added in v0.2.0
func (*Store) WebhookByName ¶ added in v0.2.0
func (*Store) WebhookChats ¶ added in v0.2.0
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
type Webhook ¶ added in v0.2.0
type Webhook struct {
ID int64
Name string
URL string
Format string
Content string
Events []string
Chats string
Quiet time.Duration
MaxWait time.Duration
Secret string
PreviousSecret string
PreviousSecretUntil time.Time
Headers map[string]string
Cursor int64
CreatedAt time.Time
DisabledAt time.Time
}
type WebhookChange ¶ added in v0.2.0
type WebhookChat ¶ added in v0.2.0
Click to show internal directories.
Click to hide internal directories.