Documentation ¶
Overview ¶
Example ¶
package main import ( pluginapi "github.com/mattermost/mattermost-plugin-api" "github.com/mattermost/mattermost-server/v5/plugin" ) type Plugin struct { plugin.MattermostPlugin client *pluginapi.Client } func (p *Plugin) OnActivate() error { p.client = pluginapi.NewClient(p.API) return nil } func main() { }
Output:
Index ¶
- Variables
- func ConfigureLogrus(logger *logrus.Logger, client *Client)
- func IsE20LicensedOrDevelopment(config *model.Config, license *model.License) bool
- func IsEnterpriseLicensedOrDevelopment(config *model.Config, license *model.License) bool
- type BotListOption
- type BotService
- func (b *BotService) Create(bot *model.Bot) error
- func (b *BotService) DeleteIconImage(botUserID string) error
- func (b *BotService) DeletePermanently(botUserID string) error
- func (b *BotService) EnsureBot(bot *model.Bot, options ...EnsureBotOption) (retBotID string, retErr error)
- func (b *BotService) Get(botUserID string, includeDeleted bool) (*model.Bot, error)
- func (b *BotService) GetIconImage(botUserID string) (io.Reader, error)
- func (b *BotService) List(page, perPage int, options ...BotListOption) ([]*model.Bot, error)
- func (b *BotService) Patch(botUserID string, botPatch *model.BotPatch) (*model.Bot, error)
- func (b *BotService) SetIconImage(botUserID string, content io.Reader) error
- func (b *BotService) UpdateActive(botUserID string, isActive bool) (*model.Bot, error)
- type ChannelService
- func (c *ChannelService) AddMember(channelID, userID string) (*model.ChannelMember, error)
- func (c *ChannelService) AddUser(channelID, userID, asUserID string) (*model.ChannelMember, error)
- func (c *ChannelService) Create(channel *model.Channel) error
- func (c *ChannelService) Delete(channelID string) error
- func (c *ChannelService) DeleteMember(channelID, userID string) error
- func (c *ChannelService) Get(channelID string) (*model.Channel, error)
- func (c *ChannelService) GetByName(teamID, channelName string, includeDeleted bool) (*model.Channel, error)
- func (c *ChannelService) GetByNameForTeamName(teamName, channelName string, includeDeleted bool) (*model.Channel, error)
- func (c *ChannelService) GetChannelStats(channelID string) (*model.ChannelStats, error)
- func (c *ChannelService) GetDirect(userID1, userID2 string) (*model.Channel, error)
- func (c *ChannelService) GetGroup(userIDs []string) (*model.Channel, error)
- func (c *ChannelService) GetMember(channelID, userID string) (*model.ChannelMember, error)
- func (c *ChannelService) ListForTeamForUser(teamID, userID string, includeDeleted bool) ([]*model.Channel, error)
- func (c *ChannelService) ListMembers(channelID string, page, perPage int) ([]*model.ChannelMember, error)
- func (c *ChannelService) ListMembersByIDs(channelID string, userIDs []string) ([]*model.ChannelMember, error)
- func (c *ChannelService) ListMembersForUser(teamID, userID string, page, perPage int) ([]*model.ChannelMember, error)
- func (c *ChannelService) ListPublicChannelsForTeam(teamID string, page, perPage int) ([]*model.Channel, error)
- func (c *ChannelService) Search(teamID, term string) ([]*model.Channel, error)
- func (c *ChannelService) Update(channel *model.Channel) error
- func (c *ChannelService) UpdateChannelMemberNotifications(channelID, userID string, notifications map[string]string) (*model.ChannelMember, error)
- func (c *ChannelService) UpdateChannelMemberRoles(channelID, userID, newRoles string) (*model.ChannelMember, error)
- type Client
- type ConfigurationService
- func (c *ConfigurationService) GetConfig() *model.Config
- func (c *ConfigurationService) GetPluginConfig() map[string]interface{}
- func (c *ConfigurationService) GetUnsanitizedConfig() *model.Config
- func (c *ConfigurationService) LoadPluginConfiguration(dest interface{}) error
- func (c *ConfigurationService) SaveConfig(config *model.Config) error
- func (c *ConfigurationService) SavePluginConfig(config map[string]interface{}) error
- type EmojiService
- type EnsureBotOption
- type FileService
- func (f *FileService) CopyInfos(ids []string, userID string) ([]string, error)
- func (f *FileService) Get(id string) (io.Reader, error)
- func (f *FileService) GetByPath(path string) (io.Reader, error)
- func (f *FileService) GetInfo(id string) (*model.FileInfo, error)
- func (f *FileService) GetLink(id string) (string, error)
- func (f *FileService) Upload(content io.Reader, fileName, channelID string) (*model.FileInfo, error)
- type FrontendService
- type GroupService
- type KVService
- func (k *KVService) CompareAndDelete(key string, oldValue interface{}) (bool, error)deprecated
- func (k *KVService) CompareAndSet(key string, oldValue, value interface{}) (bool, error)deprecated
- func (k *KVService) Delete(key string) error
- func (k *KVService) DeleteAll() error
- func (k *KVService) Get(key string, o interface{}) error
- func (k *KVService) ListKeys(page, count int, options ...ListKeysOption) ([]string, error)
- func (k *KVService) Set(key string, value interface{}, options ...KVSetOption) (bool, error)
- func (k *KVService) SetAtomicWithRetries(key string, valueFunc func(oldValue []byte) (newValue interface{}, err error)) error
- func (k *KVService) SetWithExpiry(key string, value interface{}, ttl time.Duration) errordeprecated
- type KVSetOption
- type KVSetOptions
- type ListKeysOption
- type ListTeamsOptions
- type LogService
- type LogrusHook
- type MailService
- type PluginService
- func (p *PluginService) Disable(id string) error
- func (p *PluginService) Enable(id string) error
- func (p *PluginService) GetPluginStatus(id string) (*model.PluginStatus, error)
- func (p *PluginService) HTTP(request *http.Request) *http.Response
- func (p *PluginService) Install(file io.Reader, replace bool) (*model.Manifest, error)
- func (p *PluginService) List() ([]*model.Manifest, error)
- func (p *PluginService) Remove(id string) error
- type PostService
- func (p *PostService) AddReaction(reaction *model.Reaction) error
- func (p *PostService) CreatePost(post *model.Post) error
- func (p *PostService) DM(senderUserID, receiverUserID string, post *model.Post) error
- func (p *PostService) DeleteEphemeralPost(userID, postID string)
- func (p *PostService) DeletePost(postID string) error
- func (p *PostService) GetPost(postID string) (*model.Post, error)
- func (p *PostService) GetPostThread(postID string) (*model.PostList, error)
- func (p *PostService) GetPostsAfter(channelID, postID string, page, perPage int) (*model.PostList, error)
- func (p *PostService) GetPostsBefore(channelID, postID string, page, perPage int) (*model.PostList, error)
- func (p *PostService) GetPostsForChannel(channelID string, page, perPage int) (*model.PostList, error)
- func (p *PostService) GetPostsSince(channelID string, time int64) (*model.PostList, error)
- func (p *PostService) GetReactions(postID string) ([]*model.Reaction, error)
- func (p *PostService) RemoveReaction(reaction *model.Reaction) error
- func (p *PostService) SearchPostsInTeam(teamID string, paramsList []*model.SearchParams) ([]*model.Post, error)
- func (p *PostService) SendEphemeralPost(userID string, post *model.Post)
- func (p *PostService) UpdateEphemeralPost(userID string, post *model.Post)
- func (p *PostService) UpdatePost(post *model.Post) error
- type SessionService
- type SlashCommandService
- func (c *SlashCommandService) Create(command *model.Command) (*model.Command, error)
- func (c *SlashCommandService) Delete(commandID string) error
- func (c *SlashCommandService) Execute(command *model.CommandArgs) (*model.CommandResponse, error)
- func (c *SlashCommandService) Get(commandID string) (*model.Command, error)
- func (c *SlashCommandService) List(teamID string) ([]*model.Command, error)
- func (c *SlashCommandService) ListBuiltIn() ([]*model.Command, error)
- func (c *SlashCommandService) ListCustom(teamID string) ([]*model.Command, error)
- func (c *SlashCommandService) ListPlugin(teamID string) ([]*model.Command, error)
- func (c *SlashCommandService) Register(command *model.Command) error
- func (c *SlashCommandService) Unregister(teamID, trigger string) error
- func (c *SlashCommandService) Update(commandID string, updatedCmd *model.Command) (*model.Command, error)
- type StoreService
- type SystemService
- func (s *SystemService) GetBundlePath() (string, error)
- func (s *SystemService) GetDiagnosticID() string
- func (s *SystemService) GetLicense() *model.License
- func (s *SystemService) GetManifest() (*model.Manifest, error)
- func (s *SystemService) GetServerVersion() string
- func (s *SystemService) GetSystemInstallDate() (time.Time, error)
- type TeamListOption
- type TeamService
- func (t *TeamService) Create(team *model.Team) error
- func (t *TeamService) CreateMember(teamID, userID string) (*model.TeamMember, error)
- func (t *TeamService) CreateMembers(teamID string, userIDs []string, requestorID string) ([]*model.TeamMember, error)
- func (t *TeamService) Delete(teamID string) error
- func (t *TeamService) DeleteIcon(teamID string) error
- func (t *TeamService) DeleteMember(teamID, userID, requestorID string) error
- func (t *TeamService) Get(teamID string) (*model.Team, error)
- func (t *TeamService) GetByName(name string) (*model.Team, error)
- func (t *TeamService) GetIcon(teamID string) (io.Reader, error)
- func (t *TeamService) GetMember(teamID, userID string) (*model.TeamMember, error)
- func (t *TeamService) GetStats(teamID string) (*model.TeamStats, error)
- func (t *TeamService) List(options ...TeamListOption) ([]*model.Team, error)
- func (t *TeamService) ListMembers(teamID string, page, perPage int) ([]*model.TeamMember, error)
- func (t *TeamService) ListMembersForUser(userID string, page, perPage int) ([]*model.TeamMember, error)
- func (t *TeamService) ListUnreadForUser(userID string) ([]*model.TeamUnread, error)
- func (t *TeamService) ListUsers(teamID string, page, count int) ([]*model.User, error)
- func (t *TeamService) Search(term string) ([]*model.Team, error)
- func (t *TeamService) SetIcon(teamID string, content io.Reader) error
- func (t *TeamService) Update(team *model.Team) error
- func (t *TeamService) UpdateMemberRoles(teamID, userID, newRoles string) (*model.TeamMember, error)
- type UserService
- func (u *UserService) Create(user *model.User) error
- func (u *UserService) Delete(userID string) error
- func (u *UserService) Get(userID string) (*model.User, error)
- func (u *UserService) GetByEmail(email string) (*model.User, error)
- func (u *UserService) GetByUsername(username string) (*model.User, error)
- func (u *UserService) GetLDAPAttributes(userID string, attributes []string) (map[string]string, error)
- func (u *UserService) GetProfileImage(userID string) (io.Reader, error)
- func (u *UserService) GetStatus(userID string) (*model.Status, error)
- func (u *UserService) HasPermissionTo(userID string, permission *model.Permission) bool
- func (u *UserService) HasPermissionToChannel(userID, channelID string, permission *model.Permission) bool
- func (u *UserService) HasPermissionToTeam(userID, teamID string, permission *model.Permission) bool
- func (u *UserService) List(options *model.UserGetOptions) ([]*model.User, error)
- func (u *UserService) ListByUsernames(usernames []string) ([]*model.User, error)
- func (u *UserService) ListInChannel(channelID, sortBy string, page, perPage int) ([]*model.User, error)
- func (u *UserService) ListInTeam(teamID string, page, perPage int) ([]*model.User, error)
- func (u *UserService) ListStatusesByIDs(userIDs []string) ([]*model.Status, error)
- func (u *UserService) Search(search *model.UserSearch) ([]*model.User, error)
- func (u *UserService) SetProfileImage(userID string, content io.Reader) error
- func (u *UserService) Update(user *model.User) error
- func (u *UserService) UpdateActive(userID string, active bool) error
- func (u *UserService) UpdateStatus(userID, status string) (*model.Status, error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoLicense = errors.New("this feature requires a valid enterprise license")
ErrNoLicense is returned only when there is no enterprise license set.
var ErrNotFound = errors.New("not found")
ErrNotFound is returned by the plugin API when an object is not found.
Functions ¶
func ConfigureLogrus ¶
ConfigureLogrus configures the given logrus logger with a hook to proxy through the RPC API, discarding the default output to avoid duplicating the events across the standard STDOUT proxy.
func IsE20LicensedOrDevelopment ¶ added in v0.0.12
IsE20LicensedOrDevelopment returns true when the server is licensed with a Mattermost Enterprise E20 License, or has `EnableDeveloper` and `EnableTesting` configuration settings enabled, signaling a non-production, developer mode.
func IsEnterpriseLicensedOrDevelopment ¶ added in v0.0.12
IsEnterpriseLicensedOrDevelopment returns true when the server is licensed with any Mattermost Enterprise License, or has `EnableDeveloper` and `EnableTesting` configuration settings enabled signaling a non-production, developer mode.
Types ¶
type BotListOption ¶
type BotListOption func(*model.BotGetOptions)
BotListOption is an option to configure a bot List() request.
func BotIncludeDeleted ¶
func BotIncludeDeleted() BotListOption
BotIncludeDeleted option configures bot list request to also retrieve the deleted bots.
func BotOnlyOrphans ¶
func BotOnlyOrphans() BotListOption
BotOnlyOrphans option configures bot list request to only retrieve orphan bots.
func BotOwner ¶
func BotOwner(id string) BotListOption
BotOwner option configures bot list request to only retrieve the bots that matches with owner's id.
type BotService ¶
type BotService struct {
// contains filtered or unexported fields
}
BotService exposes methods to manipulate bots.
func (*BotService) Create ¶
func (b *BotService) Create(bot *model.Bot) error
Create creates the bot and corresponding user.
Minimum server version: 5.10
func (*BotService) DeleteIconImage ¶
func (b *BotService) DeleteIconImage(botUserID string) error
DeleteIconImage deletes the bot icon image shown for the bot in the LHS.
Minimum server version: 5.14
func (*BotService) DeletePermanently ¶
func (b *BotService) DeletePermanently(botUserID string) error
DeletePermanently permanently deletes a bot and its corresponding user.
Minimum server version: 5.10
func (*BotService) EnsureBot ¶ added in v0.0.10
func (b *BotService) EnsureBot(bot *model.Bot, options ...EnsureBotOption) (retBotID string, retErr error)
EnsureBot either returns an existing bot user matching the given bot, or creates a bot user from the given bot. A profile image or icon image may be optionally passed in to be set for the existing or newly created bot. Returns the id of the resulting bot.
Minimum server version: 5.10
func (*BotService) GetIconImage ¶
func (b *BotService) GetIconImage(botUserID string) (io.Reader, error)
GetIconImage gets the bot icon image shown for the bot in the LHS.
Minimum server version: 5.14
func (*BotService) List ¶
func (b *BotService) List(page, perPage int, options ...BotListOption) ([]*model.Bot, error)
List returns a list of bots by page, count and options.
Minimum server version: 5.10
func (*BotService) Patch ¶
Patch applies the given patch to the bot and corresponding user.
Minimum server version: 5.10
func (*BotService) SetIconImage ¶
func (b *BotService) SetIconImage(botUserID string, content io.Reader) error
SetIconImage sets the bot icon image to be shown in the LHS.
Icon image must be SVG format, as all other formats are rejected.
Minimum server version: 5.14
func (*BotService) UpdateActive ¶
UpdateActive marks a bot as active or inactive, along with its corresponding user.
Minimum server version: 5.10
type ChannelService ¶
type ChannelService struct {
// contains filtered or unexported fields
}
ChannelService exposes methods to manipulate channels.
func (*ChannelService) AddMember ¶
func (c *ChannelService) AddMember(channelID, userID string) (*model.ChannelMember, error)
AddMember joins a user to a channel (as if they joined themselves). This means the user will not receive notifications for joining the channel.
Minimum server version: 5.2
func (*ChannelService) AddUser ¶
func (c *ChannelService) AddUser(channelID, userID, asUserID string) (*model.ChannelMember, error)
AddUser adds a user to a channel as if the specified user had invited them. This means the user will receive the regular notifications for being added to the channel.
Minimum server version: 5.18
func (*ChannelService) Create ¶
func (c *ChannelService) Create(channel *model.Channel) error
Create creates a channel.
Minimum server version: 5.2
func (*ChannelService) Delete ¶
func (c *ChannelService) Delete(channelID string) error
Delete deletes a channel.
Minimum server version: 5.2
func (*ChannelService) DeleteMember ¶
func (c *ChannelService) DeleteMember(channelID, userID string) error
DeleteMember deletes a channel membership for a user.
Minimum server version: 5.2
func (*ChannelService) Get ¶
func (c *ChannelService) Get(channelID string) (*model.Channel, error)
Get gets a channel.
Minimum server version: 5.2
func (*ChannelService) GetByName ¶
func (c *ChannelService) GetByName(teamID, channelName string, includeDeleted bool) (*model.Channel, error)
GetByName gets a channel by its name, given a team id.
Minimum server version: 5.2
func (*ChannelService) GetByNameForTeamName ¶
func (c *ChannelService) GetByNameForTeamName(teamName, channelName string, includeDeleted bool) (*model.Channel, error)
GetByNameForTeamName gets a channel by its name, given a team name.
Minimum server version: 5.2
func (*ChannelService) GetChannelStats ¶
func (c *ChannelService) GetChannelStats(channelID string) (*model.ChannelStats, error)
GetChannelStats gets statistics for a channel.
Minimum server version: 5.6
func (*ChannelService) GetDirect ¶
func (c *ChannelService) GetDirect(userID1, userID2 string) (*model.Channel, error)
GetDirect gets a direct message channel.
Note that if the channel does not exist it will create it.
Minimum server version: 5.2
func (*ChannelService) GetGroup ¶
func (c *ChannelService) GetGroup(userIDs []string) (*model.Channel, error)
GetGroup gets a group message channel.
Note that if the channel does not exist it will create it.
Minimum server version: 5.2
func (*ChannelService) GetMember ¶
func (c *ChannelService) GetMember(channelID, userID string) (*model.ChannelMember, error)
GetMember gets a channel membership for a user.
Minimum server version: 5.2
func (*ChannelService) ListForTeamForUser ¶
func (c *ChannelService) ListForTeamForUser(teamID, userID string, includeDeleted bool) ([]*model.Channel, error)
ListForTeamForUser gets a list of channels for given user ID in given team ID.
Minimum server version: 5.6
func (*ChannelService) ListMembers ¶
func (c *ChannelService) ListMembers(channelID string, page, perPage int) ([]*model.ChannelMember, error)
ListMembers gets a channel membership for all users.
Minimum server version: 5.6
func (*ChannelService) ListMembersByIDs ¶
func (c *ChannelService) ListMembersByIDs(channelID string, userIDs []string) ([]*model.ChannelMember, error)
ListMembersByIDs gets a channel membership for a particular User
Minimum server version: 5.6
func (*ChannelService) ListMembersForUser ¶
func (c *ChannelService) ListMembersForUser(teamID, userID string, page, perPage int) ([]*model.ChannelMember, error)
ListMembersForUser returns all channel memberships on a team for a user.
Minimum server version: 5.10
func (*ChannelService) ListPublicChannelsForTeam ¶
func (c *ChannelService) ListPublicChannelsForTeam(teamID string, page, perPage int) ([]*model.Channel, error)
ListPublicChannelsForTeam gets a list of all channels.
Minimum server version: 5.2
func (*ChannelService) Search ¶
func (c *ChannelService) Search(teamID, term string) ([]*model.Channel, error)
Search returns the channels on a team matching the provided search term.
Minimum server version: 5.6
func (*ChannelService) Update ¶
func (c *ChannelService) Update(channel *model.Channel) error
Update updates a channel.
Minimum server version: 5.2
func (*ChannelService) UpdateChannelMemberNotifications ¶
func (c *ChannelService) UpdateChannelMemberNotifications(channelID, userID string, notifications map[string]string) (*model.ChannelMember, error)
UpdateChannelMemberNotifications updates a user's notification properties for a channel.
Minimum server version: 5.2
func (*ChannelService) UpdateChannelMemberRoles ¶
func (c *ChannelService) UpdateChannelMemberRoles(channelID, userID, newRoles string) (*model.ChannelMember, error)
UpdateChannelMemberRoles updates a user's roles for a channel.
Minimum server version: 5.2
type Client ¶
type Client struct { Bot BotService Configuration ConfigurationService Channel ChannelService SlashCommand SlashCommandService Emoji EmojiService File FileService Frontend FrontendService Group GroupService KV KVService Log LogService Mail MailService Plugin PluginService Post PostService Session SessionService Store *StoreService System SystemService Team TeamService User UserService // contains filtered or unexported fields }
Client is a streamlined wrapper over the mattermost plugin API.
type ConfigurationService ¶
type ConfigurationService struct {
// contains filtered or unexported fields
}
ConfigurationService exposes methods to manipulate the server and plugin configuration.
func (*ConfigurationService) GetConfig ¶
func (c *ConfigurationService) GetConfig() *model.Config
GetConfig fetches the currently persisted config.
Minimum server version: 5.2
func (*ConfigurationService) GetPluginConfig ¶
func (c *ConfigurationService) GetPluginConfig() map[string]interface{}
GetPluginConfig fetches the currently persisted config of plugin
Minimum server version: 5.6
func (*ConfigurationService) GetUnsanitizedConfig ¶
func (c *ConfigurationService) GetUnsanitizedConfig() *model.Config
GetUnsanitizedConfig fetches the currently persisted config without removing secrets.
Minimum server version: 5.16
func (*ConfigurationService) LoadPluginConfiguration ¶
func (c *ConfigurationService) LoadPluginConfiguration(dest interface{}) error
LoadPluginConfiguration loads the plugin's configuration. dest should be a pointer to a struct to which the configuration JSON can be unmarshalled.
Minimum server version: 5.2
func (*ConfigurationService) SaveConfig ¶
func (c *ConfigurationService) SaveConfig(config *model.Config) error
SaveConfig sets the given config and persists the changes
Minimum server version: 5.2
func (*ConfigurationService) SavePluginConfig ¶
func (c *ConfigurationService) SavePluginConfig(config map[string]interface{}) error
SavePluginConfig sets the given config for plugin and persists the changes
Minimum server version: 5.6
type EmojiService ¶
type EmojiService struct {
// contains filtered or unexported fields
}
EmojiService exposes methods to manipulate emojis.
func (*EmojiService) Get ¶
func (e *EmojiService) Get(id string) (*model.Emoji, error)
Get gets a custom emoji by id.
Minimum server version: 5.6
func (*EmojiService) GetByName ¶
func (e *EmojiService) GetByName(name string) (*model.Emoji, error)
GetByName gets a custom emoji by its name.
Minimum server version: 5.6
type EnsureBotOption ¶ added in v0.0.10
type EnsureBotOption func(*ensureBotOptions)
func IconImagePath ¶ added in v0.0.10
func IconImagePath(path string) EnsureBotOption
func ProfileImagePath ¶ added in v0.0.10
func ProfileImagePath(path string) EnsureBotOption
type FileService ¶
type FileService struct {
// contains filtered or unexported fields
}
FileService exposes methods to manipulate files, most often as post attachments.
func (*FileService) CopyInfos ¶
func (f *FileService) CopyInfos(ids []string, userID string) ([]string, error)
CopyInfos duplicates the FileInfo objects referenced by the given file ids, recording the given user id as the new creator and returning the new set of file ids.
The duplicate FileInfo objects are not initially linked to a post, but may now be passed on creation of a post. Use this API to duplicate a post and its file attachments without actually duplicating the uploaded files.
Minimum server version: 5.2
func (*FileService) Get ¶
func (f *FileService) Get(id string) (io.Reader, error)
Get gets content of a file by id.
Minimum server version: 5.8
func (*FileService) GetByPath ¶
func (f *FileService) GetByPath(path string) (io.Reader, error)
GetByPath reads a file by its path on the dist.
Minimum server version: 5.3
func (*FileService) GetInfo ¶
func (f *FileService) GetInfo(id string) (*model.FileInfo, error)
GetInfo gets a file's info by id.
Minimum server version: 5.3
type FrontendService ¶
type FrontendService struct {
// contains filtered or unexported fields
}
FrontendService exposes methods to interact with the frontend.
func (*FrontendService) OpenInteractiveDialog ¶
func (f *FrontendService) OpenInteractiveDialog(dialog model.OpenDialogRequest) error
OpenInteractiveDialog will open an interactive dialog on a user's client that generated the trigger ID. Used with interactive message buttons, menus and slash commands.
Minimum server version: 5.6
func (*FrontendService) PublishWebSocketEvent ¶
func (f *FrontendService) PublishWebSocketEvent(event string, payload map[string]interface{}, broadcast *model.WebsocketBroadcast)
PublishWebSocketEvent sends an event to WebSocket connections. event is the type and will be prepended with "custom_<pluginid>_". payload is the data sent with the event. Interface values must be primitive Go types or mattermost-server/model types. broadcast determines to which users to send the event.
Minimum server version: 5.2
type GroupService ¶
type GroupService struct {
// contains filtered or unexported fields
}
GroupService exposes methods to manipulate groups.
func (*GroupService) Get ¶
func (g *GroupService) Get(groupID string) (*model.Group, error)
Get gets a group by ID.
Minimum server version: 5.18
func (*GroupService) GetByName ¶
func (g *GroupService) GetByName(name string) (*model.Group, error)
GetByName gets a group by name.
Minimum server version: 5.18
func (*GroupService) ListForUser ¶
func (g *GroupService) ListForUser(userID string) ([]*model.Group, error)
ListForUser gets the groups a user is in.
Minimum server version: 5.18
type KVService ¶
type KVService struct {
// contains filtered or unexported fields
}
KVService exposes methods to read and write key-value pairs for the active plugin.
This service cannot be used to read or write key-value pairs for other plugins.
func (*KVService) CompareAndDelete
deprecated
CompareAndDelete deletes a key-value pair if the current value matches the given old value.
Returns (false, err) if DB error occurred Returns (false, nil) if current value != oldValue or key does not exist when deleting Returns (true, nil) if current value == oldValue and the key was deleted
Deprecated: CompareAndDelete exists to streamline adoption of this package for existing plugins. Use Set with the appropriate options instead.
Minimum server version: 5.18
func (*KVService) CompareAndSet
deprecated
CompareAndSet writes a key-value pair if the current value matches the given old value.
Returns (false, err) if DB error occurred Returns (false, nil) if the value was not set Returns (true, nil) if the value was set
Deprecated: CompareAndSet exists to streamline adoption of this package for existing plugins. Use Set with the appropriate options instead.
Minimum server version: 5.18
func (*KVService) Delete ¶
Delete deletes the given key-value pair.
An error is returned only if the value failed to be deleted. A non-existent key will return no error.
Minimum server version: 5.18
func (*KVService) Get ¶
Get gets the value for the given key into the given interface.
An error is returned only if the value cannot be fetched. A non-existent key will return no error, with nothing written to the given interface.
Minimum server version: 5.2
func (*KVService) ListKeys ¶
func (k *KVService) ListKeys(page, count int, options ...ListKeysOption) ([]string, error)
ListKeys lists all keys for the plugin.
Minimum server version: 5.6
func (*KVService) Set ¶
func (k *KVService) Set(key string, value interface{}, options ...KVSetOption) (bool, error)
Set stores a key-value pair, unique per plugin. Keys prefixed with `mmi_` are reserved for use by this package and will fail to be set.
Returns (false, err) if DB error occurred Returns (false, nil) if the value was not set Returns (true, nil) if the value was set
Minimum server version: 5.18
func (*KVService) SetAtomicWithRetries ¶ added in v0.0.11
func (k *KVService) SetAtomicWithRetries(key string, valueFunc func(oldValue []byte) (newValue interface{}, err error)) error
SetAtomicWithRetries will set a key-value pair atomically using compare and set semantics: it will read key's value (to get oldValue), perform valueFunc (to get newValue), and compare and set (comparing oldValue and setting newValue).
Parameters:
`key` is the key to get and set. `valueFunc` is a user-provided function that will take the old value as a []byte and return the new value or an error. If valueFunc needs to operate on oldValue, it will need to use the oldValue as a []byte, or convert oldValue into the expected type (e.g., by parsing it, or marshaling it into the expected struct). It should then return the newValue as the type expected to be stored.
Returns:
Returns err if the key could not be retrieved (DB error), valueFunc returned an error, if the key could not be set (DB error), or if the key could not be set (after retries). Returns nil if the value was set.
Minimum server version: 5.18
func (*KVService) SetWithExpiry
deprecated
SetWithExpiry sets a key-value pair with the given expiration duration relative to now.
Deprecated: SetWithExpiry exists to streamline adoption of this package for existing plugins. Use Set with the appropriate options instead.
Minimum server version: 5.18
type KVSetOption ¶
type KVSetOption func(*KVSetOptions)
KVSetOption is an option passed to Set() operation.
func SetAtomic ¶
func SetAtomic(oldValue interface{}) KVSetOption
SetAtomic guarantees the write will occur only when the current value of matches the given old value. A client is expected to read the old value first, then pass it back to ensure the value has not since been modified.
func SetExpiry ¶
func SetExpiry(ttl time.Duration) KVSetOption
SetExpiry configures a key value to expire after the given duration relative to now.
type KVSetOptions ¶
type KVSetOptions struct { model.PluginKVSetOptions // contains filtered or unexported fields }
TODO: Should this be un exported?
type ListKeysOption ¶
type ListKeysOption func(*listKeysOptions)
ListKeysOption used to configure a ListKeys() operation. TODO: Do we have plans for this?
type ListTeamsOptions ¶
type ListTeamsOptions struct {
UserID string
}
ListTeamsOptions holds options about filter out team listing.
type LogService ¶
type LogService struct {
// contains filtered or unexported fields
}
LogService exposes methods to log to the Mattermost server log.
Note that standard error is automatically sent to the Mattermost server log, and standard output is redirected to standard error. This service enables optional structured logging.
func (*LogService) Debug ¶
func (l *LogService) Debug(message string, keyValuePairs ...interface{})
Debug logs an error message, optionally structured with alternating key, value parameters.
func (*LogService) Error ¶
func (l *LogService) Error(message string, keyValuePairs ...interface{})
Error logs an error message, optionally structured with alternating key, value parameters.
func (*LogService) Info ¶
func (l *LogService) Info(message string, keyValuePairs ...interface{})
Info logs an error message, optionally structured with alternating key, value parameters.
func (*LogService) Warn ¶
func (l *LogService) Warn(message string, keyValuePairs ...interface{})
Warn logs an error message, optionally structured with alternating key, value parameters.
type LogrusHook ¶
type LogrusHook struct {
// contains filtered or unexported fields
}
LogrusHook is a logrus.Hook for emitting plugin logs through the RPC API for inclusion in the server logs.
To configure the default Logrus logger for use with plugin logging, simply invoke:
pluginapi.ConfigureLogrus(logrus.StandardLogger)
Alternatively, construct your own logger to pass to pluginapi.ConfigureLogrus.
func NewLogrusHook ¶
func NewLogrusHook(log LogService) *LogrusHook
NewLogrusHook creates a new instance of LogrusHook.
func (*LogrusHook) Fire ¶
func (lh *LogrusHook) Fire(entry *logrus.Entry) error
Fire proxies logrus entries through the plugin API at the appropriate level.
func (*LogrusHook) Levels ¶
func (lh *LogrusHook) Levels() []logrus.Level
Levels allows LogrusHook to process any log level.
type MailService ¶
type MailService struct {
// contains filtered or unexported fields
}
MailService exposes methods to send email.
func (*MailService) Send ¶
func (m *MailService) Send(to, subject, htmlBody string) error
Send sends an email to a specific address.
Minimum server version: 5.7
type PluginService ¶
type PluginService struct {
// contains filtered or unexported fields
}
PluginService exposes methods to manipulate the set of plugins as well as communicate with other plugin instances.
func (*PluginService) Disable ¶
func (p *PluginService) Disable(id string) error
Disable will disable an enabled plugin.
Minimum server version: 5.6
func (*PluginService) Enable ¶
func (p *PluginService) Enable(id string) error
Enable will enable an plugin installed.
Minimum server version: 5.6
func (*PluginService) GetPluginStatus ¶
func (p *PluginService) GetPluginStatus(id string) (*model.PluginStatus, error)
GetPluginStatus will return the status of a plugin.
Minimum server version: 5.6
func (*PluginService) HTTP ¶
func (p *PluginService) HTTP(request *http.Request) *http.Response
HTTP allows inter-plugin requests to plugin APIs.
Minimum server version: 5.18
func (*PluginService) Install ¶
Install will upload another plugin with tar.gz file. Previous version will be replaced on replace true.
Minimum server version: 5.18
func (*PluginService) List ¶
func (p *PluginService) List() ([]*model.Manifest, error)
List will return a list of plugin manifests for currently active plugins.
Minimum server version: 5.6
func (*PluginService) Remove ¶
func (p *PluginService) Remove(id string) error
Remove will disable and delete a plugin.
Minimum server version: 5.6
type PostService ¶
type PostService struct {
// contains filtered or unexported fields
}
PostService exposes methods to manipulate posts.
func (*PostService) AddReaction ¶
func (p *PostService) AddReaction(reaction *model.Reaction) error
AddReaction add a reaction to a post.
Minimum server version: 5.3
func (*PostService) CreatePost ¶
func (p *PostService) CreatePost(post *model.Post) error
CreatePost creates a post.
Minimum server version: 5.2
func (*PostService) DM ¶ added in v0.0.11
func (p *PostService) DM(senderUserID, receiverUserID string, post *model.Post) error
DM sends a post as a direct message
Minimum server version: 5.2
func (*PostService) DeleteEphemeralPost ¶
func (p *PostService) DeleteEphemeralPost(userID, postID string)
DeleteEphemeralPost deletes an ephemeral message previously sent to the user. EXPERIMENTAL: This API is experimental and can be changed without advance notice.
Minimum server version: 5.2
func (*PostService) DeletePost ¶
func (p *PostService) DeletePost(postID string) error
DeletePost deletes a post.
Minimum server version: 5.2
func (*PostService) GetPost ¶
func (p *PostService) GetPost(postID string) (*model.Post, error)
GetPost gets a post.
Minimum server version: 5.2
func (*PostService) GetPostThread ¶
func (p *PostService) GetPostThread(postID string) (*model.PostList, error)
GetPostThread gets a post with all the other posts in the same thread.
Minimum server version: 5.6
func (*PostService) GetPostsAfter ¶
func (p *PostService) GetPostsAfter(channelID, postID string, page, perPage int) (*model.PostList, error)
GetPostsAfter gets a page of posts that were posted after the post provided.
Minimum server version: 5.6
func (*PostService) GetPostsBefore ¶
func (p *PostService) GetPostsBefore(channelID, postID string, page, perPage int) (*model.PostList, error)
GetPostsBefore gets a page of posts that were posted before the post provided.
Minimum server version: 5.6
func (*PostService) GetPostsForChannel ¶
func (p *PostService) GetPostsForChannel(channelID string, page, perPage int) (*model.PostList, error)
GetPostsForChannel gets a list of posts for a channel.
Minimum server version: 5.6
func (*PostService) GetPostsSince ¶
GetPostsSince gets posts created after a specified time as Unix time in milliseconds.
Minimum server version: 5.6
func (*PostService) GetReactions ¶
func (p *PostService) GetReactions(postID string) ([]*model.Reaction, error)
GetReactions get the reactions of a post.
Minimum server version: 5.3
func (*PostService) RemoveReaction ¶
func (p *PostService) RemoveReaction(reaction *model.Reaction) error
RemoveReaction remove a reaction from a post.
Minimum server version: 5.3
func (*PostService) SearchPostsInTeam ¶
func (p *PostService) SearchPostsInTeam(teamID string, paramsList []*model.SearchParams) ([]*model.Post, error)
SearchPostsInTeam returns a list of posts in a specific team that match the given params.
Minimum server version: 5.10
func (*PostService) SendEphemeralPost ¶
func (p *PostService) SendEphemeralPost(userID string, post *model.Post)
SendEphemeralPost creates an ephemeral post.
Minimum server version: 5.2
func (*PostService) UpdateEphemeralPost ¶
func (p *PostService) UpdateEphemeralPost(userID string, post *model.Post)
UpdateEphemeralPost updates an ephemeral message previously sent to the user. EXPERIMENTAL: This API is experimental and can be changed without advance notice.
Minimum server version: 5.2
func (*PostService) UpdatePost ¶
func (p *PostService) UpdatePost(post *model.Post) error
UpdatePost updates a post.
Minimum server version: 5.2
type SessionService ¶
type SessionService struct {
// contains filtered or unexported fields
}
SessionService exposes methods to manipulate groups.
type SlashCommandService ¶
type SlashCommandService struct {
// contains filtered or unexported fields
}
SlashCommandService exposes methods to manipulate slash commands.
func (*SlashCommandService) Create ¶ added in v0.0.12
Create creates a server-owned slash command that is not handled by the plugin itself, and which will persist past the life of the plugin. The command will have its CreatorId set to "" and its PluginId set to the id of the plugin that created it.
Minimum server version: 5.28
func (*SlashCommandService) Delete ¶ added in v0.0.12
func (c *SlashCommandService) Delete(commandID string) error
Delete deletes a slash command (identified by commandID).
Minimum server version: 5.28
func (*SlashCommandService) Execute ¶ added in v0.0.12
func (c *SlashCommandService) Execute(command *model.CommandArgs) (*model.CommandResponse, error)
Execute executes a slash command.
Minimum server version: 5.26
func (*SlashCommandService) Get ¶ added in v0.0.12
func (c *SlashCommandService) Get(commandID string) (*model.Command, error)
Get returns the command definition based on a command id string.
Minimum server version: 5.28
func (*SlashCommandService) List ¶ added in v0.0.12
func (c *SlashCommandService) List(teamID string) ([]*model.Command, error)
List returns the list of all slash commands for teamID. E.g., custom commands (those created through the integrations menu, the REST api, or the plugin api CreateCommand), plugin commands (those created with plugin api RegisterCommand), and builtin commands (those added internally through RegisterCommandProvider).
Minimum server version: 5.28
func (*SlashCommandService) ListBuiltIn ¶ added in v0.0.12
func (c *SlashCommandService) ListBuiltIn() ([]*model.Command, error)
ListBuiltIn returns the list of slash commands that are builtin commands (those added internally through RegisterCommandProvider).
Minimum server version: 5.28
func (*SlashCommandService) ListCustom ¶ added in v0.0.12
func (c *SlashCommandService) ListCustom(teamID string) ([]*model.Command, error)
ListCustom returns the list of slash commands for teamID that where created through the integrations menu, the REST api, or the plugin api CreateCommand.
Minimum server version: 5.28
func (*SlashCommandService) ListPlugin ¶ added in v0.0.12
func (c *SlashCommandService) ListPlugin(teamID string) ([]*model.Command, error)
ListPlugin returns the list of slash commands for teamID that were created with the plugin api RegisterCommand.
Minimum server version: 5.28
func (*SlashCommandService) Register ¶
func (c *SlashCommandService) Register(command *model.Command) error
Register registers a custom slash command. When the command is triggered, your plugin can fulfill it via the ExecuteCommand hook.
Minimum server version: 5.2
func (*SlashCommandService) Unregister ¶
func (c *SlashCommandService) Unregister(teamID, trigger string) error
Unregister unregisters a command previously registered via Register.
Minimum server version: 5.2
func (*SlashCommandService) Update ¶ added in v0.0.12
func (c *SlashCommandService) Update(commandID string, updatedCmd *model.Command) (*model.Command, error)
Update updates a single command (identified by commandID) with the information provided in the updatedCmd model.Command struct. The following fields in the command cannot be updated: Id, Token, CreateAt, DeleteAt, and PluginId. If updatedCmd.TeamId is blank, it will be set to commandID's TeamId.
Minimum server version: 5.28
type StoreService ¶ added in v0.0.11
type StoreService struct {
// contains filtered or unexported fields
}
StoreService exposes the underlying database.
func (*StoreService) Close ¶ added in v0.0.11
func (s *StoreService) Close() error
Close closes any open resources. This method is idempotent.
func (*StoreService) DriverName ¶ added in v0.0.11
func (s *StoreService) DriverName() string
DriverName returns the driver name for the datasource.
func (*StoreService) GetMasterDB ¶ added in v0.0.11
func (s *StoreService) GetMasterDB() (*sql.DB, error)
GetMasterDB gets the master database handle.
Minimum server version: 5.16
func (*StoreService) GetReplicaDB ¶ added in v0.0.11
func (s *StoreService) GetReplicaDB() (*sql.DB, error)
GetReplicaDB gets the replica database handle. Returns masterDB if a replica is not configured.
Minimum server version: 5.16
type SystemService ¶
type SystemService struct {
// contains filtered or unexported fields
}
SystemService exposes methods to query system properties.
func (*SystemService) GetBundlePath ¶
func (s *SystemService) GetBundlePath() (string, error)
GetBundlePath returns the absolute path where the plugin's bundle was unpacked.
Minimum server version: 5.10
func (*SystemService) GetDiagnosticID ¶
func (s *SystemService) GetDiagnosticID() string
GetDiagnosticID returns a unique identifier used by the server for diagnostic reports.
Minimum server version: 5.10
func (*SystemService) GetLicense ¶
func (s *SystemService) GetLicense() *model.License
GetLicense returns the current license used by the Mattermost server. Returns nil if the the server does not have a license.
Minimum server version: 5.10
func (*SystemService) GetManifest ¶ added in v0.0.10
func (s *SystemService) GetManifest() (*model.Manifest, error)
GetManifest returns the manifest from the plugin bundle.
Minimum server version: 5.10
func (*SystemService) GetServerVersion ¶
func (s *SystemService) GetServerVersion() string
GetServerVersion return the current Mattermost server version
Minimum server version: 5.4
func (*SystemService) GetSystemInstallDate ¶
func (s *SystemService) GetSystemInstallDate() (time.Time, error)
GetSystemInstallDate returns the time that Mattermost was first installed and ran.
Minimum server version: 5.10
type TeamListOption ¶
type TeamListOption func(*ListTeamsOptions)
TeamListOption is used to filter team listing.
func FilterTeamsByUser ¶
func FilterTeamsByUser(userID string) TeamListOption
FilterTeamsByUser option is used to filter teams by user.
type TeamService ¶
type TeamService struct {
// contains filtered or unexported fields
}
TeamService exposes methods to manipulate teams and their members.
func (*TeamService) Create ¶
func (t *TeamService) Create(team *model.Team) error
Create creates a team.
Minimum server version: 5.2
func (*TeamService) CreateMember ¶
func (t *TeamService) CreateMember(teamID, userID string) (*model.TeamMember, error)
CreateMember creates a team membership.
Minimum server version: 5.2
func (*TeamService) CreateMembers ¶
func (t *TeamService) CreateMembers(teamID string, userIDs []string, requestorID string) ([]*model.TeamMember, error)
CreateMembers creates a team membership for all provided user ids.
Minimum server version: 5.2
func (*TeamService) Delete ¶
func (t *TeamService) Delete(teamID string) error
Delete deletes a team.
Minimum server version: 5.2
func (*TeamService) DeleteIcon ¶
func (t *TeamService) DeleteIcon(teamID string) error
DeleteIcon removes the team icon.
Minimum server version: 5.6
func (*TeamService) DeleteMember ¶
func (t *TeamService) DeleteMember(teamID, userID, requestorID string) error
DeleteMember deletes a team membership.
Minimum server version: 5.2
func (*TeamService) Get ¶
func (t *TeamService) Get(teamID string) (*model.Team, error)
Get gets a team.
Minimum server version: 5.2
func (*TeamService) GetByName ¶
func (t *TeamService) GetByName(name string) (*model.Team, error)
GetByName gets a team by its name.
Minimum server version: 5.2
func (*TeamService) GetIcon ¶
func (t *TeamService) GetIcon(teamID string) (io.Reader, error)
GetIcon gets the team icon.
Minimum server version: 5.6
func (*TeamService) GetMember ¶
func (t *TeamService) GetMember(teamID, userID string) (*model.TeamMember, error)
GetMember returns a specific membership.
Minimum server version: 5.2
func (*TeamService) GetStats ¶
func (t *TeamService) GetStats(teamID string) (*model.TeamStats, error)
GetStats gets a team's statistics
Minimum server version: 5.8
func (*TeamService) List ¶
func (t *TeamService) List(options ...TeamListOption) ([]*model.Team, error)
List gets a list of teams by options.
Minimum server version: 5.2 Minimum server version when LimitTeamsToUser() option is used: 5.6
func (*TeamService) ListMembers ¶
func (t *TeamService) ListMembers(teamID string, page, perPage int) ([]*model.TeamMember, error)
ListMembers returns the memberships of a specific team.
Minimum server version: 5.2
func (*TeamService) ListMembersForUser ¶
func (t *TeamService) ListMembersForUser(userID string, page, perPage int) ([]*model.TeamMember, error)
ListMembersForUser returns all team memberships for a user.
Minimum server version: 5.10
func (*TeamService) ListUnreadForUser ¶
func (t *TeamService) ListUnreadForUser(userID string) ([]*model.TeamUnread, error)
ListUnreadForUser gets the unread message and mention counts for each team to which the given user belongs.
Minimum server version: 5.6
func (*TeamService) Search ¶
func (t *TeamService) Search(term string) ([]*model.Team, error)
Search search a team.
Minimum server version: 5.8
func (*TeamService) SetIcon ¶
func (t *TeamService) SetIcon(teamID string, content io.Reader) error
SetIcon sets the team icon.
Minimum server version: 5.6
func (*TeamService) Update ¶
func (t *TeamService) Update(team *model.Team) error
Update updates a team.
Minimum server version: 5.2
func (*TeamService) UpdateMemberRoles ¶
func (t *TeamService) UpdateMemberRoles(teamID, userID, newRoles string) (*model.TeamMember, error)
UpdateMemberRoles updates the role for a team membership.
Minimum server version: 5.2
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
UserService exposes methods to manipulate users.
func (*UserService) Create ¶
func (u *UserService) Create(user *model.User) error
Create creates a user.
Minimum server version: 5.2
func (*UserService) Delete ¶
func (u *UserService) Delete(userID string) error
Delete deletes a user.
Minimum server version: 5.2
func (*UserService) Get ¶
func (u *UserService) Get(userID string) (*model.User, error)
Get gets a user.
Minimum server version: 5.2
func (*UserService) GetByEmail ¶
func (u *UserService) GetByEmail(email string) (*model.User, error)
GetByEmail gets a user by their email address.
Minimum server version: 5.2
func (*UserService) GetByUsername ¶
func (u *UserService) GetByUsername(username string) (*model.User, error)
GetByUsername gets a user by their username.
Minimum server version: 5.2
func (*UserService) GetLDAPAttributes ¶
func (u *UserService) GetLDAPAttributes(userID string, attributes []string) (map[string]string, error)
GetLDAPAttributes will return LDAP attributes for a user. The attributes parameter should be a list of attributes to pull. Returns a map with attribute names as keys and the user's attributes as values. Requires an enterprise license, LDAP to be configured and for the user to use LDAP as an authentication method.
Minimum server version: 5.3
func (*UserService) GetProfileImage ¶
func (u *UserService) GetProfileImage(userID string) (io.Reader, error)
GetProfileImage gets user's profile image.
Minimum server version: 5.6
func (*UserService) GetStatus ¶
func (u *UserService) GetStatus(userID string) (*model.Status, error)
GetStatus will get a user's status.
Minimum server version: 5.2
func (*UserService) HasPermissionTo ¶
func (u *UserService) HasPermissionTo(userID string, permission *model.Permission) bool
HasPermissionTo check if the user has the permission at system scope.
Minimum server version: 5.3
func (*UserService) HasPermissionToChannel ¶
func (u *UserService) HasPermissionToChannel(userID, channelID string, permission *model.Permission) bool
HasPermissionToChannel check if the user has the permission at channel scope.
Minimum server version: 5.3
func (*UserService) HasPermissionToTeam ¶
func (u *UserService) HasPermissionToTeam(userID, teamID string, permission *model.Permission) bool
HasPermissionToTeam check if the user has the permission at team scope.
Minimum server version: 5.3
func (*UserService) List ¶
func (u *UserService) List(options *model.UserGetOptions) ([]*model.User, error)
List a list of users based on search options.
Minimum server version: 5.10
func (*UserService) ListByUsernames ¶
func (u *UserService) ListByUsernames(usernames []string) ([]*model.User, error)
ListByUsernames gets users by their usernames.
Minimum server version: 5.6
func (*UserService) ListInChannel ¶
func (u *UserService) ListInChannel(channelID, sortBy string, page, perPage int) ([]*model.User, error)
ListInChannel returns a page of users in a channel. Page counting starts at 0. The sortBy parameter can be: "username" or "status".
Minimum server version: 5.6
func (*UserService) ListStatusesByIDs ¶
func (u *UserService) ListStatusesByIDs(userIDs []string) ([]*model.Status, error)
ListStatusesByIDs will return a list of user statuses based on the provided slice of user IDs.
Minimum server version: 5.2
func (*UserService) Search ¶
func (u *UserService) Search(search *model.UserSearch) ([]*model.User, error)
Search returns a list of users based on some search criteria.
Minimum server version: 5.6
func (*UserService) SetProfileImage ¶
func (u *UserService) SetProfileImage(userID string, content io.Reader) error
SetProfileImage sets a user's profile image.
Minimum server version: 5.6
func (*UserService) Update ¶
func (u *UserService) Update(user *model.User) error
Update updates a user.
Minimum server version: 5.2
func (*UserService) UpdateActive ¶
func (u *UserService) UpdateActive(userID string, active bool) error
UpdateActive deactivates or reactivates an user.
Minimum server version: 5.8
func (*UserService) UpdateStatus ¶
func (u *UserService) UpdateStatus(userID, status string) (*model.Status, error)
UpdateStatus will set a user's status until the user, or another integration/plugin, sets it back to online. The status parameter can be: "online", "away", "dnd", or "offline".
Minimum server version: 5.2
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
package cluster exposes synchronization primitives to ensure correct behavior across multiple plugin instances in a Mattermost cluster.
|
package cluster exposes synchronization primitives to ensure correct behavior across multiple plugin instances in a Mattermost cluster. |
experimental
|
|
bot/mocks
Package mock_bot is a generated GoMock package.
|
Package mock_bot is a generated GoMock package. |
bot/poster/mock_import
Package mock_import is a generated GoMock package.
|
Package mock_import is a generated GoMock package. |
flow/mocks
Package mock_flow is a generated GoMock package.
|
Package mock_flow is a generated GoMock package. |
freetextfetcher/mocks
Package mock_freetext_fetcher is a generated GoMock package.
|
Package mock_freetext_fetcher is a generated GoMock package. |
oauther/mock_oauther
Package mock_oauther is a generated GoMock package.
|
Package mock_oauther is a generated GoMock package. |
oauther/mocks
Package mock_oauther is a generated GoMock package.
|
Package mock_oauther is a generated GoMock package. |
panel/mocks
Package mock_panel is a generated GoMock package.
|
Package mock_panel is a generated GoMock package. |
telemetry
Package telemetry allows you to add telemetry to your plugins.
|
Package telemetry allows you to add telemetry to your plugins. |
package i18n provides methods to read translations files and localize strings.
|
package i18n provides methods to read translations files and localize strings. |