messaging

package
v0.0.0-...-61c90a5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxMessageRunes = 4000
	DefaultPageSize = 100
)

Variables

View Source
var (
	ErrInvalidMessage   = errors.New("invalid message")
	ErrConversationGone = errors.New("conversation not found")
)

Functions

This section is empty.

Types

type Conversation

type Conversation struct {
	ID          string
	Participant Person
	LastMessage string
	LastAt      *time.Time
	UnreadCount int
	CreatedAt   time.Time
}

type Message

type Message struct {
	ID, ConversationID, SenderID, SenderName, Body string
	CreatedAt                                      time.Time
}

type Person

type Person struct {
	ID, Username, DisplayName, AvatarMediaID string
}

type Repository

type Repository interface {
	FamilyMembers(context.Context, string) ([]Person, error)
	CreateDirectConversation(context.Context, string, string, string, time.Time) (string, error)
	ConversationsForViewer(context.Context, string, int) ([]Conversation, error)
	ConversationForViewer(context.Context, string, string) (Conversation, error)
	MessagesForViewer(context.Context, string, string, int) ([]Message, error)
	CreateMessage(context.Context, Message) (Message, error)
	MarkConversationRead(context.Context, string, string, time.Time) error
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(repository Repository) *Service

func (*Service) Conversation

func (s *Service) Conversation(ctx context.Context, viewerID, conversationID string) (Conversation, []Message, error)

func (*Service) Conversations

func (s *Service) Conversations(ctx context.Context, viewerID string) ([]Conversation, error)

func (*Service) FamilyMembers

func (s *Service) FamilyMembers(ctx context.Context, viewerID string) ([]Person, error)

func (*Service) Send

func (s *Service) Send(ctx context.Context, viewerID, conversationID, body string) (Message, error)

func (*Service) StartDirect

func (s *Service) StartDirect(ctx context.Context, viewerID, recipientID string) (string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL