chat

package
v0.0.0-...-4c36365 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const SubjChats = "chats"

Variables

View Source
var (
	ErrInvalidValidation = errors.New("failed to validate arguments")

	ErrCreateChat                 = errors.New("unable to create chat")
	ErrNotFound                   = errors.New("not found")
	ErrGetUserChats               = errors.New("failed to get user chats")
	ErrChatAlreadyExists          = errors.New("chat already exists")
	ErrUnableToAddChatToUsersList = errors.New("unable to add add chat to users list")
	ErrUserJoinedBefore           = errors.New("user already is a member of the chat")
	ErrJoinDirectChat             = errors.New("joining direct chat is not possible")
	ErrRecipientNotFound          = errors.New("recipient not found")
	ErrMessageStoreCreation       = errors.New("failed to create message store for chat")
)

Functions

This section is empty.

Types

type ChatService

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

func NewChatService

func NewChatService(logger *log.SubLogger, chatRepo repository.ChatRepository, userRepo repository.UserRepository, messageRepo repository.MessageRepository, eventPublisher stream.StreamPublisher) *ChatService

func (*ChatService) CreateChannel

func (s *ChatService) CreateChannel(ctx context.Context, userID model.UserID, title string, username string, description string) (*model.ChatDTO, *vali.Varror)

func (*ChatService) CreateDirect

func (s *ChatService) CreateDirect(ctx context.Context, userID model.UserID, recipientUserID model.UserID) (*model.ChatDTO, *vali.Varror)

func (*ChatService) CreateGroup

func (s *ChatService) CreateGroup(ctx context.Context, userID model.UserID, title string, username string, description string) (*model.ChatDTO, *vali.Varror)

func (*ChatService) GetChat

func (s *ChatService) GetChat(ctx context.Context, userID model.UserID, chatID model.ChatID) (*model.Chat, *vali.Varror)

find single chat with chat id

func (*ChatService) GetDirectChat

func (s *ChatService) GetDirectChat(ctx context.Context, userID, recipientUserID model.UserID) (*model.ChatDTO, *vali.Varror)

func (*ChatService) GetUserChats

func (s *ChatService) GetUserChats(ctx context.Context, userID model.UserID) ([]model.ChatDTO, *vali.Varror)

get the chats that belongs to user

func (*ChatService) JoinChat

func (s *ChatService) JoinChat(ctx context.Context, chatID model.ChatID, userID model.UserID) (*JoinChatResult, *vali.Varror)

type JoinChatResult

type JoinChatResult struct {
	Joined      bool
	UpdatedChat *model.ChatDTO
}

Jump to

Keyboard shortcuts

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