Documentation
¶
Index ¶
- type ChatService
- func (s *ChatService) CreateRoom(ctx context.Context, name string, password *string) (*models.Room, error)
- func (s *ChatService) GetAllUsers(ctx context.Context) ([]models.User, error)
- func (s *ChatService) GetMessages(ctx context.Context, room string, params MessageQueryParams) ([]models.Message, error)
- func (s *ChatService) GetRooms(ctx context.Context) ([]models.Room, error)
- func (s *ChatService) GetUser(ctx context.Context, publicKey string) (*models.User, error)
- func (s *ChatService) GetUserByPublicKey(ctx context.Context, publicKey string) (*models.User, error)
- func (s *ChatService) GetUserWithPostCount(ctx context.Context, publicKey string) (*models.UserWithPostCount, error)
- func (s *ChatService) RegisterUser(ctx context.Context, publicKey string) (*models.User, error)
- func (s *ChatService) SearchRooms(ctx context.Context, query string) ([]models.Room, error)
- func (s *ChatService) SendMessage(ctx context.Context, room, user, content, signature, pubkey string, ...) (*models.Message, error)
- func (s *ChatService) UnverifyUser(ctx context.Context, publicKey string) error
- func (s *ChatService) ValidateRoomPassword(ctx context.Context, roomName, password string) error
- func (s *ChatService) VerifyUser(ctx context.Context, publicKey string) error
- type MessageQueryParams
- type Repository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatService ¶
type ChatService struct {
// contains filtered or unexported fields
}
func NewChatService ¶
func NewChatService(repo Repository) *ChatService
func (*ChatService) CreateRoom ¶
func (*ChatService) GetAllUsers ¶
func (*ChatService) GetMessages ¶
func (s *ChatService) GetMessages(ctx context.Context, room string, params MessageQueryParams) ([]models.Message, error)
func (*ChatService) GetUserByPublicKey ¶
func (*ChatService) GetUserWithPostCount ¶
func (s *ChatService) GetUserWithPostCount(ctx context.Context, publicKey string) (*models.UserWithPostCount, error)
func (*ChatService) RegisterUser ¶
func (*ChatService) SearchRooms ¶
func (*ChatService) SendMessage ¶
func (*ChatService) UnverifyUser ¶
func (s *ChatService) UnverifyUser(ctx context.Context, publicKey string) error
func (*ChatService) ValidateRoomPassword ¶
func (s *ChatService) ValidateRoomPassword(ctx context.Context, roomName, password string) error
func (*ChatService) VerifyUser ¶
func (s *ChatService) VerifyUser(ctx context.Context, publicKey string) error
type MessageQueryParams ¶
MessageQueryParams controls pagination for GetMessages. Zero values apply defaults: Limit=50, Before=now.
type Repository ¶
type Repository interface {
SaveMessage(ctx context.Context, room, user, content, signature, pubkey string, timestamp int64) (*models.Message, error)
GetMessages(ctx context.Context, room string, params MessageQueryParams) ([]models.Message, error)
GetRooms(ctx context.Context) ([]models.Room, error)
SearchRooms(ctx context.Context, query string) ([]models.Room, error)
CreateRoom(ctx context.Context, name string, password *string) (*models.Room, error)
ValidateRoomPassword(ctx context.Context, roomName, password string) error
// User management
RegisterUser(ctx context.Context, publicKey string) (*models.User, error)
GetUser(ctx context.Context, publicKey string) (*models.User, error)
GetUserByPublicKey(ctx context.Context, publicKey string) (*models.User, error)
GetUserWithPostCount(ctx context.Context, publicKey string) (*models.UserWithPostCount, error)
GetAllUsers(ctx context.Context) ([]models.User, error)
VerifyUser(ctx context.Context, publicKey string) error
UnverifyUser(ctx context.Context, publicKey string) error
}
Click to show internal directories.
Click to hide internal directories.