chatservice

package
v0.0.0-...-a992749 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateBody

type CreateBody struct {
	chat.Message
	Id        struct{} `json:"-"`
	Timestamp struct{} `json:"-"`
}

type MessagesPage

type MessagesPage struct {
	ChatId   string             `json:"chatId"`
	Total    int                `json:"total"`
	Page     int                `json:"page"`
	Limit    int                `json:"limit"`
	Messages []*PreparedMessage `json:"messages"`
}

type PreparedMessage

type PreparedMessage struct {
	Id          string       `json:"id"`
	ChatId      string       `json:"chatId,omitempty"`
	SenderId    string       `json:"senderId"`
	Body        string       `json:"body"`
	Attachments []*file.File `json:"attachments,omitempty"`
	Timestamp   int64        `json:"timestamp"`
}

type Service

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

func New

func (*Service) AddMessage

func (ms *Service) AddMessage(body *CreateBody) (*PreparedMessage, error)

func (*Service) CheckChatAccess

func (s *Service) CheckChatAccess(chatId, botId, userId string) (*chat.Chat, error)

func (*Service) CreateChat

func (s *Service) CreateChat(userId string, botId string) (*chat.Chat, error)

func (*Service) DeleteChat

func (s *Service) DeleteChat(id string) error

func (*Service) DeleteMessagesByChat

func (ms *Service) DeleteMessagesByChat(chatId string) error

func (*Service) GetChat

func (s *Service) GetChat(id string) (*chat.Chat, error)

func (*Service) GetChats

func (s *Service) GetChats(userId string, botId string) ([]*chat.Chat, error)

func (*Service) GetMessage

func (s *Service) GetMessage(id string) (*chat.Message, error)

func (*Service) GetMessagesByChat

func (ms *Service) GetMessagesByChat(chatId, senderId string, page, limit int, since int64) (*MessagesPage, error)

Jump to

Keyboard shortcuts

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