Documentation
¶
Overview ¶
Package beeper provides read-only access to Beeper's local SQLite data.
Index ¶
- func ResolveMessageText(rawMessage string, msgType string, textContent string, format MessageFormat) string
- type BridgeLookup
- type Message
- type MessageFormat
- type MessageListOptions
- type Participant
- type SearchOptions
- type SearchResult
- type Store
- func (s *Store) BridgeDBs() []string
- func (s *Store) Close() error
- func (s *Store) GetThread(ctx context.Context, threadID string, withStats bool) (Thread, error)
- func (s *Store) HasFTS(ctx context.Context) (bool, error)
- func (s *Store) ListMessages(ctx context.Context, opts MessageListOptions) ([]Message, error)
- func (s *Store) ListThreads(ctx context.Context, opts ThreadListOptions) ([]Thread, error)
- func (s *Store) SearchMessages(ctx context.Context, opts SearchOptions) ([]SearchResult, error)
- type StoreOptions
- type Thread
- type ThreadLabel
- type ThreadListOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolveMessageText ¶
func ResolveMessageText(rawMessage string, msgType string, textContent string, format MessageFormat) string
ResolveMessageText produces a display string based on the chosen format.
Types ¶
type BridgeLookup ¶
type BridgeLookup struct {
// contains filtered or unexported fields
}
BridgeLookup resolves DM names via platform bridge databases.
func NewBridgeLookup ¶
func NewBridgeLookup(indexDBPath string, overrideRoot string) (*BridgeLookup, error)
NewBridgeLookup discovers megabridge.db files under the Beeper support directory.
func (*BridgeLookup) LookupDMName ¶
func (b *BridgeLookup) LookupDMName(ctx context.Context, roomID string, accountID string) (string, bool, error)
LookupDMName attempts to resolve a DM name for the given room ID.
func (*BridgeLookup) Paths ¶
func (b *BridgeLookup) Paths() []string
Paths returns bridge database paths discovered for the current user.
type Message ¶
type Message struct {
ID int64 `json:"id"`
EventID string `json:"eventId"`
ThreadID string `json:"threadId"`
ThreadName string `json:"threadName,omitempty"`
AccountID string `json:"accountId,omitempty"`
SenderID string `json:"senderId"`
SenderName string `json:"senderName,omitempty"`
Timestamp time.Time `json:"timestamp"`
IsSentByMe bool `json:"isSentByMe"`
Type string `json:"type"`
Text string `json:"text"`
Score float64 `json:"score,omitempty"`
}
Message represents a message row from Beeper's store.
type MessageFormat ¶
type MessageFormat string
MessageFormat controls how message text is rendered.
const ( // FormatPlain returns the raw/plain text only. FormatPlain MessageFormat = "plain" // FormatRich renders attachments and non-text messages with placeholders. FormatRich MessageFormat = "rich" )
type MessageListOptions ¶
type MessageListOptions struct {
ThreadID string
Limit int
After *time.Time
Before *time.Time
Format MessageFormat
}
MessageListOptions controls message list filtering.
type Participant ¶
type Participant struct {
ID string `json:"id"`
Name string `json:"name"`
IsSelf bool `json:"isSelf"`
}
Participant represents a user in a thread.
type SearchOptions ¶
type SearchOptions struct {
Query string
ThreadID string
Days int
Limit int
AccountID string
Context int
Window time.Duration
Format MessageFormat
}
SearchOptions controls full-text search behavior.
type SearchResult ¶
type SearchResult struct {
Match Message `json:"match"`
Context []Message `json:"context,omitempty"`
}
SearchResult is a match plus optional surrounding context.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store provides read-only access to Beeper's SQLite database.
func OpenWithOptions ¶
func OpenWithOptions(path string, opts StoreOptions) (*Store, error)
OpenWithOptions opens a read-only store with the provided options.
func (*Store) ListMessages ¶
ListMessages returns messages for a thread.
func (*Store) ListThreads ¶
ListThreads returns threads filtered by the provided options.
func (*Store) SearchMessages ¶
func (s *Store) SearchMessages(ctx context.Context, opts SearchOptions) ([]SearchResult, error)
SearchMessages searches messages using FTS (or LIKE fallback).
type StoreOptions ¶
StoreOptions configures Store behavior.
type Thread ¶
type Thread struct {
ID string `json:"id"`
AccountID string `json:"accountId"`
Title string `json:"title,omitempty"`
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
DisplayName string `json:"displayName"`
LastActivity time.Time `json:"lastActivity"`
LastMessage time.Time `json:"lastMessageTime,omitempty"`
LastOpen time.Time `json:"lastOpenTime,omitempty"`
IsUnread bool `json:"isUnread"`
IsMarkedUnread bool `json:"isMarkedUnread"`
IsLowPriority bool `json:"isLowPriority"`
IsArchived bool `json:"isArchived"`
UnreadCount int `json:"unreadCount,omitempty"`
UnreadMentions int `json:"unreadMentions,omitempty"`
TotalMessages int `json:"totalMessages,omitempty"`
Tags []string `json:"tags,omitempty"`
Participants []Participant `json:"participants,omitempty"`
}
Thread describes a conversation.
type ThreadLabel ¶
type ThreadLabel string
ThreadLabel filters conversation lists.
const ( // LabelAll returns all threads. LabelAll ThreadLabel = "all" // LabelInbox returns inbox threads. LabelInbox ThreadLabel = "inbox" // LabelArchive returns archived threads. LabelArchive ThreadLabel = "archive" // LabelFavourite returns favourite threads. LabelFavourite ThreadLabel = "favourite" // LabelUnread returns threads with unread messages. LabelUnread ThreadLabel = "unread" )
type ThreadListOptions ¶
type ThreadListOptions struct {
Days int
Limit int
AccountID string
Label ThreadLabel
IncludeLowPriority bool
WithParticipants bool
WithStats bool
}
ThreadListOptions controls thread list filtering.