mmapi

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDMWith

func IsDMWith(userID string, channel *model.Channel) bool

func IsKVNotFound added in v1.9.0

func IsKVNotFound(err error) bool

IsKVNotFound returns true if the error represents a KV key not found condition. The pluginapi returns ErrNotFound (with message "not found") for 404 status codes, and test mocks use the same error message convention.

Types

type Client

type Client interface {
	GetUser(userID string) (*model.User, error)
	GetPost(postID string) (*model.Post, error)
	AddReaction(*model.Reaction) error
	GetPostThread(postID string) (*model.PostList, error)
	GetPostsSince(channelID string, since int64) (*model.PostList, error)
	GetPostsBefore(channelID, postID string, page, perPage int) (*model.PostList, error)
	CreatePost(post *model.Post) error
	UpdatePost(post *model.Post) error
	DM(senderID, receiverID string, post *model.Post) error
	GetTeam(teamID string) (*model.Team, error)
	GetChannel(channelID string) (*model.Channel, error)
	GetDirectChannel(userID1, userID2 string) (*model.Channel, error)
	PublishWebSocketEvent(event string, payload map[string]interface{}, broadcast *model.WebsocketBroadcast)
	GetConfig() *model.Config
	LogError(msg string, keyValuePairs ...interface{})
	LogWarn(msg string, keyValuePairs ...interface{})
	KVGet(key string, value interface{}) error
	KVSet(key string, value interface{}) error
	KVSetWithExpiry(key string, value interface{}, ttl time.Duration) error
	KVDelete(key string) error
	GetUserByUsername(username string) (*model.User, error)
	GetUserStatus(userID string) (*model.Status, error)
	HasPermissionTo(userID string, permission *model.Permission) bool
	GetPluginStatus(pluginID string) (*model.PluginStatus, error)
	PluginHTTP(req *http.Request) *http.Response
	LogDebug(msg string, keyValuePairs ...interface{})
	GetChannelByName(teamID, name string, includeDeleted bool) (*model.Channel, error)
	HasPermissionToChannel(userID, channelID string, permission *model.Permission) bool
	GetFileInfo(fileID string) (*model.FileInfo, error)
	GetFile(fileID string) (io.ReadCloser, error)
	SendEphemeralPost(userID string, post *model.Post)
}

func NewClient

func NewClient(pluginAPI *pluginapi.Client) Client

type DBClient

type DBClient struct {
	*sqlx.DB
	// contains filtered or unexported fields
}

func NewDBClient

func NewDBClient(pluginAPI *pluginapi.Client) *DBClient

NewDBClient creates the DB part of the client, only supported on postgres, panics on failures.

func (*DBClient) Builder

func (db *DBClient) Builder() sq.StatementBuilderType

func (*DBClient) DoQuery

func (db *DBClient) DoQuery(dest any, b builder) error

func (*DBClient) ExecBuilder

func (db *DBClient) ExecBuilder(b builder) (sql.Result, error)

func (*DBClient) GetFirstPostBeforeTimeRangeID

func (c *DBClient) GetFirstPostBeforeTimeRangeID(channelID string, startTime, endTime int64) (string, error)

type ThreadData

type ThreadData struct {
	Posts     []*model.Post
	UsersByID map[string]*model.User
}

func GetMetadataForPosts

func GetMetadataForPosts(client Client, posts *model.PostList) (*ThreadData, error)

func GetThreadData

func GetThreadData(client Client, postID string) (*ThreadData, error)

func (*ThreadData) CutoffBeforePostID

func (t *ThreadData) CutoffBeforePostID(postID string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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