plugin

package
v5.5.3-rc1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2019 License: AGPL-3.0, Apache-2.0 Imports: 28 Imported by: 6

Documentation

Overview

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.

Example (HelloWorld)

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

package main

import (
	"fmt"
	"net/http"

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

type HelloWorldPlugin struct {
	plugin.MattermostPlugin
}

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

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

Example (HelpPlugin)
package main

import (
	"strings"

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

type HelpPlugin struct {
	plugin.MattermostPlugin

	TeamName    string
	ChannelName string

	channelId string
}

func (p *HelpPlugin) OnConfigurationChange() error {
	// Reuse the default implementation of OnConfigurationChange to automatically load the
	// required TeamName and ChannelName.
	if err := p.MattermostPlugin.OnConfigurationChange(); err != nil {
		p.API.LogError(err.Error())
		return nil
	}

	team, err := p.API.GetTeamByName(p.TeamName)
	if err != nil {
		p.API.LogError("failed to find team", "team_name", p.TeamName)
		return nil
	}

	channel, err := p.API.GetChannelByName(p.ChannelName, team.Id, false)
	if err != nil {
		p.API.LogError("failed to find channel", "channel_name", p.ChannelName)
		return nil
	}

	p.channelId = channel.Id

	return nil
}

func (p *HelpPlugin) MessageHasBeenPosted(c *plugin.Context, post *model.Post) {
	// Ignore posts not in the configured channel
	if post.ChannelId != p.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: p.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{})
}
Output:

Index

Examples

Constants

View Source
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
	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.

View Source
const (
	MinIdLength  = 3
	MaxIdLength  = 190
	ValidIdRegex = `^[a-zA-Z0-9-_\.]+$`
)

Variables

This section is empty.

Functions

func ClientMain

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.

func IsValidId

func IsValidId(id string) bool

IsValidId verifies that the plugin id has a minimum length of 3, maximum length of 190, and contains only alphanumeric characters, dashes, underscores and periods.

These constraints are necessary since the plugin id is used as part of a filesystem path.

Types

type API

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.
	LoadPluginConfiguration(dest interface{}) error

	// RegisterCommand registers a custom slash command. When the command is triggered, your plugin
	// can fulfill it via the ExecuteCommand hook.
	RegisterCommand(command *model.Command) error

	// UnregisterCommand unregisters a command previously registered via RegisterCommand.
	UnregisterCommand(teamId, trigger string) error

	// GetSession returns the session object for the Session ID
	GetSession(sessionId string) (*model.Session, *model.AppError)

	// GetConfig fetches the currently persisted config
	GetConfig() *model.Config

	// SaveConfig sets the given config and persists the changes
	SaveConfig(config *model.Config) *model.AppError

	// GetServerVersion return the current Mattermost server version
	GetServerVersion() string

	// CreateUser creates a user.
	CreateUser(user *model.User) (*model.User, *model.AppError)

	// DeleteUser deletes a user.
	DeleteUser(userId string) *model.AppError

	// GetUser gets a user.
	GetUser(userId string) (*model.User, *model.AppError)

	// GetUserByEmail gets a user by their email address.
	GetUserByEmail(email string) (*model.User, *model.AppError)

	// GetUserByUsername gets a user by their username.
	GetUserByUsername(name string) (*model.User, *model.AppError)

	// UpdateUser updates a user.
	UpdateUser(user *model.User) (*model.User, *model.AppError)

	// GetUserStatus will get a user's status.
	GetUserStatus(userId string) (*model.Status, *model.AppError)

	// GetUserStatusesByIds will return a list of user statuses based on the provided slice of user IDs.
	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".
	UpdateUserStatus(userId, status string) (*model.Status, *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.
	GetLDAPUserAttributes(userId string, attributes []string) (map[string]string, *model.AppError)

	// CreateTeam creates a team.
	CreateTeam(team *model.Team) (*model.Team, *model.AppError)

	// DeleteTeam deletes a team.
	DeleteTeam(teamId string) *model.AppError

	// GetTeam gets all teams.
	GetTeams() ([]*model.Team, *model.AppError)

	// GetTeam gets a team.
	GetTeam(teamId string) (*model.Team, *model.AppError)

	// GetTeamByName gets a team by its name.
	GetTeamByName(name string) (*model.Team, *model.AppError)

	// UpdateTeam updates a team.
	UpdateTeam(team *model.Team) (*model.Team, *model.AppError)

	// CreateTeamMember creates a team membership.
	CreateTeamMember(teamId, userId string) (*model.TeamMember, *model.AppError)

	// CreateTeamMember creates a team membership for all provided user ids.
	CreateTeamMembers(teamId string, userIds []string, requestorId string) ([]*model.TeamMember, *model.AppError)

	// DeleteTeamMember deletes a team membership.
	DeleteTeamMember(teamId, userId, requestorId string) *model.AppError

	// GetTeamMembers returns the memberships of a specific team.
	GetTeamMembers(teamId string, offset, limit int) ([]*model.TeamMember, *model.AppError)

	// GetTeamMember returns a specific membership.
	GetTeamMember(teamId, userId string) (*model.TeamMember, *model.AppError)

	// UpdateTeamMemberRoles updates the role for a team membership.
	UpdateTeamMemberRoles(teamId, userId, newRoles string) (*model.TeamMember, *model.AppError)

	// CreateChannel creates a channel.
	CreateChannel(channel *model.Channel) (*model.Channel, *model.AppError)

	// DeleteChannel deletes a channel.
	DeleteChannel(channelId string) *model.AppError

	// GetPublicChannelsForTeam gets a list of all channels.
	GetPublicChannelsForTeam(teamId string, offset, limit int) (*model.ChannelList, *model.AppError)

	// GetChannel gets a channel.
	GetChannel(channelId string) (*model.Channel, *model.AppError)

	// GetChannelByName gets a channel by its name, given a team id.
	GetChannelByName(teamId, name string, includeDeleted bool) (*model.Channel, *model.AppError)

	// GetChannelByNameForTeamName gets a channel by its name, given a team name.
	GetChannelByNameForTeamName(teamName, channelName string, includeDeleted bool) (*model.Channel, *model.AppError)

	// GetDirectChannel gets a direct message channel.
	GetDirectChannel(userId1, userId2 string) (*model.Channel, *model.AppError)

	// GetGroupChannel gets a group message channel.
	GetGroupChannel(userIds []string) (*model.Channel, *model.AppError)

	// UpdateChannel updates a channel.
	UpdateChannel(channel *model.Channel) (*model.Channel, *model.AppError)

	// AddChannelMember creates a channel membership for a user.
	AddChannelMember(channelId, userId string) (*model.ChannelMember, *model.AppError)

	// GetChannelMember gets a channel membership for a user.
	GetChannelMember(channelId, userId string) (*model.ChannelMember, *model.AppError)

	// UpdateChannelMemberRoles updates a user's roles for a channel.
	UpdateChannelMemberRoles(channelId, userId, newRoles string) (*model.ChannelMember, *model.AppError)

	// UpdateChannelMemberNotifications updates a user's notification properties for a channel.
	UpdateChannelMemberNotifications(channelId, userId string, notifications map[string]string) (*model.ChannelMember, *model.AppError)

	// DeleteChannelMember deletes a channel membership for a user.
	DeleteChannelMember(channelId, userId string) *model.AppError

	// CreatePost creates a post.
	CreatePost(post *model.Post) (*model.Post, *model.AppError)

	// AddReaction add a reaction to a post.
	AddReaction(reaction *model.Reaction) (*model.Reaction, *model.AppError)

	// RemoveReaction remove a reaction from a post.
	RemoveReaction(reaction *model.Reaction) *model.AppError

	// GetReaction get the reactions of a post.
	GetReactions(postId string) ([]*model.Reaction, *model.AppError)

	// SendEphemeralPost creates an ephemeral post.
	SendEphemeralPost(userId string, post *model.Post) *model.Post

	// DeletePost deletes a post.
	DeletePost(postId string) *model.AppError

	// GetPost gets a post.
	GetPost(postId string) (*model.Post, *model.AppError)

	// UpdatePost updates a post.
	UpdatePost(post *model.Post) (*model.Post, *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.
	CopyFileInfos(userId string, fileIds []string) ([]string, *model.AppError)

	// GetFileInfo gets a File Info for a specific fileId
	GetFileInfo(fileId string) (*model.FileInfo, *model.AppError)

	// ReadFileAtPath reads the file from the backend for a specific path
	ReadFile(path string) ([]byte, *model.AppError)

	// KVSet will store a key-value pair, unique per plugin.
	KVSet(key string, value []byte) *model.AppError

	// KVGet will retrieve a value based on the key. Returns nil for non-existent keys.
	KVGet(key string) ([]byte, *model.AppError)

	// KVDelete will remove a key-value pair. Returns nil for non-existent keys.
	KVDelete(key 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
	PublishWebSocketEvent(event string, payload map[string]interface{}, broadcast *model.WebsocketBroadcast)

	// HasPermissionTo check if the user has the permission at system scope.
	HasPermissionTo(userId string, permission *model.Permission) bool

	// HasPermissionToTeam check if the user has the permission at team scope.
	HasPermissionToTeam(userId, teamId string, permission *model.Permission) bool

	// HasPermissionToChannel check if the user has the permission at channel scope.
	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.
	// keyValuePairs should be primitive go types or other values that can be encoded by encoding/gob
	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.
	// keyValuePairs should be primitive go types or other values that can be encoded by encoding/gob
	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.
	// keyValuePairs should be primitive go types or other values that can be encoded by encoding/gob
	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.
	// keyValuePairs should be primitive go types or other values that can be encoded by encoding/gob
	LogWarn(msg string, keyValuePairs ...interface{})
}

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

type Context struct {
	SessionId string
}

Context passes through metadata about the request or hook event.

It is currently a placeholder while the implementation details are sorted out.

type Environment

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

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

func (*Environment) Activate

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

func (*Environment) Active

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

Returns a list of all currently active plugins within the environment.

func (*Environment) Available

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

Returns a list of all plugins within the environment.

func (*Environment) Deactivate

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

Deactivates the plugin with the given id.

func (*Environment) HooksForPlugin

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) IsActive

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

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

func (*Environment) RunMultiPluginHook

func (env *Environment) RunMultiPluginHook(hookRunnerFunc multiPluginHookRunnerFunc, hookId int)

RunMultiPluginHook invokes hookRunnerFunc for each 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) Shutdown

func (env *Environment) Shutdown()

Shutdown deactivates all plugins and gracefully shuts down the environment.

func (*Environment) Statuses

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

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

type ErrorString

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

func (e ErrorString) Error() string

type Hooks

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.
	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.
	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)

	// 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.
	//
	// 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)

	// 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)

	// 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 MattermostPlugin

type MattermostPlugin struct {
	// API exposes the plugin api, and becomes available just prior to the OnActive hook.
	API API
	// contains filtered or unexported fields
}

func (*MattermostPlugin) OnConfigurationChange

func (p *MattermostPlugin) OnConfigurationChange() error

OnConfigurationChange provides a default implementation of this hook event that unmarshals the plugin configuration directly onto the plugin struct.

Feel free to implement your own version of OnConfigurationChange if you need more advanced configuration handling.

func (*MattermostPlugin) SetAPI

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) SetSelfRef

func (p *MattermostPlugin) SetSelfRef(ref interface{})

SetSelfRef is called by ClientMain to maintain a pointer to the plugin interface originally registered. This allows for the default implementation of OnConfigurationChange.

type Z_AddChannelMemberArgs

type Z_AddChannelMemberArgs struct {
	A string
	B string
}

type Z_AddChannelMemberReturns

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

type Z_AddReactionArgs

type Z_AddReactionArgs struct {
	A *model.Reaction
}

type Z_AddReactionReturns

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

type Z_ChannelHasBeenCreatedArgs

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

type Z_ChannelHasBeenCreatedReturns

type Z_ChannelHasBeenCreatedReturns struct {
}

type Z_CopyFileInfosArgs

type Z_CopyFileInfosArgs struct {
	A string
	B []string
}

type Z_CopyFileInfosReturns

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

type Z_CreateChannelArgs

type Z_CreateChannelArgs struct {
	A *model.Channel
}

type Z_CreateChannelReturns

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

type Z_CreatePostArgs

type Z_CreatePostArgs struct {
	A *model.Post
}

type Z_CreatePostReturns

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

type Z_CreateTeamArgs

type Z_CreateTeamArgs struct {
	A *model.Team
}

type Z_CreateTeamMemberArgs

type Z_CreateTeamMemberArgs struct {
	A string
	B string
}

type Z_CreateTeamMemberReturns

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

type Z_CreateTeamMembersArgs

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

type Z_CreateTeamMembersReturns

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

type Z_CreateTeamReturns

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

type Z_CreateUserArgs

type Z_CreateUserArgs struct {
	A *model.User
}

type Z_CreateUserReturns

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

type Z_DeleteChannelArgs

type Z_DeleteChannelArgs struct {
	A string
}

type Z_DeleteChannelMemberArgs

type Z_DeleteChannelMemberArgs struct {
	A string
	B string
}

type Z_DeleteChannelMemberReturns

type Z_DeleteChannelMemberReturns struct {
	A *model.AppError
}

type Z_DeleteChannelReturns

type Z_DeleteChannelReturns struct {
	A *model.AppError
}

type Z_DeletePostArgs

type Z_DeletePostArgs struct {
	A string
}

type Z_DeletePostReturns

type Z_DeletePostReturns struct {
	A *model.AppError
}

type Z_DeleteTeamArgs

type Z_DeleteTeamArgs struct {
	A string
}

type Z_DeleteTeamMemberArgs

type Z_DeleteTeamMemberArgs struct {
	A string
	B string
	C string
}

type Z_DeleteTeamMemberReturns

type Z_DeleteTeamMemberReturns struct {
	A *model.AppError
}

type Z_DeleteTeamReturns

type Z_DeleteTeamReturns struct {
	A *model.AppError
}

type Z_DeleteUserArgs

type Z_DeleteUserArgs struct {
	A string
}

type Z_DeleteUserReturns

type Z_DeleteUserReturns struct {
	A *model.AppError
}

type Z_ExecuteCommandArgs

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

type Z_ExecuteCommandReturns

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

type Z_FileWillBeUploadedArgs

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

type Z_FileWillBeUploadedReturns

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

type Z_GetChannelArgs

type Z_GetChannelArgs struct {
	A string
}

type Z_GetChannelByNameArgs

type Z_GetChannelByNameArgs struct {
	A string
	B string
	C bool
}

type Z_GetChannelByNameForTeamNameArgs

type Z_GetChannelByNameForTeamNameArgs struct {
	A string
	B string
	C bool
}

type Z_GetChannelByNameForTeamNameReturns

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

type Z_GetChannelByNameReturns

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

type Z_GetChannelMemberArgs

type Z_GetChannelMemberArgs struct {
	A string
	B string
}

type Z_GetChannelMemberReturns

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

type Z_GetChannelReturns

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

type Z_GetConfigArgs

type Z_GetConfigArgs struct {
}

type Z_GetConfigReturns

type Z_GetConfigReturns struct {
	A *model.Config
}

type Z_GetDirectChannelArgs

type Z_GetDirectChannelArgs struct {
	A string
	B string
}

type Z_GetDirectChannelReturns

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

type Z_GetFileInfoArgs

type Z_GetFileInfoArgs struct {
	A string
}

type Z_GetFileInfoReturns

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

type Z_GetGroupChannelArgs

type Z_GetGroupChannelArgs struct {
	A []string
}

type Z_GetGroupChannelReturns

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

type Z_GetLDAPUserAttributesArgs

type Z_GetLDAPUserAttributesArgs struct {
	A string
	B []string
}

type Z_GetLDAPUserAttributesReturns

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

type Z_GetPostArgs

type Z_GetPostArgs struct {
	A string
}

type Z_GetPostReturns

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

type Z_GetPublicChannelsForTeamArgs

type Z_GetPublicChannelsForTeamArgs struct {
	A string
	B int
	C int
}

type Z_GetPublicChannelsForTeamReturns

type Z_GetPublicChannelsForTeamReturns struct {
	A *model.ChannelList
	B *model.AppError
}

type Z_GetReactionsArgs

type Z_GetReactionsArgs struct {
	A string
}

type Z_GetReactionsReturns

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

type Z_GetServerVersionArgs

type Z_GetServerVersionArgs struct {
}

type Z_GetServerVersionReturns

type Z_GetServerVersionReturns struct {
	A string
}

type Z_GetSessionArgs

type Z_GetSessionArgs struct {
	A string
}

type Z_GetSessionReturns

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

type Z_GetTeamArgs

type Z_GetTeamArgs struct {
	A string
}

type Z_GetTeamByNameArgs

type Z_GetTeamByNameArgs struct {
	A string
}

type Z_GetTeamByNameReturns

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

type Z_GetTeamMemberArgs

type Z_GetTeamMemberArgs struct {
	A string
	B string
}

type Z_GetTeamMemberReturns

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

type Z_GetTeamMembersArgs

type Z_GetTeamMembersArgs struct {
	A string
	B int
	C int
}

type Z_GetTeamMembersReturns

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

type Z_GetTeamReturns

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

type Z_GetTeamsArgs

type Z_GetTeamsArgs struct {
}

type Z_GetTeamsReturns

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

type Z_GetUserArgs

type Z_GetUserArgs struct {
	A string
}

type Z_GetUserByEmailArgs

type Z_GetUserByEmailArgs struct {
	A string
}

type Z_GetUserByEmailReturns

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

type Z_GetUserByUsernameArgs

type Z_GetUserByUsernameArgs struct {
	A string
}

type Z_GetUserByUsernameReturns

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

type Z_GetUserReturns

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

type Z_GetUserStatusArgs

type Z_GetUserStatusArgs struct {
	A string
}

type Z_GetUserStatusReturns

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

type Z_GetUserStatusesByIdsArgs

type Z_GetUserStatusesByIdsArgs struct {
	A []string
}

type Z_GetUserStatusesByIdsReturns

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

type Z_HasPermissionToArgs

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

type Z_HasPermissionToChannelArgs

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

type Z_HasPermissionToChannelReturns

type Z_HasPermissionToChannelReturns struct {
	A bool
}

type Z_HasPermissionToReturns

type Z_HasPermissionToReturns struct {
	A bool
}

type Z_HasPermissionToTeamArgs

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

type Z_HasPermissionToTeamReturns

type Z_HasPermissionToTeamReturns struct {
	A bool
}

type Z_KVDeleteArgs

type Z_KVDeleteArgs struct {
	A string
}

type Z_KVDeleteReturns

type Z_KVDeleteReturns struct {
	A *model.AppError
}

type Z_KVGetArgs

type Z_KVGetArgs struct {
	A string
}

type Z_KVGetReturns

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

type Z_KVSetArgs

type Z_KVSetArgs struct {
	A string
	B []byte
}

type Z_KVSetReturns

type Z_KVSetReturns struct {
	A *model.AppError
}

type Z_LoadPluginConfigurationArgsArgs

type Z_LoadPluginConfigurationArgsArgs struct {
}

type Z_LoadPluginConfigurationArgsReturns

type Z_LoadPluginConfigurationArgsReturns struct {
	A []byte
}

type Z_LogDebugArgs

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

type Z_LogDebugReturns

type Z_LogDebugReturns struct {
}

type Z_LogErrorArgs

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

type Z_LogErrorReturns

type Z_LogErrorReturns struct {
}

type Z_LogInfoArgs

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

type Z_LogInfoReturns

type Z_LogInfoReturns struct {
}

type Z_LogWarnArgs

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

type Z_LogWarnReturns

type Z_LogWarnReturns struct {
}

type Z_MessageHasBeenPostedArgs

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

type Z_MessageHasBeenPostedReturns

type Z_MessageHasBeenPostedReturns struct {
}

type Z_MessageHasBeenUpdatedArgs

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

type Z_MessageHasBeenUpdatedReturns

type Z_MessageHasBeenUpdatedReturns struct {
}

type Z_MessageWillBePostedArgs

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

type Z_MessageWillBePostedReturns

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

type Z_MessageWillBeUpdatedArgs

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

type Z_MessageWillBeUpdatedReturns

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

type Z_OnActivateArgs

type Z_OnActivateArgs struct {
	APIMuxId uint32
}

type Z_OnActivateReturns

type Z_OnActivateReturns struct {
	A error
}

type Z_OnConfigurationChangeArgs

type Z_OnConfigurationChangeArgs struct {
}

type Z_OnConfigurationChangeReturns

type Z_OnConfigurationChangeReturns struct {
	A error
}

type Z_OnDeactivateArgs

type Z_OnDeactivateArgs struct {
}

type Z_OnDeactivateReturns

type Z_OnDeactivateReturns struct {
	A error
}

type Z_PublishWebSocketEventArgs

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

type Z_PublishWebSocketEventReturns

type Z_PublishWebSocketEventReturns struct {
}

type Z_ReadFileArgs

type Z_ReadFileArgs struct {
	A string
}

type Z_ReadFileReturns

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

type Z_RegisterCommandArgs

type Z_RegisterCommandArgs struct {
	A *model.Command
}

type Z_RegisterCommandReturns

type Z_RegisterCommandReturns struct {
	A error
}

type Z_RemoveReactionArgs

type Z_RemoveReactionArgs struct {
	A *model.Reaction
}

type Z_RemoveReactionReturns

type Z_RemoveReactionReturns struct {
	A *model.AppError
}

type Z_SaveConfigArgs

type Z_SaveConfigArgs struct {
	A *model.Config
}

type Z_SaveConfigReturns

type Z_SaveConfigReturns struct {
	A *model.AppError
}

type Z_SendEphemeralPostArgs

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

type Z_SendEphemeralPostReturns

type Z_SendEphemeralPostReturns struct {
	A *model.Post
}

type Z_ServeHTTPArgs

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

type Z_UnregisterCommandArgs

type Z_UnregisterCommandArgs struct {
	A string
	B string
}

type Z_UnregisterCommandReturns

type Z_UnregisterCommandReturns struct {
	A error
}

type Z_UpdateChannelArgs

type Z_UpdateChannelArgs struct {
	A *model.Channel
}

type Z_UpdateChannelMemberNotificationsArgs

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

type Z_UpdateChannelMemberNotificationsReturns

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

type Z_UpdateChannelMemberRolesArgs

type Z_UpdateChannelMemberRolesArgs struct {
	A string
	B string
	C string
}

type Z_UpdateChannelMemberRolesReturns

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

type Z_UpdateChannelReturns

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

type Z_UpdatePostArgs

type Z_UpdatePostArgs struct {
	A *model.Post
}

type Z_UpdatePostReturns

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

type Z_UpdateTeamArgs

type Z_UpdateTeamArgs struct {
	A *model.Team
}

type Z_UpdateTeamMemberRolesArgs

type Z_UpdateTeamMemberRolesArgs struct {
	A string
	B string
	C string
}

type Z_UpdateTeamMemberRolesReturns

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

type Z_UpdateTeamReturns

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

type Z_UpdateUserArgs

type Z_UpdateUserArgs struct {
	A *model.User
}

type Z_UpdateUserReturns

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

type Z_UpdateUserStatusArgs

type Z_UpdateUserStatusArgs struct {
	A string
	B string
}

type Z_UpdateUserStatusReturns

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

type Z_UserHasJoinedChannelArgs

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

type Z_UserHasJoinedChannelReturns

type Z_UserHasJoinedChannelReturns struct {
}

type Z_UserHasJoinedTeamArgs

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

type Z_UserHasJoinedTeamReturns

type Z_UserHasJoinedTeamReturns struct {
}

type Z_UserHasLeftChannelArgs

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

type Z_UserHasLeftChannelReturns

type Z_UserHasLeftChannelReturns struct {
}

type Z_UserHasLeftTeamArgs

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

type Z_UserHasLeftTeamReturns

type Z_UserHasLeftTeamReturns struct {
}

type Z_UserHasLoggedInArgs

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

type Z_UserHasLoggedInReturns

type Z_UserHasLoggedInReturns struct {
}

type Z_UserWillLogInArgs

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

type Z_UserWillLogInReturns

type Z_UserWillLogInReturns struct {
	A string
}

Directories

Path Synopsis
The plugintest package provides mocks that can be used to test plugins.
The plugintest package provides mocks that can be used to test plugins.
mock
This package provides aliases for the contents of "github.com/stretchr/testify/mock".
This package provides aliases for the contents of "github.com/stretchr/testify/mock".

Jump to

Keyboard shortcuts

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