mattermost-server: github.com/mattermost/mattermost-server/plugin Index | Examples | Files | Directories

package plugin

import "github.com/mattermost/mattermost-server/plugin"

The plugin package is used by Mattermost server plugins written in go. It also enables the Mattermost server to manage and interact with the running plugin environment.

Note that this package exports a large number of types prefixed with Z_. These are public only to allow their use with Hashicorp's go-plugin (and net/rpc). Do not use these directly.

This example demonstrates a plugin that handles HTTP requests which respond by greeting the world.

Code:

package main

import (
    "fmt"
    "net/http"

    "github.com/mattermost/mattermost-server/v5/plugin"
)

type HelloWorldPlugin struct {
    plugin.MattermostPlugin
}

func (p *HelloWorldPlugin) ServeHTTP(c *plugin.Context, w http.ResponseWriter, r *http.Request) {
    fmt.Fprint(w, "Hello, world!")
}

// This example demonstrates a plugin that handles HTTP requests which respond by greeting the
// world.
func main() {
    plugin.ClientMain(&HelloWorldPlugin{})
}

Code:

package main

import (
    "strings"
    "sync"

    "github.com/pkg/errors"

    "github.com/mattermost/mattermost-server/v5/model"
    "github.com/mattermost/mattermost-server/v5/plugin"
)

// configuration represents the configuration for this plugin as exposed via the Mattermost
// server configuration.
type configuration struct {
    TeamName    string
    ChannelName string

    // channelID is resolved when the public configuration fields above change
    channelID string
}

type HelpPlugin struct {
    plugin.MattermostPlugin

    // configurationLock synchronizes access to the configuration.
    configurationLock sync.RWMutex

    // configuration is the active plugin configuration. Consult getConfiguration and
    // setConfiguration for usage.
    configuration *configuration
}

// getConfiguration retrieves the active configuration under lock, making it safe to use
// concurrently. The active configuration may change underneath the client of this method, but
// the struct returned by this API call is considered immutable.
func (p *HelpPlugin) getConfiguration() *configuration {
    p.configurationLock.RLock()
    defer p.configurationLock.RUnlock()

    if p.configuration == nil {
        return &configuration{}
    }

    return p.configuration
}

// setConfiguration replaces the active configuration under lock.
//
// Do not call setConfiguration while holding the configurationLock, as sync.Mutex is not
// reentrant.
func (p *HelpPlugin) setConfiguration(configuration *configuration) {
    // Replace the active configuration under lock.
    p.configurationLock.Lock()
    defer p.configurationLock.Unlock()
    p.configuration = configuration
}

// OnConfigurationChange updates the active configuration for this plugin under lock.
func (p *HelpPlugin) OnConfigurationChange() error {
    var configuration = new(configuration)

    // Load the public configuration fields from the Mattermost server configuration.
    if err := p.API.LoadPluginConfiguration(configuration); err != nil {
        return errors.Wrap(err, "failed to load plugin configuration")
    }

    team, err := p.API.GetTeamByName(configuration.TeamName)
    if err != nil {
        return errors.Wrapf(err, "failed to find team %s", configuration.TeamName)
    }

    channel, err := p.API.GetChannelByName(configuration.ChannelName, team.Id, false)
    if err != nil {
        return errors.Wrapf(err, "failed to find channel %s", configuration.ChannelName)
    }

    configuration.channelID = channel.Id

    p.setConfiguration(configuration)

    return nil
}

func (p *HelpPlugin) MessageHasBeenPosted(c *plugin.Context, post *model.Post) {
    configuration := p.getConfiguration()

    // Ignore posts not in the configured channel
    if post.ChannelId != configuration.channelID {
        return
    }

    // Ignore posts this plugin made.
    if sentByPlugin, _ := post.Props["sent_by_plugin"].(bool); sentByPlugin {
        return
    }

    // Ignore posts without a plea for help.
    if !strings.Contains(post.Message, "help") {
        return
    }

    p.API.SendEphemeralPost(post.UserId, &model.Post{
        ChannelId: configuration.channelID,
        Message:   "You asked for help? Checkout https://about.mattermost.com/help/",
        Props: map[string]interface{}{
            "sent_by_plugin": true,
        },
    })
}

func main() {
    plugin.ClientMain(&HelpPlugin{})
}

Index

Examples

Package Files

api.go api_timer_layer_generated.go client.go client_rpc.go client_rpc_generated.go context.go doc.go environment.go hclog_adapter.go health_check.go helpers.go helpers_bots.go helpers_config.go helpers_kv.go helpers_plugin.go hooks.go hooks_timer_layer_generated.go http.go io_rpc.go stringifier.go supervisor.go

Constants

const (
    INTERNAL_KEY_PREFIX = "mmi_"
    BOT_USER_KEY        = INTERNAL_KEY_PREFIX + "botid"
)
const (
    HEALTH_CHECK_INTERVAL         = 30 * time.Second // How often the health check should run
    HEALTH_CHECK_DISABLE_DURATION = 60 * time.Minute // How long we wait for num fails to incur before disabling the plugin
    HEALTH_CHECK_PING_FAIL_LIMIT  = 3                // How many times we call RPC ping in a row before it is considered a failure
    HEALTH_CHECK_RESTART_LIMIT    = 3                // How many times we restart a plugin before we disable it
)
const (
    OnActivateId            = 0
    OnDeactivateId          = 1
    ServeHTTPId             = 2
    OnConfigurationChangeId = 3
    ExecuteCommandId        = 4
    MessageWillBePostedId   = 5
    MessageWillBeUpdatedId  = 6
    MessageHasBeenPostedId  = 7
    MessageHasBeenUpdatedId = 8
    UserHasJoinedChannelId  = 9
    UserHasLeftChannelId    = 10
    UserHasJoinedTeamId     = 11
    UserHasLeftTeamId       = 12
    ChannelHasBeenCreatedId = 13
    FileWillBeUploadedId    = 14
    UserWillLogInId         = 15
    UserHasLoggedInId       = 16
    UserHasBeenCreatedId    = 17
    TotalHooksId            = iota
)

These assignments are part of the wire protocol used to trigger hook events in plugins.

Feel free to add more, but do not change existing assignments. Follow the naming convention of <HookName>Id as the autogenerated glue code depends on that.

const (
    // DismissPostError dismisses a pending post when the error is returned from MessageWillBePosted.
    DismissPostError = "plugin.message_will_be_posted.dismiss_post"
)

Variables

var ErrNotFound = errors.New("Item not found")

func ClientMain Uses

func ClientMain(pluginImplementation interface{})

Starts the serving of a Mattermost plugin over net/rpc. gRPC is not yet supported.

Call this when your plugin is ready to start.

type API Uses

type API interface {
    // LoadPluginConfiguration loads the plugin's configuration. dest should be a pointer to a
    // struct that the configuration JSON can be unmarshalled to.
    //
    // @tag Plugin
    // Minimum server version: 5.2
    LoadPluginConfiguration(dest interface{}) error

    // RegisterCommand registers a custom slash command. When the command is triggered, your plugin
    // can fulfill it via the ExecuteCommand hook.
    //
    // @tag Command
    // Minimum server version: 5.2
    RegisterCommand(command *model.Command) error

    // UnregisterCommand unregisters a command previously registered via RegisterCommand.
    //
    // @tag Command
    // Minimum server version: 5.2
    UnregisterCommand(teamId, trigger string) error

    // GetSession returns the session object for the Session ID
    //
    // Minimum server version: 5.2
    GetSession(sessionId string) (*model.Session, *model.AppError)

    // GetConfig fetches the currently persisted config
    //
    // @tag Configuration
    // Minimum server version: 5.2
    GetConfig() *model.Config

    // GetUnsanitizedConfig fetches the currently persisted config without removing secrets.
    //
    // @tag Configuration
    // Minimum server version: 5.16
    GetUnsanitizedConfig() *model.Config

    // SaveConfig sets the given config and persists the changes
    //
    // @tag Configuration
    // Minimum server version: 5.2
    SaveConfig(config *model.Config) *model.AppError

    // GetPluginConfig fetches the currently persisted config of plugin
    //
    // @tag Plugin
    // Minimum server version: 5.6
    GetPluginConfig() map[string]interface{}

    // SavePluginConfig sets the given config for plugin and persists the changes
    //
    // @tag Plugin
    // Minimum server version: 5.6
    SavePluginConfig(config map[string]interface{}) *model.AppError

    // GetBundlePath returns the absolute path where the plugin's bundle was unpacked.
    //
    // @tag Plugin
    // Minimum server version: 5.10
    GetBundlePath() (string, error)

    // GetLicense returns the current license used by the Mattermost server. Returns nil if the
    // the server does not have a license.
    //
    // @tag Server
    // Minimum server version: 5.10
    GetLicense() *model.License

    // GetServerVersion return the current Mattermost server version
    //
    // @tag Server
    // Minimum server version: 5.4
    GetServerVersion() string

    // GetSystemInstallDate returns the time that Mattermost was first installed and ran.
    //
    // @tag Server
    // Minimum server version: 5.10
    GetSystemInstallDate() (int64, *model.AppError)

    // GetDiagnosticId returns a unique identifier used by the server for diagnostic reports.
    //
    // @tag Server
    // Minimum server version: 5.10
    GetDiagnosticId() string

    // CreateUser creates a user.
    //
    // @tag User
    // Minimum server version: 5.2
    CreateUser(user *model.User) (*model.User, *model.AppError)

    // DeleteUser deletes a user.
    //
    // @tag User
    // Minimum server version: 5.2
    DeleteUser(userId string) *model.AppError

    // GetUsers a list of users based on search options.
    //
    // @tag User
    // Minimum server version: 5.10
    GetUsers(options *model.UserGetOptions) ([]*model.User, *model.AppError)

    // GetUser gets a user.
    //
    // @tag User
    // Minimum server version: 5.2
    GetUser(userId string) (*model.User, *model.AppError)

    // GetUserByEmail gets a user by their email address.
    //
    // @tag User
    // Minimum server version: 5.2
    GetUserByEmail(email string) (*model.User, *model.AppError)

    // GetUserByUsername gets a user by their username.
    //
    // @tag User
    // Minimum server version: 5.2
    GetUserByUsername(name string) (*model.User, *model.AppError)

    // GetUsersByUsernames gets users by their usernames.
    //
    // @tag User
    // Minimum server version: 5.6
    GetUsersByUsernames(usernames []string) ([]*model.User, *model.AppError)

    // GetUsersInTeam gets users in team.
    //
    // @tag User
    // @tag Team
    // Minimum server version: 5.6
    GetUsersInTeam(teamId string, page int, perPage int) ([]*model.User, *model.AppError)

    // GetTeamIcon gets the team icon.
    //
    // @tag Team
    // Minimum server version: 5.6
    GetTeamIcon(teamId string) ([]byte, *model.AppError)

    // SetTeamIcon sets the team icon.
    //
    // @tag Team
    // Minimum server version: 5.6
    SetTeamIcon(teamId string, data []byte) *model.AppError

    // RemoveTeamIcon removes the team icon.
    //
    // @tag Team
    // Minimum server version: 5.6
    RemoveTeamIcon(teamId string) *model.AppError

    // UpdateUser updates a user.
    //
    // @tag User
    // Minimum server version: 5.2
    UpdateUser(user *model.User) (*model.User, *model.AppError)

    // GetUserStatus will get a user's status.
    //
    // @tag User
    // Minimum server version: 5.2
    GetUserStatus(userId string) (*model.Status, *model.AppError)

    // GetUserStatusesByIds will return a list of user statuses based on the provided slice of user IDs.
    //
    // @tag User
    // Minimum server version: 5.2
    GetUserStatusesByIds(userIds []string) ([]*model.Status, *model.AppError)

    // UpdateUserStatus 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".
    //
    // @tag User
    // Minimum server version: 5.2
    UpdateUserStatus(userId, status string) (*model.Status, *model.AppError)

    // UpdateUserActive deactivates or reactivates an user.
    //
    // @tag User
    // Minimum server version: 5.8
    UpdateUserActive(userId string, active bool) *model.AppError

    // GetUsersInChannel returns a page of users in a channel. Page counting starts at 0.
    // The sortBy parameter can be: "username" or "status".
    //
    // @tag User
    // @tag Channel
    // Minimum server version: 5.6
    GetUsersInChannel(channelId, sortBy string, page, perPage int) ([]*model.User, *model.AppError)

    // GetLDAPUserAttributes 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.
    //
    // @tag User
    // Minimum server version: 5.3
    GetLDAPUserAttributes(userId string, attributes []string) (map[string]string, *model.AppError)

    // CreateTeam creates a team.
    //
    // @tag Team
    // Minimum server version: 5.2
    CreateTeam(team *model.Team) (*model.Team, *model.AppError)

    // DeleteTeam deletes a team.
    //
    // @tag Team
    // Minimum server version: 5.2
    DeleteTeam(teamId string) *model.AppError

    // GetTeam gets all teams.
    //
    // @tag Team
    // Minimum server version: 5.2
    GetTeams() ([]*model.Team, *model.AppError)

    // GetTeam gets a team.
    //
    // @tag Team
    // Minimum server version: 5.2
    GetTeam(teamId string) (*model.Team, *model.AppError)

    // GetTeamByName gets a team by its name.
    //
    // @tag Team
    // Minimum server version: 5.2
    GetTeamByName(name string) (*model.Team, *model.AppError)

    // GetTeamsUnreadForUser gets the unread message and mention counts for each team to which the given user belongs.
    //
    // @tag Team
    // @tag User
    // Minimum server version: 5.6
    GetTeamsUnreadForUser(userId string) ([]*model.TeamUnread, *model.AppError)

    // UpdateTeam updates a team.
    //
    // @tag Team
    // Minimum server version: 5.2
    UpdateTeam(team *model.Team) (*model.Team, *model.AppError)

    // SearchTeams search a team.
    //
    // @tag Team
    // Minimum server version: 5.8
    SearchTeams(term string) ([]*model.Team, *model.AppError)

    // GetTeamsForUser returns list of teams of given user ID.
    //
    // @tag Team
    // @tag User
    // Minimum server version: 5.6
    GetTeamsForUser(userId string) ([]*model.Team, *model.AppError)

    // CreateTeamMember creates a team membership.
    //
    // @tag Team
    // @tag User
    // Minimum server version: 5.2
    CreateTeamMember(teamId, userId string) (*model.TeamMember, *model.AppError)

    // CreateTeamMembers creates a team membership for all provided user ids.
    //
    // @tag Team
    // @tag User
    // Minimum server version: 5.2
    CreateTeamMembers(teamId string, userIds []string, requestorId string) ([]*model.TeamMember, *model.AppError)

    // CreateTeamMembersGracefully creates a team membership for all provided user ids and reports the users that were not added.
    //
    // @tag Team
    // @tag User
    // Minimum server version: 5.20
    CreateTeamMembersGracefully(teamId string, userIds []string, requestorId string) ([]*model.TeamMemberWithError, *model.AppError)

    // DeleteTeamMember deletes a team membership.
    //
    // @tag Team
    // @tag User
    // Minimum server version: 5.2
    DeleteTeamMember(teamId, userId, requestorId string) *model.AppError

    // GetTeamMembers returns the memberships of a specific team.
    //
    // @tag Team
    // @tag User
    // Minimum server version: 5.2
    GetTeamMembers(teamId string, page, perPage int) ([]*model.TeamMember, *model.AppError)

    // GetTeamMember returns a specific membership.
    //
    // @tag Team
    // @tag User
    // Minimum server version: 5.2
    GetTeamMember(teamId, userId string) (*model.TeamMember, *model.AppError)

    // GetTeamMembersForUser returns all team memberships for a user.
    //
    // @tag Team
    // @tag User
    // Minimum server version: 5.10
    GetTeamMembersForUser(userId string, page int, perPage int) ([]*model.TeamMember, *model.AppError)

    // UpdateTeamMemberRoles updates the role for a team membership.
    //
    // @tag Team
    // @tag User
    // Minimum server version: 5.2
    UpdateTeamMemberRoles(teamId, userId, newRoles string) (*model.TeamMember, *model.AppError)

    // CreateChannel creates a channel.
    //
    // @tag Channel
    // Minimum server version: 5.2
    CreateChannel(channel *model.Channel) (*model.Channel, *model.AppError)

    // DeleteChannel deletes a channel.
    //
    // @tag Channel
    // Minimum server version: 5.2
    DeleteChannel(channelId string) *model.AppError

    // GetPublicChannelsForTeam gets a list of all channels.
    //
    // @tag Channel
    // @tag Team
    // Minimum server version: 5.2
    GetPublicChannelsForTeam(teamId string, page, perPage int) ([]*model.Channel, *model.AppError)

    // GetChannel gets a channel.
    //
    // @tag Channel
    // Minimum server version: 5.2
    GetChannel(channelId string) (*model.Channel, *model.AppError)

    // GetChannelByName gets a channel by its name, given a team id.
    //
    // @tag Channel
    // Minimum server version: 5.2
    GetChannelByName(teamId, name string, includeDeleted bool) (*model.Channel, *model.AppError)

    // GetChannelByNameForTeamName gets a channel by its name, given a team name.
    //
    // @tag Channel
    // @tag Team
    // Minimum server version: 5.2
    GetChannelByNameForTeamName(teamName, channelName string, includeDeleted bool) (*model.Channel, *model.AppError)

    // GetChannelsForTeamForUser gets a list of channels for given user ID in given team ID.
    //
    // @tag Channel
    // @tag Team
    // @tag User
    // Minimum server version: 5.6
    GetChannelsForTeamForUser(teamId, userId string, includeDeleted bool) ([]*model.Channel, *model.AppError)

    // GetChannelStats gets statistics for a channel.
    //
    // @tag Channel
    // Minimum server version: 5.6
    GetChannelStats(channelId string) (*model.ChannelStats, *model.AppError)

    // GetDirectChannel gets a direct message channel.
    // If the channel does not exist it will create it.
    //
    // @tag Channel
    // @tag User
    // Minimum server version: 5.2
    GetDirectChannel(userId1, userId2 string) (*model.Channel, *model.AppError)

    // GetGroupChannel gets a group message channel.
    // If the channel does not exist it will create it.
    //
    // @tag Channel
    // @tag User
    // Minimum server version: 5.2
    GetGroupChannel(userIds []string) (*model.Channel, *model.AppError)

    // UpdateChannel updates a channel.
    //
    // @tag Channel
    // Minimum server version: 5.2
    UpdateChannel(channel *model.Channel) (*model.Channel, *model.AppError)

    // SearchChannels returns the channels on a team matching the provided search term.
    //
    // @tag Channel
    // Minimum server version: 5.6
    SearchChannels(teamId string, term string) ([]*model.Channel, *model.AppError)

    // SearchUsers returns a list of users based on some search criteria.
    //
    // @tag User
    // Minimum server version: 5.6
    SearchUsers(search *model.UserSearch) ([]*model.User, *model.AppError)

    // SearchPostsInTeam returns a list of posts in a specific team that match the given params.
    //
    // @tag Post
    // @tag Team
    // Minimum server version: 5.10
    SearchPostsInTeam(teamId string, paramsList []*model.SearchParams) ([]*model.Post, *model.AppError)

    // AddChannelMember joins a user to a channel (as if they joined themselves)
    // This means the user will not receive notifications for joining the channel.
    //
    // @tag Channel
    // @tag User
    // Minimum server version: 5.2
    AddChannelMember(channelId, userId string) (*model.ChannelMember, *model.AppError)

    // AddUserToChannel 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.
    //
    // @tag User
    // @tag Channel
    // Minimum server version: 5.18
    AddUserToChannel(channelId, userId, asUserId string) (*model.ChannelMember, *model.AppError)

    // GetChannelMember gets a channel membership for a user.
    //
    // @tag Channel
    // @tag User
    // Minimum server version: 5.2
    GetChannelMember(channelId, userId string) (*model.ChannelMember, *model.AppError)

    // GetChannelMembers gets a channel membership for all users.
    //
    // @tag Channel
    // @tag User
    // Minimum server version: 5.6
    GetChannelMembers(channelId string, page, perPage int) (*model.ChannelMembers, *model.AppError)

    // GetChannelMembersByIds gets a channel membership for a particular User
    //
    // @tag Channel
    // @tag User
    // Minimum server version: 5.6
    GetChannelMembersByIds(channelId string, userIds []string) (*model.ChannelMembers, *model.AppError)

    // GetChannelMembersForUser returns all channel memberships on a team for a user.
    //
    // @tag Channel
    // @tag User
    // Minimum server version: 5.10
    GetChannelMembersForUser(teamId, userId string, page, perPage int) ([]*model.ChannelMember, *model.AppError)

    // UpdateChannelMemberRoles updates a user's roles for a channel.
    //
    // @tag Channel
    // @tag User
    // Minimum server version: 5.2
    UpdateChannelMemberRoles(channelId, userId, newRoles string) (*model.ChannelMember, *model.AppError)

    // UpdateChannelMemberNotifications updates a user's notification properties for a channel.
    //
    // @tag Channel
    // @tag User
    // Minimum server version: 5.2
    UpdateChannelMemberNotifications(channelId, userId string, notifications map[string]string) (*model.ChannelMember, *model.AppError)

    // GetGroup gets a group by ID.
    //
    // @tag Group
    // Minimum server version: 5.18
    GetGroup(groupId string) (*model.Group, *model.AppError)

    // GetGroupByName gets a group by name.
    //
    // @tag Group
    // Minimum server version: 5.18
    GetGroupByName(name string) (*model.Group, *model.AppError)

    // GetGroupsForUser gets the groups a user is in.
    //
    // @tag Group
    // @tag User
    // Minimum server version: 5.18
    GetGroupsForUser(userId string) ([]*model.Group, *model.AppError)

    // DeleteChannelMember deletes a channel membership for a user.
    //
    // @tag Channel
    // @tag User
    // Minimum server version: 5.2
    DeleteChannelMember(channelId, userId string) *model.AppError

    // CreatePost creates a post.
    //
    // @tag Post
    // Minimum server version: 5.2
    CreatePost(post *model.Post) (*model.Post, *model.AppError)

    // AddReaction add a reaction to a post.
    //
    // @tag Post
    // Minimum server version: 5.3
    AddReaction(reaction *model.Reaction) (*model.Reaction, *model.AppError)

    // RemoveReaction remove a reaction from a post.
    //
    // @tag Post
    // Minimum server version: 5.3
    RemoveReaction(reaction *model.Reaction) *model.AppError

    // GetReaction get the reactions of a post.
    //
    // @tag Post
    // Minimum server version: 5.3
    GetReactions(postId string) ([]*model.Reaction, *model.AppError)

    // SendEphemeralPost creates an ephemeral post.
    //
    // @tag Post
    // Minimum server version: 5.2
    SendEphemeralPost(userId string, post *model.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.
    //
    // @tag Post
    // Minimum server version: 5.2
    UpdateEphemeralPost(userId string, post *model.Post) *model.Post

    // DeleteEphemeralPost deletes an ephemeral message previously sent to the user.
    // EXPERIMENTAL: This API is experimental and can be changed without advance notice.
    //
    // @tag Post
    // Minimum server version: 5.2
    DeleteEphemeralPost(userId, postId string)

    // DeletePost deletes a post.
    //
    // @tag Post
    // Minimum server version: 5.2
    DeletePost(postId string) *model.AppError

    // GetPostThread gets a post with all the other posts in the same thread.
    //
    // @tag Post
    // Minimum server version: 5.6
    GetPostThread(postId string) (*model.PostList, *model.AppError)

    // GetPost gets a post.
    //
    // @tag Post
    // Minimum server version: 5.2
    GetPost(postId string) (*model.Post, *model.AppError)

    // GetPostsSince gets posts created after a specified time as Unix time in milliseconds.
    //
    // @tag Post
    // @tag Channel
    // Minimum server version: 5.6
    GetPostsSince(channelId string, time int64) (*model.PostList, *model.AppError)

    // GetPostsAfter gets a page of posts that were posted after the post provided.
    //
    // @tag Post
    // @tag Channel
    // Minimum server version: 5.6
    GetPostsAfter(channelId, postId string, page, perPage int) (*model.PostList, *model.AppError)

    // GetPostsBefore gets a page of posts that were posted before the post provided.
    //
    // @tag Post
    // @tag Channel
    // Minimum server version: 5.6
    GetPostsBefore(channelId, postId string, page, perPage int) (*model.PostList, *model.AppError)

    // GetPostsForChannel gets a list of posts for a channel.
    //
    // @tag Post
    // @tag Channel
    // Minimum server version: 5.6
    GetPostsForChannel(channelId string, page, perPage int) (*model.PostList, *model.AppError)

    // GetTeamStats gets a team's statistics
    //
    // @tag Team
    // Minimum server version: 5.8
    GetTeamStats(teamId string) (*model.TeamStats, *model.AppError)

    // UpdatePost updates a post.
    //
    // @tag Post
    // Minimum server version: 5.2
    UpdatePost(post *model.Post) (*model.Post, *model.AppError)

    // GetProfileImage gets user's profile image.
    //
    // @tag User
    // Minimum server version: 5.6
    GetProfileImage(userId string) ([]byte, *model.AppError)

    // SetProfileImage sets a user's profile image.
    //
    // @tag User
    // Minimum server version: 5.6
    SetProfileImage(userId string, data []byte) *model.AppError

    // GetEmojiList returns a page of custom emoji on the system.
    //
    // The sortBy parameter can be: "name".
    //
    // @tag Emoji
    // Minimum server version: 5.6
    GetEmojiList(sortBy string, page, perPage int) ([]*model.Emoji, *model.AppError)

    // GetEmojiByName gets an emoji by it's name.
    //
    // @tag Emoji
    // Minimum server version: 5.6
    GetEmojiByName(name string) (*model.Emoji, *model.AppError)

    // GetEmoji returns a custom emoji based on the emojiId string.
    //
    // @tag Emoji
    // Minimum server version: 5.6
    GetEmoji(emojiId string) (*model.Emoji, *model.AppError)

    // CopyFileInfos 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
    // to CreatePost. Use this API to duplicate a post and its file attachments without
    // actually duplicating the uploaded files.
    //
    // @tag File
    // @tag User
    // Minimum server version: 5.2
    CopyFileInfos(userId string, fileIds []string) ([]string, *model.AppError)

    // GetFileInfo gets a File Info for a specific fileId
    //
    // @tag File
    // Minimum server version: 5.3
    GetFileInfo(fileId string) (*model.FileInfo, *model.AppError)

    // GetFileInfos gets File Infos with options
    //
    // @tag File
    // Minimum server version: 5.22
    GetFileInfos(page, perPage int, opt *model.GetFileInfosOptions) ([]*model.FileInfo, *model.AppError)

    // GetFile gets content of a file by it's ID
    //
    // @tag File
    // Minimum server version: 5.8
    GetFile(fileId string) ([]byte, *model.AppError)

    // GetFileLink gets the public link to a file by fileId.
    //
    // @tag File
    // Minimum server version: 5.6
    GetFileLink(fileId string) (string, *model.AppError)

    // ReadFile reads the file from the backend for a specific path
    //
    // @tag File
    // Minimum server version: 5.3
    ReadFile(path string) ([]byte, *model.AppError)

    // GetEmojiImage returns the emoji image.
    //
    // @tag Emoji
    // Minimum server version: 5.6
    GetEmojiImage(emojiId string) ([]byte, string, *model.AppError)

    // UploadFile will upload a file to a channel using a multipart request, to be later attached to a post.
    //
    // @tag File
    // @tag Channel
    // Minimum server version: 5.6
    UploadFile(data []byte, channelId string, filename string) (*model.FileInfo, *model.AppError)

    // 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
    OpenInteractiveDialog(dialog model.OpenDialogRequest) *model.AppError

    // GetPlugins will return a list of plugin manifests for currently active plugins.
    //
    // @tag Plugin
    // Minimum server version: 5.6
    GetPlugins() ([]*model.Manifest, *model.AppError)

    // EnablePlugin will enable an plugin installed.
    //
    // @tag Plugin
    // Minimum server version: 5.6
    EnablePlugin(id string) *model.AppError

    // DisablePlugin will disable an enabled plugin.
    //
    // @tag Plugin
    // Minimum server version: 5.6
    DisablePlugin(id string) *model.AppError

    // RemovePlugin will disable and delete a plugin.
    //
    // @tag Plugin
    // Minimum server version: 5.6
    RemovePlugin(id string) *model.AppError

    // GetPluginStatus will return the status of a plugin.
    //
    // @tag Plugin
    // Minimum server version: 5.6
    GetPluginStatus(id string) (*model.PluginStatus, *model.AppError)

    // InstallPlugin will upload another plugin with tar.gz file.
    // Previous version will be replaced on replace true.
    //
    // @tag Plugin
    // Minimum server version: 5.18
    InstallPlugin(file io.Reader, replace bool) (*model.Manifest, *model.AppError)

    // KVSet stores a key-value pair, unique per plugin.
    // Provided helper functions and internal plugin code will use the prefix `mmi_` before keys. Do not use this prefix.
    //
    // @tag KeyValueStore
    // Minimum server version: 5.2
    KVSet(key string, value []byte) *model.AppError

    // KVCompareAndSet updates a key-value pair, unique per plugin, but only if the current value matches the given oldValue.
    // Inserts a new key if oldValue == nil.
    // Returns (false, err) if DB error occurred
    // Returns (false, nil) if current value != oldValue or key already exists when inserting
    // Returns (true, nil) if current value == oldValue or new key is inserted
    //
    // @tag KeyValueStore
    // Minimum server version: 5.12
    KVCompareAndSet(key string, oldValue, newValue []byte) (bool, *model.AppError)

    // KVCompareAndDelete deletes a key-value pair, unique per plugin, but only if the current value matches the given oldValue.
    // 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
    //
    // @tag KeyValueStore
    // Minimum server version: 5.16
    KVCompareAndDelete(key string, oldValue []byte) (bool, *model.AppError)

    // KVSetWithOptions stores a key-value pair, unique per plugin, according to the given options.
    // 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.20
    KVSetWithOptions(key string, value []byte, options model.PluginKVSetOptions) (bool, *model.AppError)

    // KVSet stores a key-value pair with an expiry time, unique per plugin.
    //
    // @tag KeyValueStore
    // Minimum server version: 5.6
    KVSetWithExpiry(key string, value []byte, expireInSeconds int64) *model.AppError

    // KVGet retrieves a value based on the key, unique per plugin. Returns nil for non-existent keys.
    //
    // @tag KeyValueStore
    // Minimum server version: 5.2
    KVGet(key string) ([]byte, *model.AppError)

    // KVDelete removes a key-value pair, unique per plugin. Returns nil for non-existent keys.
    //
    // @tag KeyValueStore
    // Minimum server version: 5.2
    KVDelete(key string) *model.AppError

    // KVDeleteAll removes all key-value pairs for a plugin.
    //
    // @tag KeyValueStore
    // Minimum server version: 5.6
    KVDeleteAll() *model.AppError

    // KVList lists all keys for a plugin.
    //
    // @tag KeyValueStore
    // Minimum server version: 5.6
    KVList(page, perPage int) ([]string, *model.AppError)

    // 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
    PublishWebSocketEvent(event string, payload map[string]interface{}, broadcast *model.WebsocketBroadcast)

    // HasPermissionTo check if the user has the permission at system scope.
    //
    // @tag User
    // Minimum server version: 5.3
    HasPermissionTo(userId string, permission *model.Permission) bool

    // HasPermissionToTeam check if the user has the permission at team scope.
    //
    // @tag User
    // @tag Team
    // Minimum server version: 5.3
    HasPermissionToTeam(userId, teamId string, permission *model.Permission) bool

    // HasPermissionToChannel check if the user has the permission at channel scope.
    //
    // @tag User
    // @tag Channel
    // Minimum server version: 5.3
    HasPermissionToChannel(userId, channelId string, permission *model.Permission) bool

    // LogDebug writes a log message to the Mattermost server log file.
    // Appropriate context such as the plugin name will already be added as fields so plugins
    // do not need to add that info.
    //
    // @tag Logging
    // Minimum server version: 5.2
    LogDebug(msg string, keyValuePairs ...interface{})

    // LogInfo writes a log message to the Mattermost server log file.
    // Appropriate context such as the plugin name will already be added as fields so plugins
    // do not need to add that info.
    //
    // @tag Logging
    // Minimum server version: 5.2
    LogInfo(msg string, keyValuePairs ...interface{})

    // LogError writes a log message to the Mattermost server log file.
    // Appropriate context such as the plugin name will already be added as fields so plugins
    // do not need to add that info.
    //
    // @tag Logging
    // Minimum server version: 5.2
    LogError(msg string, keyValuePairs ...interface{})

    // LogWarn writes a log message to the Mattermost server log file.
    // Appropriate context such as the plugin name will already be added as fields so plugins
    // do not need to add that info.
    //
    // @tag Logging
    // Minimum server version: 5.2
    LogWarn(msg string, keyValuePairs ...interface{})

    // SendMail sends an email to a specific address
    //
    // Minimum server version: 5.7
    SendMail(to, subject, htmlBody string) *model.AppError

    // CreateBot creates the given bot and corresponding user.
    //
    // @tag Bot
    // Minimum server version: 5.10
    CreateBot(bot *model.Bot) (*model.Bot, *model.AppError)

    // PatchBot applies the given patch to the bot and corresponding user.
    //
    // @tag Bot
    // Minimum server version: 5.10
    PatchBot(botUserId string, botPatch *model.BotPatch) (*model.Bot, *model.AppError)

    // GetBot returns the given bot.
    //
    // @tag Bot
    // Minimum server version: 5.10
    GetBot(botUserId string, includeDeleted bool) (*model.Bot, *model.AppError)

    // GetBots returns the requested page of bots.
    //
    // @tag Bot
    // Minimum server version: 5.10
    GetBots(options *model.BotGetOptions) ([]*model.Bot, *model.AppError)

    // UpdateBotActive marks a bot as active or inactive, along with its corresponding user.
    //
    // @tag Bot
    // Minimum server version: 5.10
    UpdateBotActive(botUserId string, active bool) (*model.Bot, *model.AppError)

    // PermanentDeleteBot permanently deletes a bot and its corresponding user.
    //
    // @tag Bot
    // Minimum server version: 5.10
    PermanentDeleteBot(botUserId string) *model.AppError

    // GetBotIconImage gets LHS bot icon image.
    //
    // @tag Bot
    // Minimum server version: 5.14
    GetBotIconImage(botUserId string) ([]byte, *model.AppError)

    // SetBotIconImage sets LHS bot icon image.
    // Icon image must be SVG format, all other formats are rejected.
    //
    // @tag Bot
    // Minimum server version: 5.14
    SetBotIconImage(botUserId string, data []byte) *model.AppError

    // DeleteBotIconImage deletes LHS bot icon image.
    //
    // @tag Bot
    // Minimum server version: 5.14
    DeleteBotIconImage(botUserId string) *model.AppError

    // PluginHTTP allows inter-plugin requests to plugin APIs.
    //
    // Minimum server version: 5.18
    PluginHTTP(request *http.Request) *http.Response
}

The API can be used to retrieve data or perform actions on behalf of the plugin. Most methods have direct counterparts in the REST API and very similar behavior.

Plugins obtain access to the API by embedding MattermostPlugin and accessing the API member directly.

type Context Uses

type Context struct {
    SessionId      string
    RequestId      string
    IpAddress      string
    AcceptLanguage string
    UserAgent      string
    SourcePluginId string
}

Context passes through metadata about the request or hook event. For requests this is built in app/plugin_requests.go For hooks, app.PluginContext() is called.

type EnsureBotOption Uses

type EnsureBotOption func(*ensureBotOptions)

func IconImagePath Uses

func IconImagePath(path string) EnsureBotOption

func ProfileImagePath Uses

func ProfileImagePath(path string) EnsureBotOption

type Environment Uses

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

Environment represents the execution environment of active plugins.

It is meant for use by the Mattermost server to manipulate, interact with and report on the set of active plugins.

func NewEnvironment Uses

func NewEnvironment(newAPIImpl apiImplCreatorFunc, pluginDir string, webappPluginDir string, logger *mlog.Logger, metrics einterfaces.MetricsInterface) (*Environment, error)

func (*Environment) Activate Uses

func (env *Environment) Activate(id string) (manifest *model.Manifest, activated bool, reterr error)

func (*Environment) Active Uses

func (env *Environment) Active() []*model.BundleInfo

Returns a list of all currently active plugins within the environment. The returned list should not be modified.

func (*Environment) Available Uses

func (env *Environment) Available() ([]*model.BundleInfo, error)

Returns a list of all plugins within the environment.

func (*Environment) Deactivate Uses

func (env *Environment) Deactivate(id string) bool

Deactivates the plugin with the given id.

func (*Environment) GetManifest Uses

func (env *Environment) GetManifest(pluginId string) (*model.Manifest, error)

GetManifest returns a manifest for a given pluginId. Returns ErrNotFound if plugin is not found.

func (*Environment) GetPluginState Uses

func (env *Environment) GetPluginState(id string) int

GetPluginState returns the current state of a plugin (disabled, running, or error)

func (*Environment) HooksForPlugin Uses

func (env *Environment) HooksForPlugin(id string) (Hooks, error)

HooksForPlugin returns the hooks API for the plugin with the given id.

Consider using RunMultiPluginHook instead.

func (*Environment) InitPluginHealthCheckJob Uses

func (env *Environment) InitPluginHealthCheckJob(enable bool)

InitPluginHealthCheckJob starts a new job if one is not running and is set to enabled, or kills an existing one if set to disabled.

func (*Environment) IsActive Uses

func (env *Environment) IsActive(id string) bool

IsActive returns true if the plugin with the given id is active.

func (*Environment) PrepackagedPlugins Uses

func (env *Environment) PrepackagedPlugins() []*PrepackagedPlugin

Returns a list of prepackaged plugins available in the local prepackaged_plugins folder. The list content is immutable and should not be modified.

func (*Environment) PublicFilesPath Uses

func (env *Environment) PublicFilesPath(id string) (string, error)

PublicFilesPath returns a path and true if the plugin with the given id is active. It returns an empty string and false if the path is not set or invalid

func (*Environment) RemovePlugin Uses

func (env *Environment) RemovePlugin(id string)

func (*Environment) RestartPlugin Uses

func (env *Environment) RestartPlugin(id string) error

RestartPlugin deactivates, then activates the plugin with the given id.

func (*Environment) RunMultiPluginHook Uses

func (env *Environment) RunMultiPluginHook(hookRunnerFunc func(hooks Hooks) bool, hookId int)

RunMultiPluginHook invokes hookRunnerFunc for each active plugin that implements the given hookId.

If hookRunnerFunc returns false, iteration will not continue. The iteration order among active plugins is not specified.

func (*Environment) SetPluginState Uses

func (env *Environment) SetPluginState(id string, state int)

SetPluginState sets the current state of a plugin (disabled, running, or error)

func (*Environment) SetPrepackagedPlugins Uses

func (env *Environment) SetPrepackagedPlugins(plugins []*PrepackagedPlugin)

SetPrepackagedPlugins saves prepackaged plugins in the environment.

func (*Environment) Shutdown Uses

func (env *Environment) Shutdown()

Shutdown deactivates all plugins and gracefully shuts down the environment.

func (*Environment) Statuses Uses

func (env *Environment) Statuses() (model.PluginStatuses, error)

Statuses returns a list of plugin statuses representing the state of every plugin

func (*Environment) UnpackWebappBundle Uses

func (env *Environment) UnpackWebappBundle(id string) (*model.Manifest, error)

UnpackWebappBundle unpacks webapp bundle for a given plugin id on disk.

type ErrorString Uses

type ErrorString struct {
    Err string
}

ErrorString is a fallback for sending unregistered implementations of the error interface across rpc. For example, the errorString type from the github.com/pkg/errors package cannot be registered since it is not exported, but this precludes common error handling paradigms. ErrorString merely preserves the string description of the error, while satisfying the error interface itself to allow other registered types (such as model.AppError) to be sent unmodified.

func (ErrorString) Error Uses

func (e ErrorString) Error() string

type Helpers Uses

type Helpers interface {
    // 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
    EnsureBot(bot *model.Bot, options ...EnsureBotOption) (string, error)

    // KVSetJSON stores a key-value pair, unique per plugin, marshalling the given value as a JSON string.
    //
    // Deprecated: Use p.API.KVSetWithOptions instead.
    //
    // Minimum server version: 5.2
    KVSetJSON(key string, value interface{}) error

    // KVCompareAndSetJSON updates a key-value pair, unique per plugin, but only if the current value matches the given oldValue after marshalling as a JSON string.
    // Inserts a new key if oldValue == nil.
    // Returns (false, err) if DB error occurred
    // Returns (false, nil) if current value != oldValue or key already exists when inserting
    // Returns (true, nil) if current value == oldValue or new key is inserted
    //
    // Deprecated: Use p.API.KVSetWithOptions instead.
    //
    // Minimum server version: 5.12
    KVCompareAndSetJSON(key string, oldValue interface{}, newValue interface{}) (bool, error)

    // KVCompareAndDeleteJSON deletes a key-value pair, unique per plugin, but only if the current value matches the given oldValue after marshalling as a JSON string.
    // Returns (false, err) if DB error occurred
    // Returns (false, nil) if current value != oldValue or the key was already deleted
    // Returns (true, nil) if current value == oldValue
    //
    // Minimum server version: 5.16
    KVCompareAndDeleteJSON(key string, oldValue interface{}) (bool, error)

    // KVGetJSON retrieves a value based on the key, unique per plugin, unmarshalling the previously set JSON string into the given value. Returns true if the key exists.
    //
    // Minimum server version: 5.2
    KVGetJSON(key string, value interface{}) (bool, error)

    // KVSetWithExpiryJSON stores a key-value pair with an expiry time, unique per plugin, marshalling the given value as a JSON string.
    //
    // Deprecated: Use p.API.KVSetWithOptions instead.
    //
    // Minimum server version: 5.6
    KVSetWithExpiryJSON(key string, value interface{}, expireInSeconds int64) error

    // KVListWithOptions returns all keys that match the given options.  If no options are provided then all keys are returned.
    //
    // Minimum server version: 5.6
    KVListWithOptions(options ...KVListOption) ([]string, error)

    // CheckRequiredServerConfiguration checks if the server is configured according to
    // plugin requirements.
    //
    // Minimum server version: 5.2
    CheckRequiredServerConfiguration(req *model.Config) (bool, error)

    // ShouldProcessMessage returns if the message should be processed by a message hook.
    //
    // Use this method to avoid processing unnecessary messages in a MessageHasBeenPosted
    // or MessageWillBePosted hook, and indeed in some cases avoid an infinite loop between
    // two automated bots or plugins.
    //
    // The behaviour is customizable using the given options, since plugin needs may vary.
    // By default, system messages and messages from bots will be skipped.
    //
    // Minimum server version: 5.2
    ShouldProcessMessage(post *model.Post, options ...ShouldProcessMessageOption) (bool, error)

    // InstallPluginFromURL installs the plugin from the provided url.
    //
    // Minimum server version: 5.18
    InstallPluginFromURL(downloadURL string, replace bool) (*model.Manifest, error)
}

Helpers provide a common patterns plugins use.

Plugins obtain access to the Helpers by embedding MattermostPlugin.

type HelpersImpl Uses

type HelpersImpl struct {
    API API
}

HelpersImpl implements the helpers interface with an API that retrieves data on behalf of the plugin.

func (*HelpersImpl) CheckRequiredServerConfiguration Uses

func (p *HelpersImpl) CheckRequiredServerConfiguration(req *model.Config) (bool, error)

CheckRequiredServerConfiguration implements Helpers.CheckRequiredServerConfiguration

func (*HelpersImpl) EnsureBot Uses

func (p *HelpersImpl) EnsureBot(bot *model.Bot, options ...EnsureBotOption) (retBotID string, retErr error)

EnsureBot implements Helpers.EnsureBot

func (*HelpersImpl) InstallPluginFromURL Uses

func (p *HelpersImpl) InstallPluginFromURL(downloadURL string, replace bool) (*model.Manifest, error)

InstallPluginFromURL implements Helpers.InstallPluginFromURL.

func (*HelpersImpl) KVCompareAndDeleteJSON Uses

func (p *HelpersImpl) KVCompareAndDeleteJSON(key string, oldValue interface{}) (bool, error)

KVCompareAndDeleteJSON implements Helpers.KVCompareAndDeleteJSON.

func (*HelpersImpl) KVCompareAndSetJSON Uses

func (p *HelpersImpl) KVCompareAndSetJSON(key string, oldValue interface{}, newValue interface{}) (bool, error)

KVCompareAndSetJSON implements Helpers.KVCompareAndSetJSON.

func (*HelpersImpl) KVGetJSON Uses

func (p *HelpersImpl) KVGetJSON(key string, value interface{}) (bool, error)

KVGetJSON implements Helpers.KVGetJSON.

func (*HelpersImpl) KVListWithOptions Uses

func (p *HelpersImpl) KVListWithOptions(options ...KVListOption) ([]string, error)

KVListWithOptions implements Helpers.KVListWithOptions.

func (*HelpersImpl) KVSetJSON Uses

func (p *HelpersImpl) KVSetJSON(key string, value interface{}) error

KVSetJSON implements Helpers.KVSetJSON.

func (*HelpersImpl) KVSetWithExpiryJSON Uses

func (p *HelpersImpl) KVSetWithExpiryJSON(key string, value interface{}, expireInSeconds int64) error

KVSetWithExpiryJSON is a wrapper around KVSetWithExpiry to simplify atomically writing a JSON object with expiry to the key value store.

func (*HelpersImpl) ShouldProcessMessage Uses

func (p *HelpersImpl) ShouldProcessMessage(post *model.Post, options ...ShouldProcessMessageOption) (bool, error)

ShouldProcessMessage implements Helpers.ShouldProcessMessage

type Hooks Uses

type Hooks interface {
    // OnActivate is invoked when the plugin is activated. If an error is returned, the plugin
    // will be terminated. The plugin will not receive hooks until after OnActivate returns
    // without error. OnConfigurationChange will be called once before OnActivate.
    OnActivate() error

    // Implemented returns a list of hooks that are implemented by the plugin.
    // Plugins do not need to provide an implementation. Any given will be ignored.
    Implemented() ([]string, error)

    // OnDeactivate is invoked when the plugin is deactivated. This is the plugin's last chance to
    // use the API, and the plugin will be terminated shortly after this invocation. The plugin
    // will stop receiving hooks just prior to this method being called.
    OnDeactivate() error

    // OnConfigurationChange is invoked when configuration changes may have been made. Any
    // returned error is logged, but does not stop the plugin. You must be prepared to handle
    // a configuration failure gracefully. It is called once before OnActivate.
    OnConfigurationChange() error

    // ServeHTTP allows the plugin to implement the http.Handler interface. Requests destined for
    // the /plugins/{id} path will be routed to the plugin.
    //
    // The Mattermost-User-Id header will be present if (and only if) the request is by an
    // authenticated user.
    ServeHTTP(c *Context, w http.ResponseWriter, r *http.Request)

    // ExecuteCommand executes a command that has been previously registered via the RegisterCommand
    // API.
    ExecuteCommand(c *Context, args *model.CommandArgs) (*model.CommandResponse, *model.AppError)

    // UserHasBeenCreated is invoked after a user was created.
    //
    // Minimum server version: 5.10
    UserHasBeenCreated(c *Context, user *model.User)

    // UserWillLogIn before the login of the user is returned. Returning a non empty string will reject the login event.
    // If you don't need to reject the login event, see UserHasLoggedIn
    UserWillLogIn(c *Context, user *model.User) string

    // UserHasLoggedIn is invoked after a user has logged in.
    UserHasLoggedIn(c *Context, user *model.User)

    // MessageWillBePosted is invoked when a message is posted by a user before it is committed
    // to the database. If you also want to act on edited posts, see MessageWillBeUpdated.
    //
    // To reject a post, return an non-empty string describing why the post was rejected.
    // To modify the post, return the replacement, non-nil *model.Post and an empty string.
    // To allow the post without modification, return a nil *model.Post and an empty string.
    // To dismiss the post, return a nil *model.Post and the const DismissPostError string.
    //
    // If you don't need to modify or reject posts, use MessageHasBeenPosted instead.
    //
    // Note that this method will be called for posts created by plugins, including the plugin that
    // created the post.
    MessageWillBePosted(c *Context, post *model.Post) (*model.Post, string)

    // MessageWillBeUpdated is invoked when a message is updated by a user before it is committed
    // to the database. If you also want to act on new posts, see MessageWillBePosted.
    // Return values should be the modified post or nil if rejected and an explanation for the user.
    // On rejection, the post will be kept in its previous state.
    //
    // If you don't need to modify or rejected updated posts, use MessageHasBeenUpdated instead.
    //
    // Note that this method will be called for posts updated by plugins, including the plugin that
    // updated the post.
    MessageWillBeUpdated(c *Context, newPost, oldPost *model.Post) (*model.Post, string)

    // MessageHasBeenPosted is invoked after the message has been committed to the database.
    // If you need to modify or reject the post, see MessageWillBePosted
    // Note that this method will be called for posts created by plugins, including the plugin that
    // created the post.
    MessageHasBeenPosted(c *Context, post *model.Post)

    // MessageHasBeenUpdated is invoked after a message is updated and has been updated in the database.
    // If you need to modify or reject the post, see MessageWillBeUpdated
    // Note that this method will be called for posts created by plugins, including the plugin that
    // created the post.
    MessageHasBeenUpdated(c *Context, newPost, oldPost *model.Post)

    // ChannelHasBeenCreated is invoked after the channel has been committed to the database.
    ChannelHasBeenCreated(c *Context, channel *model.Channel)

    // UserHasJoinedChannel is invoked after the membership has been committed to the database.
    // If actor is not nil, the user was invited to the channel by the actor.
    UserHasJoinedChannel(c *Context, channelMember *model.ChannelMember, actor *model.User)

    // UserHasLeftChannel is invoked after the membership has been removed from the database.
    // If actor is not nil, the user was removed from the channel by the actor.
    UserHasLeftChannel(c *Context, channelMember *model.ChannelMember, actor *model.User)

    // UserHasJoinedTeam is invoked after the membership has been committed to the database.
    // If actor is not nil, the user was added to the team by the actor.
    UserHasJoinedTeam(c *Context, teamMember *model.TeamMember, actor *model.User)

    // UserHasLeftTeam is invoked after the membership has been removed from the database.
    // If actor is not nil, the user was removed from the team by the actor.
    UserHasLeftTeam(c *Context, teamMember *model.TeamMember, actor *model.User)

    // FileWillBeUploaded is invoked when a file is uploaded, but before it is committed to backing store.
    // Read from file to retrieve the body of the uploaded file.
    //
    // To reject a file upload, return an non-empty string describing why the file was rejected.
    // To modify the file, write to the output and/or return a non-nil *model.FileInfo, as well as an empty string.
    // To allow the file without modification, do not write to the output and return a nil *model.FileInfo and an empty string.
    //
    // Note that this method will be called for files uploaded by plugins, including the plugin that uploaded the post.
    // FileInfo.Size will be automatically set properly if you modify the file.
    FileWillBeUploaded(c *Context, info *model.FileInfo, file io.Reader, output io.Writer) (*model.FileInfo, string)
}

Hooks describes the methods a plugin may implement to automatically receive the corresponding event.

A plugin only need implement the hooks it cares about. The MattermostPlugin provides some default implementations for convenience but may be overridden.

type KVListOption Uses

type KVListOption func(*kvListOptions)

KVListOption represents a single input option for KVListWithOptions

func WithChecker Uses

func WithChecker(f func(key string) (keep bool, err error)) KVListOption

WithChecker allows for a custom filter function to determine which keys to return. Returning true will keep the key and false will filter it out. Returning an error will halt KVListWithOptions immediately and pass the error up (with no other results).

func WithPrefix Uses

func WithPrefix(prefix string) KVListOption

WithPrefix only return keys that start with the given string.

type MattermostPlugin Uses

type MattermostPlugin struct {
    // API exposes the plugin api, and becomes available just prior to the OnActive hook.
    API     API
    Helpers Helpers
}

func (*MattermostPlugin) SetAPI Uses

func (p *MattermostPlugin) SetAPI(api API)

SetAPI persists the given API interface to the plugin. It is invoked just prior to the OnActivate hook, exposing the API for use by the plugin.

func (*MattermostPlugin) SetHelpers Uses

func (p *MattermostPlugin) SetHelpers(helpers Helpers)

SetHelpers does the same thing as SetAPI except for the plugin helpers.

type PluginHealthCheckJob Uses

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

func (*PluginHealthCheckJob) Cancel Uses

func (job *PluginHealthCheckJob) Cancel()

func (*PluginHealthCheckJob) Start Uses

func (job *PluginHealthCheckJob) Start()

Start continuously runs health checks on all active plugins, on a timer.

type PrepackagedPlugin Uses

type PrepackagedPlugin struct {
    Path      string
    IconData  string
    Manifest  *model.Manifest
    Signature []byte
}

PrepackagedPlugin is a plugin prepackaged with the server and found on startup.

type ShouldProcessMessageOption Uses

type ShouldProcessMessageOption func(*shouldProcessMessageOptions)

func AllowBots Uses

func AllowBots() ShouldProcessMessageOption

AllowBots configures a call to ShouldProcessMessage to return true for bot posts.

As it is typically desirable only to consume messages from human users of the system, ShouldProcessMessage ignores bot messages by default. When allowing bots, take care to avoid a loop where two plugins respond to each others posts repeatedly.

func AllowSystemMessages Uses

func AllowSystemMessages() ShouldProcessMessageOption

AllowSystemMessages configures a call to ShouldProcessMessage to return true for system messages.

As it is typically desirable only to consume messages from users of the system, ShouldProcessMessage ignores system messages by default.

func AllowWebhook Uses

func AllowWebhook() ShouldProcessMessageOption

AllowWebhook configures a call to ShouldProcessMessage to return true for posts from webhook.

As it is typically desirable only to consume messages from human users of the system, ShouldProcessMessage ignores webhook messages by default.

func FilterChannelIDs Uses

func FilterChannelIDs(filterChannelIDs []string) ShouldProcessMessageOption

FilterChannelIDs configures a call to ShouldProcessMessage to return true only for the given channels.

By default, posts from all channels are allowed to be processed.

func FilterUserIDs Uses

func FilterUserIDs(filterUserIDs []string) ShouldProcessMessageOption

FilterUserIDs configures a call to ShouldProcessMessage to return true only for the given users.

By default, posts from all non-bot users are allowed.

func OnlyBotDMs Uses

func OnlyBotDMs() ShouldProcessMessageOption

OnlyBotDMs configures a call to ShouldProcessMessage to return true only for direct messages sent to the bot created by EnsureBot.

By default, posts from all channels are allowed.

type Z_AddChannelMemberArgs Uses

type Z_AddChannelMemberArgs struct {
    A   string
    B   string
}

type Z_AddChannelMemberReturns Uses

type Z_AddChannelMemberReturns struct {
    A   *model.ChannelMember
    B   *model.AppError
}

type Z_AddReactionArgs Uses

type Z_AddReactionArgs struct {
    A *model.Reaction
}

type Z_AddReactionReturns Uses

type Z_AddReactionReturns struct {
    A   *model.Reaction
    B   *model.AppError
}

type Z_AddUserToChannelArgs Uses

type Z_AddUserToChannelArgs struct {
    A   string
    B   string
    C   string
}

type Z_AddUserToChannelReturns Uses

type Z_AddUserToChannelReturns struct {
    A   *model.ChannelMember
    B   *model.AppError
}

type Z_ChannelHasBeenCreatedArgs Uses

type Z_ChannelHasBeenCreatedArgs struct {
    A   *Context
    B   *model.Channel
}

type Z_ChannelHasBeenCreatedReturns Uses

type Z_ChannelHasBeenCreatedReturns struct {
}

type Z_CopyFileInfosArgs Uses

type Z_CopyFileInfosArgs struct {
    A   string
    B   []string
}

type Z_CopyFileInfosReturns Uses

type Z_CopyFileInfosReturns struct {
    A   []string
    B   *model.AppError
}

type Z_CreateBotArgs Uses

type Z_CreateBotArgs struct {
    A *model.Bot
}

type Z_CreateBotReturns Uses

type Z_CreateBotReturns struct {
    A   *model.Bot
    B   *model.AppError
}

type Z_CreateChannelArgs Uses

type Z_CreateChannelArgs struct {
    A *model.Channel
}

type Z_CreateChannelReturns Uses

type Z_CreateChannelReturns struct {
    A   *model.Channel
    B   *model.AppError
}

type Z_CreatePostArgs Uses

type Z_CreatePostArgs struct {
    A *model.Post
}

type Z_CreatePostReturns Uses

type Z_CreatePostReturns struct {
    A   *model.Post
    B   *model.AppError
}

type Z_CreateTeamArgs Uses

type Z_CreateTeamArgs struct {
    A *model.Team
}

type Z_CreateTeamMemberArgs Uses

type Z_CreateTeamMemberArgs struct {
    A   string
    B   string
}

type Z_CreateTeamMemberReturns Uses

type Z_CreateTeamMemberReturns struct {
    A   *model.TeamMember
    B   *model.AppError
}

type Z_CreateTeamMembersArgs Uses

type Z_CreateTeamMembersArgs struct {
    A   string
    B   []string
    C   string
}

type Z_CreateTeamMembersGracefullyArgs Uses

type Z_CreateTeamMembersGracefullyArgs struct {
    A   string
    B   []string
    C   string
}

type Z_CreateTeamMembersGracefullyReturns Uses

type Z_CreateTeamMembersGracefullyReturns struct {
    A   []*model.TeamMemberWithError
    B   *model.AppError
}

type Z_CreateTeamMembersReturns Uses

type Z_CreateTeamMembersReturns struct {
    A   []*model.TeamMember
    B   *model.AppError
}

type Z_CreateTeamReturns Uses

type Z_CreateTeamReturns struct {
    A   *model.Team
    B   *model.AppError
}

type Z_CreateUserArgs Uses

type Z_CreateUserArgs struct {
    A *model.User
}

type Z_CreateUserReturns Uses

type Z_CreateUserReturns struct {
    A   *model.User
    B   *model.AppError
}

type Z_DeleteBotIconImageArgs Uses

type Z_DeleteBotIconImageArgs struct {
    A string
}

type Z_DeleteBotIconImageReturns Uses

type Z_DeleteBotIconImageReturns struct {
    A *model.AppError
}

type Z_DeleteChannelArgs Uses

type Z_DeleteChannelArgs struct {
    A string
}

type Z_DeleteChannelMemberArgs Uses

type Z_DeleteChannelMemberArgs struct {
    A   string
    B   string
}

type Z_DeleteChannelMemberReturns Uses

type Z_DeleteChannelMemberReturns struct {
    A *model.AppError
}

type Z_DeleteChannelReturns Uses

type Z_DeleteChannelReturns struct {
    A *model.AppError
}

type Z_DeleteEphemeralPostArgs Uses

type Z_DeleteEphemeralPostArgs struct {
    A   string
    B   string
}

type Z_DeleteEphemeralPostReturns Uses

type Z_DeleteEphemeralPostReturns struct {
}

type Z_DeletePostArgs Uses

type Z_DeletePostArgs struct {
    A string
}

type Z_DeletePostReturns Uses

type Z_DeletePostReturns struct {
    A *model.AppError
}

type Z_DeleteTeamArgs Uses

type Z_DeleteTeamArgs struct {
    A string
}

type Z_DeleteTeamMemberArgs Uses

type Z_DeleteTeamMemberArgs struct {
    A   string
    B   string
    C   string
}

type Z_DeleteTeamMemberReturns Uses

type Z_DeleteTeamMemberReturns struct {
    A *model.AppError
}

type Z_DeleteTeamReturns Uses

type Z_DeleteTeamReturns struct {
    A *model.AppError
}

type Z_DeleteUserArgs Uses

type Z_DeleteUserArgs struct {
    A string
}

type Z_DeleteUserReturns Uses

type Z_DeleteUserReturns struct {
    A *model.AppError
}

type Z_DisablePluginArgs Uses

type Z_DisablePluginArgs struct {
    A string
}

type Z_DisablePluginReturns Uses

type Z_DisablePluginReturns struct {
    A *model.AppError
}

type Z_EnablePluginArgs Uses

type Z_EnablePluginArgs struct {
    A string
}

type Z_EnablePluginReturns Uses

type Z_EnablePluginReturns struct {
    A *model.AppError
}

type Z_ExecuteCommandArgs Uses

type Z_ExecuteCommandArgs struct {
    A   *Context
    B   *model.CommandArgs
}

type Z_ExecuteCommandReturns Uses

type Z_ExecuteCommandReturns struct {
    A   *model.CommandResponse
    B   *model.AppError
}

type Z_FileWillBeUploadedArgs Uses

type Z_FileWillBeUploadedArgs struct {
    A                     *Context
    B                     *model.FileInfo
    UploadedFileStream    uint32
    ReplacementFileStream uint32
}

type Z_FileWillBeUploadedReturns Uses

type Z_FileWillBeUploadedReturns struct {
    A   *model.FileInfo
    B   string
}

type Z_GetBotArgs Uses

type Z_GetBotArgs struct {
    A   string
    B   bool
}

type Z_GetBotIconImageArgs Uses

type Z_GetBotIconImageArgs struct {
    A string
}

type Z_GetBotIconImageReturns Uses

type Z_GetBotIconImageReturns struct {
    A   []byte
    B   *model.AppError
}

type Z_GetBotReturns Uses

type Z_GetBotReturns struct {
    A   *model.Bot
    B   *model.AppError
}

type Z_GetBotsArgs Uses

type Z_GetBotsArgs struct {
    A *model.BotGetOptions
}

type Z_GetBotsReturns Uses

type Z_GetBotsReturns struct {
    A   []*model.Bot
    B   *model.AppError
}

type Z_GetBundlePathArgs Uses

type Z_GetBundlePathArgs struct {
}

type Z_GetBundlePathReturns Uses

type Z_GetBundlePathReturns struct {
    A   string
    B   error
}

type Z_GetChannelArgs Uses

type Z_GetChannelArgs struct {
    A string
}

type Z_GetChannelByNameArgs Uses

type Z_GetChannelByNameArgs struct {
    A   string
    B   string
    C   bool
}

type Z_GetChannelByNameForTeamNameArgs Uses

type Z_GetChannelByNameForTeamNameArgs struct {
    A   string
    B   string
    C   bool
}

type Z_GetChannelByNameForTeamNameReturns Uses

type Z_GetChannelByNameForTeamNameReturns struct {
    A   *model.Channel
    B   *model.AppError
}

type Z_GetChannelByNameReturns Uses

type Z_GetChannelByNameReturns struct {
    A   *model.Channel
    B   *model.AppError
}

type Z_GetChannelMemberArgs Uses

type Z_GetChannelMemberArgs struct {
    A   string
    B   string
}

type Z_GetChannelMemberReturns Uses

type Z_GetChannelMemberReturns struct {
    A   *model.ChannelMember
    B   *model.AppError
}

type Z_GetChannelMembersArgs Uses

type Z_GetChannelMembersArgs struct {
    A   string
    B   int
    C   int
}

type Z_GetChannelMembersByIdsArgs Uses

type Z_GetChannelMembersByIdsArgs struct {
    A   string
    B   []string
}

type Z_GetChannelMembersByIdsReturns Uses

type Z_GetChannelMembersByIdsReturns struct {
    A   *model.ChannelMembers
    B   *model.AppError
}

type Z_GetChannelMembersForUserArgs Uses

type Z_GetChannelMembersForUserArgs struct {
    A   string
    B   string
    C   int
    D   int
}

type Z_GetChannelMembersForUserReturns Uses

type Z_GetChannelMembersForUserReturns struct {
    A   []*model.ChannelMember
    B   *model.AppError
}

type Z_GetChannelMembersReturns Uses

type Z_GetChannelMembersReturns struct {
    A   *model.ChannelMembers
    B   *model.AppError
}

type Z_GetChannelReturns Uses

type Z_GetChannelReturns struct {
    A   *model.Channel
    B   *model.AppError
}

type Z_GetChannelStatsArgs Uses

type Z_GetChannelStatsArgs struct {
    A string
}

type Z_GetChannelStatsReturns Uses

type Z_GetChannelStatsReturns struct {
    A   *model.ChannelStats
    B   *model.AppError
}

type Z_GetChannelsForTeamForUserArgs Uses

type Z_GetChannelsForTeamForUserArgs struct {
    A   string
    B   string
    C   bool
}

type Z_GetChannelsForTeamForUserReturns Uses

type Z_GetChannelsForTeamForUserReturns struct {
    A   []*model.Channel
    B   *model.AppError
}

type Z_GetConfigArgs Uses

type Z_GetConfigArgs struct {
}

type Z_GetConfigReturns Uses

type Z_GetConfigReturns struct {
    A *model.Config
}

type Z_GetDiagnosticIdArgs Uses

type Z_GetDiagnosticIdArgs struct {
}

type Z_GetDiagnosticIdReturns Uses

type Z_GetDiagnosticIdReturns struct {
    A string
}

type Z_GetDirectChannelArgs Uses

type Z_GetDirectChannelArgs struct {
    A   string
    B   string
}

type Z_GetDirectChannelReturns Uses

type Z_GetDirectChannelReturns struct {
    A   *model.Channel
    B   *model.AppError
}

type Z_GetEmojiArgs Uses

type Z_GetEmojiArgs struct {
    A string
}

type Z_GetEmojiByNameArgs Uses

type Z_GetEmojiByNameArgs struct {
    A string
}

type Z_GetEmojiByNameReturns Uses

type Z_GetEmojiByNameReturns struct {
    A   *model.Emoji
    B   *model.AppError
}

type Z_GetEmojiImageArgs Uses

type Z_GetEmojiImageArgs struct {
    A string
}

type Z_GetEmojiImageReturns Uses

type Z_GetEmojiImageReturns struct {
    A   []byte
    B   string
    C   *model.AppError
}

type Z_GetEmojiListArgs Uses

type Z_GetEmojiListArgs struct {
    A   string
    B   int
    C   int
}

type Z_GetEmojiListReturns Uses

type Z_GetEmojiListReturns struct {
    A   []*model.Emoji
    B   *model.AppError
}

type Z_GetEmojiReturns Uses

type Z_GetEmojiReturns struct {
    A   *model.Emoji
    B   *model.AppError
}

type Z_GetFileArgs Uses

type Z_GetFileArgs struct {
    A string
}

type Z_GetFileInfoArgs Uses

type Z_GetFileInfoArgs struct {
    A string
}

type Z_GetFileInfoReturns Uses

type Z_GetFileInfoReturns struct {
    A   *model.FileInfo
    B   *model.AppError
}

type Z_GetFileInfosArgs Uses

type Z_GetFileInfosArgs struct {
    A   int
    B   int
    C   *model.GetFileInfosOptions
}

type Z_GetFileInfosReturns Uses

type Z_GetFileInfosReturns struct {
    A   []*model.FileInfo
    B   *model.AppError
}

type Z_GetFileLinkArgs Uses

type Z_GetFileLinkArgs struct {
    A string
}

type Z_GetFileLinkReturns Uses

type Z_GetFileLinkReturns struct {
    A   string
    B   *model.AppError
}

type Z_GetFileReturns Uses

type Z_GetFileReturns struct {
    A   []byte
    B   *model.AppError
}

type Z_GetGroupArgs Uses

type Z_GetGroupArgs struct {
    A string
}

type Z_GetGroupByNameArgs Uses

type Z_GetGroupByNameArgs struct {
    A string
}

type Z_GetGroupByNameReturns Uses

type Z_GetGroupByNameReturns struct {
    A   *model.Group
    B   *model.AppError
}

type Z_GetGroupChannelArgs Uses

type Z_GetGroupChannelArgs struct {
    A []string
}

type Z_GetGroupChannelReturns Uses

type Z_GetGroupChannelReturns struct {
    A   *model.Channel
    B   *model.AppError
}

type Z_GetGroupReturns Uses

type Z_GetGroupReturns struct {
    A   *model.Group
    B   *model.AppError
}

type Z_GetGroupsForUserArgs Uses

type Z_GetGroupsForUserArgs struct {
    A string
}

type Z_GetGroupsForUserReturns Uses

type Z_GetGroupsForUserReturns struct {
    A   []*model.Group
    B   *model.AppError
}

type Z_GetLDAPUserAttributesArgs Uses

type Z_GetLDAPUserAttributesArgs struct {
    A   string
    B   []string
}

type Z_GetLDAPUserAttributesReturns Uses

type Z_GetLDAPUserAttributesReturns struct {
    A   map[string]string
    B   *model.AppError
}

type Z_GetLicenseArgs Uses

type Z_GetLicenseArgs struct {
}

type Z_GetLicenseReturns Uses

type Z_GetLicenseReturns struct {
    A *model.License
}

type Z_GetPluginConfigArgs Uses

type Z_GetPluginConfigArgs struct {
}

type Z_GetPluginConfigReturns Uses

type Z_GetPluginConfigReturns struct {
    A map[string]interface{}
}

type Z_GetPluginStatusArgs Uses

type Z_GetPluginStatusArgs struct {
    A string
}

type Z_GetPluginStatusReturns Uses

type Z_GetPluginStatusReturns struct {
    A   *model.PluginStatus
    B   *model.AppError
}

type Z_GetPluginsArgs Uses

type Z_GetPluginsArgs struct {
}

type Z_GetPluginsReturns Uses

type Z_GetPluginsReturns struct {
    A   []*model.Manifest
    B   *model.AppError
}

type Z_GetPostArgs Uses

type Z_GetPostArgs struct {
    A string
}

type Z_GetPostReturns Uses

type Z_GetPostReturns struct {
    A   *model.Post
    B   *model.AppError
}

type Z_GetPostThreadArgs Uses

type Z_GetPostThreadArgs struct {
    A string
}

type Z_GetPostThreadReturns Uses

type Z_GetPostThreadReturns struct {
    A   *model.PostList
    B   *model.AppError
}

type Z_GetPostsAfterArgs Uses

type Z_GetPostsAfterArgs struct {
    A   string
    B   string
    C   int
    D   int
}

type Z_GetPostsAfterReturns Uses

type Z_GetPostsAfterReturns struct {
    A   *model.PostList
    B   *model.AppError
}

type Z_GetPostsBeforeArgs Uses

type Z_GetPostsBeforeArgs struct {
    A   string
    B   string
    C   int
    D   int
}

type Z_GetPostsBeforeReturns Uses

type Z_GetPostsBeforeReturns struct {
    A   *model.PostList
    B   *model.AppError
}

type Z_GetPostsForChannelArgs Uses

type Z_GetPostsForChannelArgs struct {
    A   string
    B   int
    C   int
}

type Z_GetPostsForChannelReturns Uses

type Z_GetPostsForChannelReturns struct {
    A   *model.PostList
    B   *model.AppError
}

type Z_GetPostsSinceArgs Uses

type Z_GetPostsSinceArgs struct {
    A   string
    B   int64
}

type Z_GetPostsSinceReturns Uses

type Z_GetPostsSinceReturns struct {
    A   *model.PostList
    B   *model.AppError
}

type Z_GetProfileImageArgs Uses

type Z_GetProfileImageArgs struct {
    A string
}

type Z_GetProfileImageReturns Uses

type Z_GetProfileImageReturns struct {
    A   []byte
    B   *model.AppError
}

type Z_GetPublicChannelsForTeamArgs Uses

type Z_GetPublicChannelsForTeamArgs struct {
    A   string
    B   int
    C   int
}

type Z_GetPublicChannelsForTeamReturns Uses

type Z_GetPublicChannelsForTeamReturns struct {
    A   []*model.Channel
    B   *model.AppError
}

type Z_GetReactionsArgs Uses

type Z_GetReactionsArgs struct {
    A string
}

type Z_GetReactionsReturns Uses

type Z_GetReactionsReturns struct {
    A   []*model.Reaction
    B   *model.AppError
}

type Z_GetServerVersionArgs Uses

type Z_GetServerVersionArgs struct {
}

type Z_GetServerVersionReturns Uses

type Z_GetServerVersionReturns struct {
    A string
}

type Z_GetSessionArgs Uses

type Z_GetSessionArgs struct {
    A string
}

type Z_GetSessionReturns Uses

type Z_GetSessionReturns struct {
    A   *model.Session
    B   *model.AppError
}

type Z_GetSystemInstallDateArgs Uses

type Z_GetSystemInstallDateArgs struct {
}

type Z_GetSystemInstallDateReturns Uses

type Z_GetSystemInstallDateReturns struct {
    A   int64
    B   *model.AppError
}

type Z_GetTeamArgs Uses

type Z_GetTeamArgs struct {
    A string
}

type Z_GetTeamByNameArgs Uses

type Z_GetTeamByNameArgs struct {
    A string
}

type Z_GetTeamByNameReturns Uses

type Z_GetTeamByNameReturns struct {
    A   *model.Team
    B   *model.AppError
}

type Z_GetTeamIconArgs Uses

type Z_GetTeamIconArgs struct {
    A string
}

type Z_GetTeamIconReturns Uses

type Z_GetTeamIconReturns struct {
    A   []byte
    B   *model.AppError
}

type Z_GetTeamMemberArgs Uses

type Z_GetTeamMemberArgs struct {
    A   string
    B   string
}

type Z_GetTeamMemberReturns Uses

type Z_GetTeamMemberReturns struct {
    A   *model.TeamMember
    B   *model.AppError
}

type Z_GetTeamMembersArgs Uses

type Z_GetTeamMembersArgs struct {
    A   string
    B   int
    C   int
}

type Z_GetTeamMembersForUserArgs Uses

type Z_GetTeamMembersForUserArgs struct {
    A   string
    B   int
    C   int
}

type Z_GetTeamMembersForUserReturns Uses

type Z_GetTeamMembersForUserReturns struct {
    A   []*model.TeamMember
    B   *model.AppError
}

type Z_GetTeamMembersReturns Uses

type Z_GetTeamMembersReturns struct {
    A   []*model.TeamMember
    B   *model.AppError
}

type Z_GetTeamReturns Uses

type Z_GetTeamReturns struct {
    A   *model.Team
    B   *model.AppError
}

type Z_GetTeamStatsArgs Uses

type Z_GetTeamStatsArgs struct {
    A string
}

type Z_GetTeamStatsReturns Uses

type Z_GetTeamStatsReturns struct {
    A   *model.TeamStats
    B   *model.AppError
}

type Z_GetTeamsArgs Uses

type Z_GetTeamsArgs struct {
}

type Z_GetTeamsForUserArgs Uses

type Z_GetTeamsForUserArgs struct {
    A string
}

type Z_GetTeamsForUserReturns Uses

type Z_GetTeamsForUserReturns struct {
    A   []*model.Team
    B   *model.AppError
}

type Z_GetTeamsReturns Uses

type Z_GetTeamsReturns struct {
    A   []*model.Team
    B   *model.AppError
}

type Z_GetTeamsUnreadForUserArgs Uses

type Z_GetTeamsUnreadForUserArgs struct {
    A string
}

type Z_GetTeamsUnreadForUserReturns Uses

type Z_GetTeamsUnreadForUserReturns struct {
    A   []*model.TeamUnread
    B   *model.AppError
}

type Z_GetUnsanitizedConfigArgs Uses

type Z_GetUnsanitizedConfigArgs struct {
}

type Z_GetUnsanitizedConfigReturns Uses

type Z_GetUnsanitizedConfigReturns struct {
    A *model.Config
}

type Z_GetUserArgs Uses

type Z_GetUserArgs struct {
    A string
}

type Z_GetUserByEmailArgs Uses

type Z_GetUserByEmailArgs struct {
    A string
}

type Z_GetUserByEmailReturns Uses

type Z_GetUserByEmailReturns struct {
    A   *model.User
    B   *model.AppError
}

type Z_GetUserByUsernameArgs Uses

type Z_GetUserByUsernameArgs struct {
    A string
}

type Z_GetUserByUsernameReturns Uses

type Z_GetUserByUsernameReturns struct {
    A   *model.User
    B   *model.AppError
}

type Z_GetUserReturns Uses

type Z_GetUserReturns struct {
    A   *model.User
    B   *model.AppError
}

type Z_GetUserStatusArgs Uses

type Z_GetUserStatusArgs struct {
    A string
}

type Z_GetUserStatusReturns Uses

type Z_GetUserStatusReturns struct {
    A   *model.Status
    B   *model.AppError
}

type Z_GetUserStatusesByIdsArgs Uses

type Z_GetUserStatusesByIdsArgs struct {
    A []string
}

type Z_GetUserStatusesByIdsReturns Uses

type Z_GetUserStatusesByIdsReturns struct {
    A   []*model.Status
    B   *model.AppError
}

type Z_GetUsersArgs Uses

type Z_GetUsersArgs struct {
    A *model.UserGetOptions
}

type Z_GetUsersByUsernamesArgs Uses

type Z_GetUsersByUsernamesArgs struct {
    A []string
}

type Z_GetUsersByUsernamesReturns Uses

type Z_GetUsersByUsernamesReturns struct {
    A   []*model.User
    B   *model.AppError
}

type Z_GetUsersInChannelArgs Uses

type Z_GetUsersInChannelArgs struct {
    A   string
    B   string
    C   int
    D   int
}

type Z_GetUsersInChannelReturns Uses

type Z_GetUsersInChannelReturns struct {
    A   []*model.User
    B   *model.AppError
}

type Z_GetUsersInTeamArgs Uses

type Z_GetUsersInTeamArgs struct {
    A   string
    B   int
    C   int
}

type Z_GetUsersInTeamReturns Uses

type Z_GetUsersInTeamReturns struct {
    A   []*model.User
    B   *model.AppError
}

type Z_GetUsersReturns Uses

type Z_GetUsersReturns struct {
    A   []*model.User
    B   *model.AppError
}

type Z_HasPermissionToArgs Uses

type Z_HasPermissionToArgs struct {
    A   string
    B   *model.Permission
}

type Z_HasPermissionToChannelArgs Uses

type Z_HasPermissionToChannelArgs struct {
    A   string
    B   string
    C   *model.Permission
}

type Z_HasPermissionToChannelReturns Uses

type Z_HasPermissionToChannelReturns struct {
    A bool
}

type Z_HasPermissionToReturns Uses

type Z_HasPermissionToReturns struct {
    A bool
}

type Z_HasPermissionToTeamArgs Uses

type Z_HasPermissionToTeamArgs struct {
    A   string
    B   string
    C   *model.Permission
}

type Z_HasPermissionToTeamReturns Uses

type Z_HasPermissionToTeamReturns struct {
    A bool
}

type Z_InstallPluginArgs Uses

type Z_InstallPluginArgs struct {
    PluginStreamID uint32
    B              bool
}

type Z_InstallPluginReturns Uses

type Z_InstallPluginReturns struct {
    A   *model.Manifest
    B   *model.AppError
}

type Z_KVCompareAndDeleteArgs Uses

type Z_KVCompareAndDeleteArgs struct {
    A   string
    B   []byte
}

type Z_KVCompareAndDeleteReturns Uses

type Z_KVCompareAndDeleteReturns struct {
    A   bool
    B   *model.AppError
}

type Z_KVCompareAndSetArgs Uses

type Z_KVCompareAndSetArgs struct {
    A   string
    B   []byte
    C   []byte
}

type Z_KVCompareAndSetReturns Uses

type Z_KVCompareAndSetReturns struct {
    A   bool
    B   *model.AppError
}

type Z_KVDeleteAllArgs Uses

type Z_KVDeleteAllArgs struct {
}

type Z_KVDeleteAllReturns Uses

type Z_KVDeleteAllReturns struct {
    A *model.AppError
}

type Z_KVDeleteArgs Uses

type Z_KVDeleteArgs struct {
    A string
}

type Z_KVDeleteReturns Uses

type Z_KVDeleteReturns struct {
    A *model.AppError
}

type Z_KVGetArgs Uses

type Z_KVGetArgs struct {
    A string
}

type Z_KVGetReturns Uses

type Z_KVGetReturns struct {
    A   []byte
    B   *model.AppError
}

type Z_KVListArgs Uses

type Z_KVListArgs struct {
    A   int
    B   int
}

type Z_KVListReturns Uses

type Z_KVListReturns struct {
    A   []string
    B   *model.AppError
}

type Z_KVSetArgs Uses

type Z_KVSetArgs struct {
    A   string
    B   []byte
}

type Z_KVSetReturns Uses

type Z_KVSetReturns struct {
    A *model.AppError
}

type Z_KVSetWithExpiryArgs Uses

type Z_KVSetWithExpiryArgs struct {
    A   string
    B   []byte
    C   int64
}

type Z_KVSetWithExpiryReturns Uses

type Z_KVSetWithExpiryReturns struct {
    A *model.AppError
}

type Z_KVSetWithOptionsArgs Uses

type Z_KVSetWithOptionsArgs struct {
    A   string
    B   []byte
    C   model.PluginKVSetOptions
}

type Z_KVSetWithOptionsReturns Uses

type Z_KVSetWithOptionsReturns struct {
    A   bool
    B   *model.AppError
}

type Z_LoadPluginConfigurationArgsArgs Uses

type Z_LoadPluginConfigurationArgsArgs struct {
}

type Z_LoadPluginConfigurationArgsReturns Uses

type Z_LoadPluginConfigurationArgsReturns struct {
    A []byte
}

type Z_LogDebugArgs Uses

type Z_LogDebugArgs struct {
    A   string
    B   []interface{}
}

type Z_LogDebugReturns Uses

type Z_LogDebugReturns struct {
}

type Z_LogErrorArgs Uses

type Z_LogErrorArgs struct {
    A   string
    B   []interface{}
}

type Z_LogErrorReturns Uses

type Z_LogErrorReturns struct {
}

type Z_LogInfoArgs Uses

type Z_LogInfoArgs struct {
    A   string
    B   []interface{}
}

type Z_LogInfoReturns Uses

type Z_LogInfoReturns struct {
}

type Z_LogWarnArgs Uses

type Z_LogWarnArgs struct {
    A   string
    B   []interface{}
}

type Z_LogWarnReturns Uses

type Z_LogWarnReturns struct {
}

type Z_MessageHasBeenPostedArgs Uses

type Z_MessageHasBeenPostedArgs struct {
    A   *Context
    B   *model.Post
}

type Z_MessageHasBeenPostedReturns Uses

type Z_MessageHasBeenPostedReturns struct {
}

type Z_MessageHasBeenUpdatedArgs Uses

type Z_MessageHasBeenUpdatedArgs struct {
    A   *Context
    B   *model.Post
    C   *model.Post
}

type Z_MessageHasBeenUpdatedReturns Uses

type Z_MessageHasBeenUpdatedReturns struct {
}

type Z_MessageWillBePostedArgs Uses

type Z_MessageWillBePostedArgs struct {
    A   *Context
    B   *model.Post
}

type Z_MessageWillBePostedReturns Uses

type Z_MessageWillBePostedReturns struct {
    A   *model.Post
    B   string
}

type Z_MessageWillBeUpdatedArgs Uses

type Z_MessageWillBeUpdatedArgs struct {
    A   *Context
    B   *model.Post
    C   *model.Post
}

type Z_MessageWillBeUpdatedReturns Uses

type Z_MessageWillBeUpdatedReturns struct {
    A   *model.Post
    B   string
}

type Z_OnActivateArgs Uses

type Z_OnActivateArgs struct {
    APIMuxId uint32
}

type Z_OnActivateReturns Uses

type Z_OnActivateReturns struct {
    A error
}

type Z_OnConfigurationChangeArgs Uses

type Z_OnConfigurationChangeArgs struct {
}

type Z_OnConfigurationChangeReturns Uses

type Z_OnConfigurationChangeReturns struct {
    A error
}

type Z_OnDeactivateArgs Uses

type Z_OnDeactivateArgs struct {
}

type Z_OnDeactivateReturns Uses

type Z_OnDeactivateReturns struct {
    A error
}

type Z_OpenInteractiveDialogArgs Uses

type Z_OpenInteractiveDialogArgs struct {
    A model.OpenDialogRequest
}

type Z_OpenInteractiveDialogReturns Uses

type Z_OpenInteractiveDialogReturns struct {
    A *model.AppError
}

type Z_PatchBotArgs Uses

type Z_PatchBotArgs struct {
    A   string
    B   *model.BotPatch
}

type Z_PatchBotReturns Uses

type Z_PatchBotReturns struct {
    A   *model.Bot
    B   *model.AppError
}

type Z_PermanentDeleteBotArgs Uses

type Z_PermanentDeleteBotArgs struct {
    A string
}

type Z_PermanentDeleteBotReturns Uses

type Z_PermanentDeleteBotReturns struct {
    A *model.AppError
}

type Z_PluginHTTPArgs Uses

type Z_PluginHTTPArgs struct {
    Request     *http.Request
    RequestBody []byte
}

type Z_PluginHTTPReturns Uses

type Z_PluginHTTPReturns struct {
    Response     *http.Response
    ResponseBody []byte
}

type Z_PublishWebSocketEventArgs Uses

type Z_PublishWebSocketEventArgs struct {
    A   string
    B   map[string]interface{}
    C   *model.WebsocketBroadcast
}

type Z_PublishWebSocketEventReturns Uses

type Z_PublishWebSocketEventReturns struct {
}

type Z_ReadFileArgs Uses

type Z_ReadFileArgs struct {
    A string
}

type Z_ReadFileReturns Uses

type Z_ReadFileReturns struct {
    A   []byte
    B   *model.AppError
}

type Z_RegisterCommandArgs Uses

type Z_RegisterCommandArgs struct {
    A *model.Command
}

type Z_RegisterCommandReturns Uses

type Z_RegisterCommandReturns struct {
    A error
}

type Z_RemovePluginArgs Uses

type Z_RemovePluginArgs struct {
    A string
}

type Z_RemovePluginReturns Uses

type Z_RemovePluginReturns struct {
    A *model.AppError
}

type Z_RemoveReactionArgs Uses

type Z_RemoveReactionArgs struct {
    A *model.Reaction
}

type Z_RemoveReactionReturns Uses

type Z_RemoveReactionReturns struct {
    A *model.AppError
}

type Z_RemoveTeamIconArgs Uses

type Z_RemoveTeamIconArgs struct {
    A string
}

type Z_RemoveTeamIconReturns Uses

type Z_RemoveTeamIconReturns struct {
    A *model.AppError
}

type Z_SaveConfigArgs Uses

type Z_SaveConfigArgs struct {
    A *model.Config
}

type Z_SaveConfigReturns Uses

type Z_SaveConfigReturns struct {
    A *model.AppError
}

type Z_SavePluginConfigArgs Uses

type Z_SavePluginConfigArgs struct {
    A map[string]interface{}
}

type Z_SavePluginConfigReturns Uses

type Z_SavePluginConfigReturns struct {
    A *model.AppError
}

type Z_SearchChannelsArgs Uses

type Z_SearchChannelsArgs struct {
    A   string
    B   string
}

type Z_SearchChannelsReturns Uses

type Z_SearchChannelsReturns struct {
    A   []*model.Channel
    B   *model.AppError
}

type Z_SearchPostsInTeamArgs Uses

type Z_SearchPostsInTeamArgs struct {
    A   string
    B   []*model.SearchParams
}

type Z_SearchPostsInTeamReturns Uses

type Z_SearchPostsInTeamReturns struct {
    A   []*model.Post
    B   *model.AppError
}

type Z_SearchTeamsArgs Uses

type Z_SearchTeamsArgs struct {
    A string
}

type Z_SearchTeamsReturns Uses

type Z_SearchTeamsReturns struct {
    A   []*model.Team
    B   *model.AppError
}

type Z_SearchUsersArgs Uses

type Z_SearchUsersArgs struct {
    A *model.UserSearch
}

type Z_SearchUsersReturns Uses

type Z_SearchUsersReturns struct {
    A   []*model.User
    B   *model.AppError
}

type Z_SendEphemeralPostArgs Uses

type Z_SendEphemeralPostArgs struct {
    A   string
    B   *model.Post
}

type Z_SendEphemeralPostReturns Uses

type Z_SendEphemeralPostReturns struct {
    A *model.Post
}

type Z_SendMailArgs Uses

type Z_SendMailArgs struct {
    A   string
    B   string
    C   string
}

type Z_SendMailReturns Uses

type Z_SendMailReturns struct {
    A *model.AppError
}

type Z_ServeHTTPArgs Uses

type Z_ServeHTTPArgs struct {
    ResponseWriterStream uint32
    Request              *http.Request
    Context              *Context
    RequestBodyStream    uint32
}

type Z_SetBotIconImageArgs Uses

type Z_SetBotIconImageArgs struct {
    A   string
    B   []byte
}

type Z_SetBotIconImageReturns Uses

type Z_SetBotIconImageReturns struct {
    A *model.AppError
}

type Z_SetProfileImageArgs Uses

type Z_SetProfileImageArgs struct {
    A   string
    B   []byte
}

type Z_SetProfileImageReturns Uses

type Z_SetProfileImageReturns struct {
    A *model.AppError
}

type Z_SetTeamIconArgs Uses

type Z_SetTeamIconArgs struct {
    A   string
    B   []byte
}

type Z_SetTeamIconReturns Uses

type Z_SetTeamIconReturns struct {
    A *model.AppError
}

type Z_UnregisterCommandArgs Uses

type Z_UnregisterCommandArgs struct {
    A   string
    B   string
}

type Z_UnregisterCommandReturns Uses

type Z_UnregisterCommandReturns struct {
    A error
}

type Z_UpdateBotActiveArgs Uses

type Z_UpdateBotActiveArgs struct {
    A   string
    B   bool
}

type Z_UpdateBotActiveReturns Uses

type Z_UpdateBotActiveReturns struct {
    A   *model.Bot
    B   *model.AppError
}

type Z_UpdateChannelArgs Uses

type Z_UpdateChannelArgs struct {
    A *model.Channel
}

type Z_UpdateChannelMemberNotificationsArgs Uses

type Z_UpdateChannelMemberNotificationsArgs struct {
    A   string
    B   string
    C   map[string]string
}

type Z_UpdateChannelMemberNotificationsReturns Uses

type Z_UpdateChannelMemberNotificationsReturns struct {
    A   *model.ChannelMember
    B   *model.AppError
}

type Z_UpdateChannelMemberRolesArgs Uses

type Z_UpdateChannelMemberRolesArgs struct {
    A   string
    B   string
    C   string
}

type Z_UpdateChannelMemberRolesReturns Uses

type Z_UpdateChannelMemberRolesReturns struct {
    A   *model.ChannelMember
    B   *model.AppError
}

type Z_UpdateChannelReturns Uses

type Z_UpdateChannelReturns struct {
    A   *model.Channel
    B   *model.AppError
}

type Z_UpdateEphemeralPostArgs Uses

type Z_UpdateEphemeralPostArgs struct {
    A   string
    B   *model.Post
}

type Z_UpdateEphemeralPostReturns Uses

type Z_UpdateEphemeralPostReturns struct {
    A *model.Post
}

type Z_UpdatePostArgs Uses

type Z_UpdatePostArgs struct {
    A *model.Post
}

type Z_UpdatePostReturns Uses

type Z_UpdatePostReturns struct {
    A   *model.Post
    B   *model.AppError
}

type Z_UpdateTeamArgs Uses

type Z_UpdateTeamArgs struct {
    A *model.Team
}

type Z_UpdateTeamMemberRolesArgs Uses

type Z_UpdateTeamMemberRolesArgs struct {
    A   string
    B   string
    C   string
}

type Z_UpdateTeamMemberRolesReturns Uses

type Z_UpdateTeamMemberRolesReturns struct {
    A   *model.TeamMember
    B   *model.AppError
}

type Z_UpdateTeamReturns Uses

type Z_UpdateTeamReturns struct {
    A   *model.Team
    B   *model.AppError
}

type Z_UpdateUserActiveArgs Uses

type Z_UpdateUserActiveArgs struct {
    A   string
    B   bool
}

type Z_UpdateUserActiveReturns Uses

type Z_UpdateUserActiveReturns struct {
    A *model.AppError
}

type Z_UpdateUserArgs Uses

type Z_UpdateUserArgs struct {
    A *model.User
}

type Z_UpdateUserReturns Uses

type Z_UpdateUserReturns struct {
    A   *model.User
    B   *model.AppError
}

type Z_UpdateUserStatusArgs Uses

type Z_UpdateUserStatusArgs struct {
    A   string
    B   string
}

type Z_UpdateUserStatusReturns Uses

type Z_UpdateUserStatusReturns struct {
    A   *model.Status
    B   *model.AppError
}

type Z_UploadFileArgs Uses

type Z_UploadFileArgs struct {
    A   []byte
    B   string
    C   string
}

type Z_UploadFileReturns Uses

type Z_UploadFileReturns struct {
    A   *model.FileInfo
    B   *model.AppError
}

type Z_UserHasBeenCreatedArgs Uses

type Z_UserHasBeenCreatedArgs struct {
    A   *Context
    B   *model.User
}

type Z_UserHasBeenCreatedReturns Uses

type Z_UserHasBeenCreatedReturns struct {
}

type Z_UserHasJoinedChannelArgs Uses

type Z_UserHasJoinedChannelArgs struct {
    A   *Context
    B   *model.ChannelMember
    C   *model.User
}

type Z_UserHasJoinedChannelReturns Uses

type Z_UserHasJoinedChannelReturns struct {
}

type Z_UserHasJoinedTeamArgs Uses

type Z_UserHasJoinedTeamArgs struct {
    A   *Context
    B   *model.TeamMember
    C   *model.User
}

type Z_UserHasJoinedTeamReturns Uses

type Z_UserHasJoinedTeamReturns struct {
}

type Z_UserHasLeftChannelArgs Uses

type Z_UserHasLeftChannelArgs struct {
    A   *Context
    B   *model.ChannelMember
    C   *model.User
}

type Z_UserHasLeftChannelReturns Uses

type Z_UserHasLeftChannelReturns struct {
}

type Z_UserHasLeftTeamArgs Uses

type Z_UserHasLeftTeamArgs struct {
    A   *Context
    B   *model.TeamMember
    C   *model.User
}

type Z_UserHasLeftTeamReturns Uses

type Z_UserHasLeftTeamReturns struct {
}

type Z_UserHasLoggedInArgs Uses

type Z_UserHasLoggedInArgs struct {
    A   *Context
    B   *model.User
}

type Z_UserHasLoggedInReturns Uses

type Z_UserHasLoggedInReturns struct {
}

type Z_UserWillLogInArgs Uses

type Z_UserWillLogInArgs struct {
    A   *Context
    B   *model.User
}

type Z_UserWillLogInReturns Uses

type Z_UserWillLogInReturns struct {
    A string
}

Directories

PathSynopsis
checker
checker/internal/asthelpers
checker/internal/version
interface_generator
plugintestThe plugintest package provides mocks that can be used to test plugins.
plugintest/mockThis package provides aliases for the contents of "github.com/stretchr/testify/mock".
scheduler

Package plugin imports 31 packages (graph) and is imported by 73 packages. Updated 2020-02-18. Refresh now. Tools for package owners.