message

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package message provides CRUD operations for persisting daemon messages.

Plane: manager

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel string

Channel identifies how a message entered the daemon.

const (
	ChannelTelegram Channel = "telegram"
	ChannelMatrix   Channel = "matrix"
	ChannelGUI      Channel = "gui"
	ChannelCLI      Channel = "cli"
	ChannelWatcher  Channel = "watcher"
	ChannelAdapter  Channel = "adapter"
)

type Contact

type Contact struct {
	Name          string
	LastMessageAt time.Time
}

Contact is a summary of a conversation partner.

type CreateParams

type CreateParams struct {
	Sender    string
	Recipient string
	Content   string
	Team      string
	Channel   Channel
	Runtime   *runtime.Runtime // nil for human messages
}

CreateParams holds parameters for creating a message.

type Service

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

Service wraps the Ent client for message persistence operations.

func NewService

func NewService(client *ent.Client) *Service

NewService creates a new message Service.

func (*Service) AddAttachment

func (s *Service) AddAttachment(
	ctx context.Context, messageID uuid.UUID, filename, mimeType, path string, size int64,
) (*ent.Attachment, error)

AddAttachment attaches a file to a message.

func (*Service) AddReaction

func (s *Service) AddReaction(ctx context.Context, messageID uuid.UUID, emoji, from string) (*ent.Reaction, error)

AddReaction attaches an emoji reaction to a message.

func (*Service) Create

func (s *Service) Create(ctx context.Context, p CreateParams) (*ent.Message, error)

Create persists a new message.

func (*Service) ListAgentFeed

func (s *Service) ListAgentFeed(ctx context.Context, userName string, limit, offset int) ([]*ent.Message, error)

ListAgentFeed returns agent-to-agent messages (neither sent nor received by userName), newest first.

func (*Service) ListContacts

func (s *Service) ListContacts(ctx context.Context, userID string) ([]Contact, error)

ListContacts returns the conversation partners of a user, ordered by most recent message.

func (*Service) ListConversation

func (s *Service) ListConversation(
	ctx context.Context, userA, userB string, limit, offset int,
) ([]*ent.Message, error)

ListConversation returns messages between two users, newest first.

Jump to

Keyboard shortcuts

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